Skip to content

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 ​

Properties ​

ascent? ​

ts
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 ​

ParameterType
styleRichStyle

Returns ​

number

Inherited from ​

RichMeasure.ascent

Methods ​

createRun() ​

ts
createRun(): Container;

Defined in: src/ui/rich/richFonts.ts:13

A fresh, empty run.

Returns ​

Container


lineHeight() ​

ts
lineHeight(style): number;

Defined in: src/ui/rich/richLayout.ts:16

Height of a line of text in style.

Parameters ​

ParameterType
styleRichStyle

Returns ​

number

Inherited from ​

RichMeasure.lineHeight


textWidth() ​

ts
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 ​

ParameterType
textstring
styleRichStyle

Returns ​

number

Inherited from ​

RichMeasure.textWidth


updateRun() ​

ts
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 ​

ParameterType
runContainer
textstring
styleRichStyle

Returns ​

void

Released under the MIT License.