Skip to content

Documentation / device / Font

Class: Font ​

Defined in: libs/device/src/helpers/font.ts:47

The font class

Constructors ​

Constructor ​

new Font(name, scale): Font

Defined in: libs/device/src/helpers/font.ts:79

Creates a instance of font class from font name and the scale value

Parameters ​

name ​

string

The font name

scale ​

number

The scale value

Returns ​

Font

Accessors ​

fontName ​

Get Signature ​

get fontName(): string

Defined in: libs/device/src/helpers/font.ts:114

Gets the font name

Returns ​

string

Set Signature ​

set fontName(name): void

Defined in: libs/device/src/helpers/font.ts:117

Parameters ​
name ​

string

Returns ​

void


fontNameScaled ​

Get Signature ​

get fontNameScaled(): string

Defined in: libs/device/src/helpers/font.ts:122

Gets the scaled font name

Returns ​

string


size ​

Get Signature ​

get size(): number

Defined in: libs/device/src/helpers/font.ts:126

Gets the font size

Returns ​

number


family ​

Get Signature ​

get family(): string

Defined in: libs/device/src/helpers/font.ts:130

Gets the font family

Returns ​

string


top ​

Get Signature ​

get top(): number

Defined in: libs/device/src/helpers/font.ts:134

Gets top position of the font

Returns ​

number


bottom ​

Get Signature ​

get bottom(): number

Defined in: libs/device/src/helpers/font.ts:138

Gets the bottom position of the font

Returns ​

number


topScaled ​

Get Signature ​

get topScaled(): number

Defined in: libs/device/src/helpers/font.ts:142

Gets the scaled top position of the font

Returns ​

number


bottomScaled ​

Get Signature ​

get bottomScaled(): number

Defined in: libs/device/src/helpers/font.ts:146

Gets the scaled bottom position of the font

Returns ​

number


maxHeight ​

Get Signature ​

get maxHeight(): number

Defined in: libs/device/src/helpers/font.ts:150

Gets the maximum height of the font

Returns ​

number


maxHeightScaled ​

Get Signature ​

get maxHeightScaled(): number

Defined in: libs/device/src/helpers/font.ts:154

Gets the scaled maximum height of the font

Returns ​

number

Methods ​

fetchFont() ​

static fetchFont(name, scale): Font

Defined in: libs/device/src/helpers/font.ts:100

Fetch a font from cache

Parameters ​

name ​

string

The font name

scale ​

number

The scale value

Returns ​

Font

The font object


equalTo() ​

equalTo(other): boolean

Defined in: libs/device/src/helpers/font.ts:158

Tests if two fonts are the same

Parameters ​

other ​

Font

Returns ​

boolean

Released under the MIT License.