1681-engine / ui / RichMeasure
Interface: RichMeasure ​
Defined in: src/ui/rich/richLayout.ts:12
Line breaking and placement for RichText, pure: every width and height comes from a RichMeasure the caller hands in, so the same layout runs under node in a test, with a canvas font, or with a bitmap font.
Lines break only at spaces and \n; a word wider than the whole line is broken between letters. Text and icons with no space between them ([icon=coin]50) stay together. Text of one style that ends up side by side on a line is one item, so a paragraph in one colour costs one display object a line.
Methods ​
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
iconSize() ​
iconSize(key, frame): object;Defined in: src/ui/rich/richLayout.ts:20
Size of an icon's frame in texture pixels.
Parameters ​
| Parameter | Type |
|---|---|
key | string |
frame | string | undefined |
Returns ​
object
height ​
height: number;width ​
width: number;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
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