# Font

## Content

# Class: Font

Represents a TrueType or OpenType font.

## Extends

- [`ObjectBase`](ObjectBase)

## Accessors

### avgCharWidth

#### Get Signature

```ts
get avgCharWidth(): number;
```

The Average Character Width parameter specifies the arithmetic average of
the escapement (width) of all non-zero width glyphs in the font.

##### Returns

`number`

***

### bold

#### Get Signature

```ts
get bold(): boolean;
```

The value of the Bold flag from the OS/2 font table data.

##### Returns

`boolean`

***

### canEmbed

#### Get Signature

```ts
get canEmbed(): boolean;
```

Indicates whether this font can be embedded.

##### Returns

`boolean`

***

### canSubset

#### Get Signature

```ts
get canSubset(): boolean;
```

Indicates whether this font can be serialized as a subset of the source font data.

##### Returns

`boolean`

***

### capHeight

#### Get Signature

```ts
get capHeight(): number;
```

The metric specifying the distance between the baseline and the approximate
height of uppercase letters.

##### Returns

`number`

***

### copyrightNotice

#### Get Signature

```ts
get copyrightNotice(): string;
```

The Copyright notice of the font.

##### Returns

`string`

***

### enableHinting

#### Get Signature

```ts
get enableHinting(): boolean;
```

Gets or sets a value indicating if the TrueType glyph hinting instructions can be executed.

##### Returns

`boolean`

#### Set Signature

```ts
set enableHinting(value): void;
```

Gets or sets a value indicating if the TrueType glyph hinting instructions can be executed.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### fontFamily

#### Get Signature

```ts
get fontFamily(): string;
```

The font family name. Up to four faces can share the same font family name.

##### Returns

`string`

***

### fullFontName

#### Get Signature

```ts
get fullFontName(): string;
```

The full font name that reflects all family and relevant subfamily descriptors.

##### Returns

`string`

***

### hasLinkedFonts

#### Get Signature

```ts
get hasLinkedFonts(): boolean;
```

Indicates whether the current font has linked fonts.

##### Returns

`boolean`

***

### hollow

#### Get Signature

```ts
get hollow(): boolean;
```

Indicates if characters are hollow (outlined), otherwise they are solid.

##### Returns

`boolean`

***

### horizontalAscender

#### Get Signature

```ts
get horizontalAscender(): number;
```

The typographic or legacy ascender for this font.

##### Returns

`number`

***

### horizontalDescender

#### Get Signature

```ts
get horizontalDescender(): number;
```

The typographic or legacy descender for this font.

##### Returns

`number`

***

### horizontalLineGap

#### Get Signature

```ts
get horizontalLineGap(): number;
```

The typographic or legacy line gap for this font.

##### Returns

`number`

***

### id

#### Get Signature

```ts
get id(): number;
```

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ObjectBase`](ObjectBase).[`id`](ObjectBase#id)

***

### isCollection

#### Get Signature

```ts
get isCollection(): boolean;
```

Indicates if the font was loaded from .ttc or .otc font collection.

##### Returns

`boolean`

***

### isColorFont

#### Get Signature

```ts
get isColorFont(): boolean;
```

Indicates if this font contains color glyphs.

##### Returns

`boolean`

***

### isCompressed

#### Get Signature

```ts
get isCompressed(): boolean;
```

Indicates if the font is in WOFF format.

##### Returns

`boolean`

***

### isFixedPitch

#### Get Signature

```ts
get isFixedPitch(): boolean;
```

False if the font is proportionally spaced, True if the font is not proportionally
spaced (i.e. monospaced).

##### Returns

`boolean`

***

### isOrnamentalFont

#### Get Signature

```ts
get isOrnamentalFont(): boolean;
```

Indicates whether the font-family design reflects the ISO Ornamental Class and
the ISO Blackletter Class.

##### Returns

`boolean`

***

### isPostScript

#### Get Signature

```ts
get isPostScript(): boolean;
```

Indicates if the current font contains PostScript outlines.

##### Returns

`boolean`

***

### isSansSerif

#### Get Signature

```ts
get isSansSerif(): boolean;
```

Indicates whether the font-family design reflects the ISO Sans Serif Class.

##### Returns

`boolean`

***

### isScriptFont

#### Get Signature

```ts
get isScriptFont(): boolean;
```

Indicates whether the font-family design reflects the ISO Script Class and Uncial Class.

##### Returns

`boolean`

***

### isSerifFont

#### Get Signature

```ts
get isSerifFont(): boolean;
```

Indicates whether the font-family design reflects any of the Serif classes, except Sans Serif.

##### Returns

`boolean`

***

### isSymbolicFont

#### Get Signature

```ts
get isSymbolicFont(): boolean;
```

Indicates whether this is a symbolic font suitable for Pi and special characters (icons,
dingbats, technical symbols, etc.)

##### Returns

`boolean`

***

### isVerticalFont

#### Get Signature

```ts
get isVerticalFont(): boolean;
```

Indicates if this is a vertical font.

##### Returns

`boolean`

***

### italic

#### Get Signature

```ts
get italic(): boolean;
```

The value of the Italic flag from the OS/2 font table data.

##### Returns

`boolean`

***

### italicAngle

#### Get Signature

```ts
get italicAngle(): number;
```

The italic angle in counter-clockwise degrees from the vertical. Zero for upright
text, negative for text that leans to the right (forward).

##### Returns

`number`

***

### lastResort

#### Get Signature

```ts
get lastResort(): boolean;
```

Indicates if the glyphs encoded in the cmap subtables are simply generic symbolic representations
of code point ranges and don't truly represent support for those code points.

##### Returns

`boolean`

***

### licenseDescription

#### Get Signature

```ts
get licenseDescription(): string;
```

The description of the license or licenses under which the font is provided.

##### Returns

`string`

***

### licenseInfoURL

#### Get Signature

```ts
get licenseInfoURL(): string;
```

The URL where additional licensing information can be found.

##### Returns

`string`

***

### negative

#### Get Signature

```ts
get negative(): boolean;
```

Indicates if characters have their foreground and background reversed.

##### Returns

`boolean`

***

### numGlyphs

#### Get Signature

```ts
get numGlyphs(): number;
```

The number of glyphs in this font.

##### Returns

`number`

***

### oblique

#### Get Signature

```ts
get oblique(): boolean;
```

The value of the Oblique flag from the OS/2 font table data.

##### Returns

`boolean`

***

### om

#### Get Signature

```ts
get om(): ObjectManager;
```

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ObjectBase`](ObjectBase).[`om`](ObjectBase#om)

***

### permissionToEmbedGranted

#### Get Signature

```ts
get permissionToEmbedGranted(): boolean;
```

Gets or sets a value indicating that the developer of the software has obtained explicit
permission from the legal owner of the font to embed it in documents produced by the software.

##### Returns

`boolean`

#### Set Signature

```ts
set permissionToEmbedGranted(value): void;
```

Gets or sets a value indicating that the developer of the software has obtained explicit
permission from the legal owner of the font to embed it in documents produced by the software.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### postScriptName

#### Get Signature

```ts
get postScriptName(): string;
```

The PostScript name of the font.

##### Returns

`string`

***

### revision

#### Get Signature

```ts
get revision(): number;
```

The revision number set by font manufacturer.

##### Returns

`number`

***

### smallXHeight

#### Get Signature

```ts
get smallXHeight(): number;
```

The metric specifying the distance between the baseline and the approximate height
of non-ascending lowercase letters.

##### Returns

`number`

***

### strikeout

#### Get Signature

```ts
get strikeout(): boolean;
```

Indicates if characters are overstruck.

##### Returns

`boolean`

***

### typographicFamilyName

#### Get Signature

```ts
get typographicFamilyName(): string;
```

The typographic family grouping name.

##### Returns

`string`

***

### underscore

#### Get Signature

```ts
get underscore(): boolean;
```

Indicates if characters are underscored.

##### Returns

`boolean`

***

### unitsPerEm

#### Get Signature

```ts
get unitsPerEm(): number;
```

The design units per Em, valid range is from 16 to 16384.

##### Returns

`number`

***

### useBitmapCache

#### Get Signature

```ts
get useBitmapCache(): boolean;
```

Gets or sets a value indicating if the Bitmap Glyph Cache is enabled.

##### Returns

`boolean`

#### Set Signature

```ts
set useBitmapCache(value): void;
```

Gets or sets a value indicating if the Bitmap Glyph Cache is enabled.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### version

#### Get Signature

```ts
get version(): string;
```

The version set by font manufacturer.

##### Returns

`string`

***

### verticalAscender

#### Get Signature

```ts
get verticalAscender(): number;
```

The vertical typographic ascender for this font.

##### Returns

`number`

***

### verticalDescender

#### Get Signature

```ts
get verticalDescender(): number;
```

The vertical typographic descender for this font.

##### Returns

`number`

***

### verticalLineGap

#### Get Signature

```ts
get verticalLineGap(): number;
```

The vertical typographic gap for this font.

##### Returns

`number`

***

### weightClass

#### Get Signature

```ts
get weightClass(): number;
```

The visual weight (degree of blackness or thickness of strokes) of the characters
in the font. Values from 1 to 1000 are valid.

##### Returns

`number`

***

### widthClass

#### Get Signature

```ts
get widthClass(): number;
```

Indicates a relative change from the normal aspect ratio (width to height ratio) for
the glyphs in a font. Values from 1 (Ultra Condensed) to 9 (Ultra Expanded) are expected.

##### Returns

`number`

## Methods

### getPdfFont()

#### Call Signature

```ts
static getPdfFont(standardPdfFont): Font;
```

Returns an instance of the standard PDF font.

##### Parameters

###### standardPdfFont

[`StandardPdfFont`](../enumerations/StandardPdfFont)

Specifies one of the standard PDF fonts.

##### Returns

`Font`

A new instance of the Font.

#### Call Signature

```ts
static getPdfFont(om, standardPdfFont): Font;
```

Returns an instance of the standard PDF font.

##### Parameters

###### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the Font object.

###### standardPdfFont

[`StandardPdfFont`](../enumerations/StandardPdfFont)

Specifies one of the standard PDF fonts.

##### Returns

`Font`

A new instance of the Font.

***

### load()

#### Call Signature

```ts
static load(fontBytes): Font;
```

Creates a Font instance from a byte array.

##### Parameters

###### fontBytes

`Uint8Array`

The binary data of the font.

##### Returns

`Font`

A new instance of the Font.

#### Call Signature

```ts
static load(om, fontBytes): Font;
```

Creates a Font instance from a byte array.

##### Parameters

###### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the Font object.

###### fontBytes

`Uint8Array`

The binary data of the font.

##### Returns

`Font`

A new instance of the Font.

***

### loadCollection()

#### Call Signature

```ts
static loadCollection(fontBytes): Font[];
```

Loads all Fonts from a byte array containing single font or a font collection.

##### Parameters

###### fontBytes

`Uint8Array`

The byte array with the font data.

##### Returns

`Font`[]

The array of loaded Fonts.

#### Call Signature

```ts
static loadCollection(om, fontBytes): Font[];
```

Loads all Fonts from a byte array containing single font or a font collection.

##### Parameters

###### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the Font objects.

###### fontBytes

`Uint8Array`

The byte array with the font data.

##### Returns

`Font`[]

The array of loaded Fonts.

***

### addLinkedFont()

```ts
addLinkedFont(font, scaleFactor?): void;
```

Adds a linked font to the current font.

#### Parameters

##### font

`Font`

The Font to be added as linked font.

##### scaleFactor?

`number`

The scale factor applied to size of the base font when the linked font is used instead.

#### Returns

`void`

***

### clearLinkedFonts()

```ts
clearLinkedFonts(): void;
```

Clears the list of linked fonts.

#### Returns

`void`

***

### containsCodePoint()

```ts
containsCodePoint(codePoint): boolean;
```

Returns a value indicating whether the font can map the specified UTF-32 character to a glyph.

#### Parameters

##### codePoint

`number`

The UTF-32 characer (code point) to check.

#### Returns

`boolean`

true if the font can map the character to a glyph, false otherwise.

***

### free()

```ts
free(): void;
```

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`free`](ObjectBase#free)

***

### rebind()

```ts
rebind(omTo): void;
```

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`rebind`](ObjectBase#rebind)

***

### removeLinkedFont()

```ts
removeLinkedFont(font): void;
```

Removes a linked font from the current font.

#### Parameters

##### font

`Font`

The Font to be removed from the list of linked fonts.

#### Returns

`void`
