1681-engine / ui / CanvasRichFont
Class: CanvasRichFont ​
Defined in: src/ui/rich/richFonts.ts:45
Runs as canvas Text: any font the page has, with bold and italic. Every style used gets one Pixi TextStyle, shared by every run in it. Changing a run's text repaints and uploads its canvas, so text rewritten every frame belongs in a BitmapRichFont.
Implements ​
Constructors ​
Constructor ​
new CanvasRichFont(options): CanvasRichFont;Defined in: src/ui/rich/richFonts.ts:49
Parameters ​
| Parameter | Type |
|---|---|
options | RichFontOptions |
Returns ​
CanvasRichFont
Methods ​
ascent() ​
ascent(style): number;Defined in: src/ui/rich/richFonts.ts:60
Baseline from the top of such a line; 0.8 of the line height when not given.
Parameters ​
| Parameter | Type |
|---|---|
style | RichStyle |
Returns ​
number
Implementation of ​
createRun() ​
createRun(): Container;Defined in: src/ui/rich/richFonts.ts:64
A fresh, empty run.
Returns ​
Container
Implementation of ​
lineHeight() ​
lineHeight(style): number;Defined in: src/ui/rich/richFonts.ts:56
Height of a line of text in style.
Parameters ​
| Parameter | Type |
|---|---|
style | RichStyle |
Returns ​
number
Implementation of ​
textWidth() ​
textWidth(text, style): number;Defined in: src/ui/rich/richFonts.ts:51
Advance width of text in style (spaces included: they are measured on their own).
Parameters ​
| Parameter | Type |
|---|---|
text | string |
style | RichStyle |
Returns ​
number
Implementation of ​
updateRun() ​
updateRun(
run,
text,
style
): void;Defined in: src/ui/rich/richFonts.ts:68
Shows text in style on a run made by createRun; cheap when neither changed.
Parameters ​
| Parameter | Type |
|---|---|
run | Container |
text | string |
style | RichStyle |
Returns ​
void