Font
Stores the font settings currently used by a World Element.
Static Method Summary
| Static Private Methods | ||
| private static |
validateAlign(align: string): boolean Checks if the provided align value is valid for a canvas element. |
|
| private static |
validateBaseline(baseline: string): boolean Checks if the provided baseline value is valid for a canvas element. |
|
Constructor Summary
| Public Constructor | ||
| public |
constructor(opts: object) |
|
Member Summary
| Public Members | ||
| public |
Sets the alignment value for the text. |
|
| public |
Sets the baseline value for the text. |
|
| public |
Sets the font color in HEX format. |
|
| public |
Sets the font face used. |
|
| public |
Sets the font size in pixels. |
|
| public |
Sets the line spacing between text lines. |
|
| public |
Sets the font weight used. |
|
Method Summary
| Public Methods | ||
| public |
Given an object with valid properties, it assigns their values to the object. |
|
| Private Methods | ||
| private |
Sets the current font settings to the context. |
|
Static Private Methods
private static validateAlign(align: string): boolean source
Checks if the provided align value is valid for a canvas element. Valid align values: "left", "right", "center", "start", "end".
Params:
| Name | Type | Attribute | Description |
| align | string | Align value to check. |
Throw:
error |
Error when the align value is invalid. |
private static validateBaseline(baseline: string): boolean source
Checks if the provided baseline value is valid for a canvas element. Valid baseline values include: "top", "hanging", "middle", "alphabetic", "ideographic", "bottom".
Params:
| Name | Type | Attribute | Description |
| baseline | string | Baseline value to check. |
Throw:
error |
Error when the baseline value is invalid. |