Skip to content

1681-engine / ui / BitmapRichFont

Class: BitmapRichFont ​

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

Runs as BitmapText from label fonts (installLabelFont): changing the text costs no canvas and no upload, and the runs batch. Each colour × size is a font of its own, baked the first time it is used — keep to a few and print each once while loading, or the first line to use one bakes it on that frame. Bitmap fonts have no bold or italic: those tags change nothing here.

Implements ​

Constructors ​

Constructor ​

ts
new BitmapRichFont(options): BitmapRichFont;

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

Parameters ​

ParameterType
optionsBitmapRichFontOptions

Returns ​

BitmapRichFont

Methods ​

ascent() ​

ts
ascent(style): number;

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

Baseline from the top of such a line; 0.8 of the line height when not given.

Parameters ​

ParameterType
styleRichStyle

Returns ​

number

Implementation of ​

RichFont.ascent


createRun() ​

ts
createRun(): Container;

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

A fresh, empty run.

Returns ​

Container

Implementation of ​

RichFont.createRun


lineHeight() ​

ts
lineHeight(style): number;

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

Height of a line of text in style.

Parameters ​

ParameterType
styleRichStyle

Returns ​

number

Implementation of ​

RichFont.lineHeight


textWidth() ​

ts
textWidth(text, style): number;

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

Advance width of text in style (spaces included: they are measured on their own).

Parameters ​

ParameterType
textstring
styleRichStyle

Returns ​

number

Implementation of ​

RichFont.textWidth


updateRun() ​

ts
updateRun(
   run, 
   text, 
   style
): void;

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

Shows text in style on a run made by createRun; cheap when neither changed.

Parameters ​

ParameterType
runContainer
textstring
styleRichStyle

Returns ​

void

Implementation of ​

RichFont.updateRun

Released under the MIT License.