new TextStyle(fontopt, sizeopt, fillColoropt, strokeColoropt, strokeWidthopt)
Text style data
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
font | String | <optional> | 'sans-serif' | The text font |
size | Number | <optional> | 24 | The text size, in pixels |
fillColor | String | <optional> | '#000f' | The fill color |
strokeColor | String | <optional> | '#000f' | The stroke color. (Stroke paint is disabled by default - use TextStyle.setPaint to enable stroke) |
strokeWidth | Number | <optional> | 1 | The stroke width |
Members
font :String
The text font
Type:
- String
lineHeight :Number
The line height, relative to the font size
Type:
- Number
- Default Value
- 1
opacity :Number
The opacity of the text
Type:
- Number
- Default Value
- 1
size :Number
The text size, in pixels
Type:
- Number
Methods
getFill() → {Object}
Get the fill paint settings
Returns:
{paint: Boolean, color: String}
- Type:
- Object
getStroke() → {Object}
Get the stroke paint settings
Returns:
{paint: Boolean, color: String}
- Type:
- Object
setPaint(fillopt, fillColoropt, strokeColoropt, strokeWidthopt)
Set the paint options
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
fill | String | <optional> | "fill", "stroke", "none" or "both" |
fillColor | String | <optional> | The text fill color |
strokeColor | String | <optional> | The text stroke color |
strokeWidth | String | <optional> | The text stroke width |