1681-engine / ui / RichFont
Interface: RichFont ​
Defined in: src/ui/rich/richFonts.ts:11
What RichText draws its runs with: it measures text for the layout and makes and updates one display object a run. Two come with the engine — CanvasRichFont (any font, bold and italic) and BitmapRichFont (glyphs baked once, cheap to change) — and a game may write its own.
Extends ​
Omit<RichMeasure,"iconSize">
Properties ​
ascent? ​
optional ascent?: (style) => number;Defined in: src/ui/rich/richLayout.ts:18
Baseline from the top of such a line; 0.8 of the line height when not given.
Parameters ​
| Parameter | Type |
|---|---|
style | RichStyle |
Returns ​
number
Inherited from ​
Methods ​
createRun() ​
createRun(): Container;Defined in: src/ui/rich/richFonts.ts:13
A fresh, empty run.
Returns ​
Container
lineHeight() ​
lineHeight(style): number;Defined in: src/ui/rich/richLayout.ts:16
Height of a line of text in style.
Parameters ​
| Parameter | Type |
|---|---|
style | RichStyle |
Returns ​
number
Inherited from ​
textWidth() ​
textWidth(text, style): number;Defined in: src/ui/rich/richLayout.ts:14
Advance width of text in style (spaces included: they are measured on their own).
Parameters ​
| Parameter | Type |
|---|---|
text | string |
style | RichStyle |
Returns ​
number
Inherited from ​
updateRun() ​
updateRun(
run,
text,
style
): void;Defined in: src/ui/rich/richFonts.ts:15
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