Skip to content

@pdfa-lab/fontkit / TTFFont

Class: TTFFont ​

Defined in: src/true-type-font.ts:944

The class TTFFont is a compatibility alias for TrueTypeFont

Deprecated ​

Use TrueTypeFont instead!

Extends ​

Indexable ​

[key: string]: unknown

Constructors ​

Constructor ​

new TTFFont(streamOrBuffer, variationCoords?): TTFFont

Defined in: src/true-type-font.ts:214

Instantiates a font object from binary font data. You can either pass in a Uint8Array or DecodeStream from the restructure library (@see https://github.com/foliojs/restructure).

Parameters ​

ParameterTypeDefault valueDescription
streamOrBufferUint8Array<ArrayBufferLike> | DecodeStreamundefinedbinary font data
variationCoordsnumber[] | nullnullNormalised design coordinates (typically ranging from -1.0 to 1.0) used to select a specific instance within a variable font's design space.

Returns ​

TTFFont

Inherited from ​

TrueTypeFont.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
avarpublicavar | nullundefinedAxis Variations Table. Modifies normalised coordinates across axes in variable fonts.TrueTypeFont.avarsrc/font.ts:324
BASEpublicBASE | nullundefinedBaseline Data Table. Sets alignment values dynamically shifting script baselines.TrueTypeFont.BASEsrc/font.ts:235
bslnpublicbsln | nullundefinedBaseline Table. Provides baseline shift measurements for multi-script alignment.TrueTypeFont.bslnsrc/font.ts:330
CBLCpublicEBLC | nullundefinedColour Bitmap Data Table. Variant containing colour bitmap raw data blocks.TrueTypeFont.CBLCsrc/font.ts:211
CFF publicCFF1Font | nullundefinedAlternate PostScript Compact Font Format alias mapping.TrueTypeFont.CFF src/font.ts:188
CFF2publicCFF2Font | nullundefinedPostScript Compact Font Format (CFF) Outline Table version 2.TrueTypeFont.CFF2src/font.ts:193
cmappubliccmap | nullundefinedCharacter to Glyph Index Mapping Table. Maps characters to internal glyph indices.TrueTypeFont.cmapsrc/font.ts:106
COLRpublicCOLR | nullundefinedColour Table. Outlines layering configurations for multi-coloured vector icon layouts.TrueTypeFont.COLRsrc/font.ts:223
CPALpublicCPAL | nullundefinedColour Palette Table. Maps index arrays declaring hex colours utilised by COLR elements.TrueTypeFont.CPALsrc/font.ts:229
cvt publiccvt | nullundefinedControl Value Table. Stores indexed control values used by TrueType instructions to maintain consistency when hinting glyphs.TrueTypeFont.cvt src/font.ts:172
defaultLanguagepublicstring | nullundefinedThe default language as an ISO 639-1 code ('en', 'fr', ...).TrueTypeFont.defaultLanguagesrc/true-type-font.ts:152
DSIGpublicDSIG | nullundefinedDigital Signature Table. Encapsulates cryptographic signatures validating binary authenticity.TrueTypeFont.DSIGsrc/font.ts:271
EBLCpublicEBLC | nullundefinedEmbedded Bitmap Data Table. Stores bitmap images for specific point sizes.TrueTypeFont.EBLCsrc/font.ts:205
featpublicfeat | nullundefinedFeature Name Table. Maps AAT feature selectors to localised string references.TrueTypeFont.featsrc/font.ts:336
fpgmpublicfpgm | nullundefinedFont Program Table. Contains low-level hints executing instruction sets across grid points.TrueTypeFont.fpgmsrc/font.ts:154
fvarpublicfvar | nullundefinedFont Variations Table. Declares design axes and instance configurations in variable fonts.TrueTypeFont.fvarsrc/font.ts:342
gasppublicgasp | nullundefinedGrid-fitting and Scan-conversion Procedure Table. Optimises text raster rendering constraints.TrueTypeFont.gaspsrc/font.ts:277
GDEFpublicGDEF | nullundefinedGlyph Definition Table. Categorises glyph types (e.g., base, ligature, mark) for layout alignment.TrueTypeFont.GDEFsrc/font.ts:241
glyfpublicglyph | nullundefinedGlyph Data Table. Describes TrueType glyph outlines, including contour coordinates, composite glyph components, and hinting instructions.TrueTypeFont.glyfsrc/font.ts:178
glyphsprotectedRecord<number, Glyph>{}-TrueTypeFont.glyphssrc/true-type-font.ts:145
GPOSpublicGPOS | nullundefinedGlyph Positioning Table. Provides precise metric adjustments handling kerning and attachment marks.TrueTypeFont.GPOSsrc/font.ts:247
GSUBpublicGSUB | nullundefinedGlyph Substitution Table. Supplies glyph substitutions for contextual alternates, ligatures, and script-specific rendering.TrueTypeFont.GSUBsrc/font.ts:253
gvarpublicgvar | nullundefinedGlyph Variations Table. Controls structural outline distortion transformations for variable glyphs.TrueTypeFont.gvarsrc/font.ts:348
hdmxpublichdmx | nullundefinedHorizontal Device Metrics Table. Preserves explicit pixel width mappings optimising spacing.TrueTypeFont.hdmxsrc/font.ts:283
headpublichead | nullundefinedFont Header Table. Tracks global typographic metrics, scale grid bounds, and metadata.TrueTypeFont.headsrc/font.ts:112
hheapublichhea | nullundefinedHorizontal Header Table. Stores global metric parameters for horizontal glyph layouts.TrueTypeFont.hheasrc/font.ts:118
hmtxpublichmtx | nullundefinedHorizontal Metrics Table. Contains advance widths and left side bearings for all glyphs.TrueTypeFont.hmtxsrc/font.ts:124
HVARpublicHVAR | nullundefinedHorizontal Variation Metrics Table. Adjusts advance metrics across design spaces in variable fonts.TrueTypeFont.HVARsrc/font.ts:265
JSTFpublicJSTF | nullundefinedJustification Table. Provides options for justification adjustments in complex scripts.TrueTypeFont.JSTFsrc/font.ts:259
justpublicjust | nullundefinedJustification Table (just). Provides layout rules for line justification, glyph width deltas, and post-compensation actions in AAT typography.TrueTypeFont.justsrc/font.ts:354
kernpublickern | nullundefinedKerning Table. Contains traditional pairwise spacing adjustments.TrueTypeFont.kernsrc/font.ts:288
locapublicloca | nullundefinedIndex to Location Table. Maps local offsets for binary data streams resolving glyph outlines.TrueTypeFont.locasrc/font.ts:160
LTSHpublicLTSH | nullundefinedLinear Threshold Table. Sets pixel-per-em limits where scaling instructions degrade.TrueTypeFont.LTSHsrc/font.ts:294
maxppublicmaxp | nullundefinedMaximum Profile Table. Explicitly defines memory boundaries and total glyph count constraints.TrueTypeFont.maxpsrc/font.ts:130
morxpublicmorx | nullundefinedExtended Glyph Metamorphosis Table. Powers state-machine transformations substituting AAT items.TrueTypeFont.morxsrc/font.ts:360
namepublicname | nullundefinedNaming Table. Contains multilingual string records for copyrights, families, and system IDs.TrueTypeFont.namesrc/font.ts:136
objTypereadonlystringTrueTypeFont.objTypeDiscriminating property. Has the same value as the static TrueTypeFont.objType property.TrueTypeFont.objTypesrc/true-type-font.ts:133
opbdpublicopbd | nullundefinedOptical Bounds Table. Sets bounding limits to align glyphs based on visual centre points.TrueTypeFont.opbdsrc/font.ts:366
OS/2publicOS2 | nullundefinedOS/2 and Windows Metrics Table. Contains subsystem configurations, weights, and unicode ranges.TrueTypeFont.OS/2src/font.ts:142
outlinespublic"" | "none" | "PostScript" | "TrueType"''Determines the type of glyph outlines based on the presence of the required tables. Fonts without the core OpenType tables are identified by an empty string (@see OpenTypeNoOutlinesFont). If all core OpenType tables are present, the outline type is either 'TrueType' if the loca table is present, or PostScript if either CFF or CFF2 are present, 'none' otherwise. See - OpenTypeTrueTypeFont - OpenTypePostScriptFontTrueTypeFont.outlinessrc/true-type-font.ts:178
outlineVersionpublicnumber0Discriminator for the different flavours of OpenTypePostScriptFont. If the CFF2 table is present, outline version is 2, if the CFF table is present, it is 1. For fonts that do not have PostScript, outlines, the value is 0.TrueTypeFont.outlineVersionsrc/true-type-font.ts:188
PCLTpublicPCLT | nullundefinedPCL 5 Table. Contains metrics and command parameters for HP LaserJet compatibility.TrueTypeFont.PCLTsrc/font.ts:300
postpublicpost | nullundefinedPostScript Table. Encapsulates printer operational bounds and memory-tracking metrics.TrueTypeFont.postsrc/font.ts:148
preppublicprep | nullundefinedControl Value Program Table. Provides global instructions establishing variable outline alignment.TrueTypeFont.prepsrc/font.ts:166
sbixpublicsbix | nullundefinedStandard Bitmap Graphics Table. Embeds raster configurations (PNG/JPEG) directly within glyph IDs.TrueTypeFont.sbixsrc/font.ts:217
typereadonlystringTrueTypeFont.objTypeDeprecated Use TrueTypeFont#objType instead!TrueTypeFont.typesrc/true-type-font.ts:138
VDMXpublicVDMX | nullundefinedVertical Device Metrics Table. Preserves explicit vertical pixel height mappings.TrueTypeFont.VDMXsrc/font.ts:306
vheapublicvhea | nullundefinedVertical Header Table. Stores global metric parameters for vertical text directions.TrueTypeFont.vheasrc/font.ts:312
vmtxpublicvmtx | nullundefinedVertical Metrics Table. Contains advance heights and top side bearings for vertical layouts.TrueTypeFont.vmtxsrc/font.ts:318
VORGpublicVORG | nullundefinedVertical Origin Table. Specifies vertical coordinate origins for dynamic metrics scaling.TrueTypeFont.VORGsrc/font.ts:199
objTypereadonlystring'TTF'Identifier for TrueType fonts. Always 'TTF'.TrueTypeFont.objTypesrc/true-type-font.ts:127

Accessors ​

ascent ​

Get Signature ​

get ascent(): number | undefined

Defined in: src/true-type-font.ts:407

The font’s ascender.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.ascent


availableFeatures ​

Get Signature ​

get availableFeatures(): keyof Features[]

Defined in: src/true-type-font.ts:645

An array of all OpenType feature tags supported by the font.

Returns ​

keyof Features[]

Inherited from ​

TrueTypeFont.availableFeatures


bbox ​

Get Signature ​

get bbox(): Readonly<BoundingBox> | undefined

Defined in: src/true-type-font.ts:514

Deprecated ​

Use boundingBox instead!

Returns ​

Readonly<BoundingBox> | undefined

Inherited from ​

TrueTypeFont.bbox


boundingBox ​

Get Signature ​

get boundingBox(): Readonly<BoundingBox> | undefined

Defined in: src/true-type-font.ts:497

The font’s bounding box, i.e. the box that encloses all glyphs in the font.

Returns ​

Readonly<BoundingBox> | undefined

Inherited from ​

TrueTypeFont.boundingBox


capHeight ​

Get Signature ​

get capHeight(): number | undefined

Defined in: src/true-type-font.ts:455

The height of capital letters above the baseline. See here for more details.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.capHeight


cff ​

Get Signature ​

get cff(): CFF1Font | null

Defined in: src/true-type-font.ts:271

PostScript Compact Font Format (CFF) Outline Table version 1.

Returns ​

CFF1Font | null

PostScript Compact Font Format (CFF) Outline Table version 1.

Inherited from ​

TrueTypeFont.cff


characterSet ​

Get Signature ​

get characterSet(): number[]

Defined in: src/true-type-font.ts:530

An array of all of the unicode code points supported by the font.

Returns ​

number[]

An array of all of the unicode code points supported by the font.

Inherited from ​

TrueTypeFont.characterSet


Get Signature ​

get copyright(): string | null

Defined in: src/true-type-font.ts:399

The font's copyright information, or null if not present.

Returns ​

string | null

The font's copyright information, or null if not present.

Inherited from ​

TrueTypeFont.copyright


descent ​

Get Signature ​

get descent(): number | undefined

Defined in: src/true-type-font.ts:415

The font’s descender.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.descent


familyName ​

Get Signature ​

get familyName(): string | null

Defined in: src/true-type-font.ts:391

The font's family name, e.g. "Helvetica", or null if not present.

Returns ​

string | null

The font's family name, e.g. "Helvetica", or null if not present.

Inherited from ​

TrueTypeFont.familyName


fullName ​

Get Signature ​

get fullName(): string | null

Defined in: src/true-type-font.ts:387

The font's full name, e.g. "Helvetica Bold", or null if not present.

Returns ​

string | null

The font's full name, e.g. "Helvetica Bold", or null if not present.

Inherited from ​

TrueTypeFont.fullName


italicAngle ​

Get Signature ​

get italicAngle(): number | undefined

Defined in: src/true-type-font.ts:447

If this is an italic font, the angle the cursor should be drawn at to match the font design.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.italicAngle


layoutEngine ​

Get Signature ​

get layoutEngine(): LayoutEngine

Defined in: src/true-type-font.ts:613

The shaping engine matching text scripts to font tables.

Returns ​

LayoutEngine

The shaping engine matching text scripts to font tables.

Inherited from ​

TrueTypeFont.layoutEngine


lineGap ​

Get Signature ​

get lineGap(): number | undefined

Defined in: src/true-type-font.ts:423

The line gap, i.e. amount of space that should be included between lines.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.lineGap


namedVariations ​

Get Signature ​

get namedVariations(): NamedVariations

Defined in: src/true-type-font.ts:774

Returns ​

NamedVariations

Inherited from ​

TrueTypeFont.namedVariations


numGlyphs ​

Get Signature ​

get numGlyphs(): number | undefined

Defined in: src/true-type-font.ts:481

The total count of glyph indexes present in the font mapping.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.numGlyphs


postscriptName ​

Get Signature ​

get postscriptName(): string | Uint8Array<ArrayBufferLike> | null

Defined in: src/true-type-font.ts:352

The unique PostScript name for this font or null if not present.

Some broken fonts have PostScript names that cannot be decoded into a string. They are exposed as Uint8Array.

Returns ​

string | Uint8Array<ArrayBufferLike> | null

The unique PostScript name for this font or null if not present.

Some broken fonts have PostScript names that cannot be decoded into a string. They are exposed as Uint8Array.

Inherited from ​

TrueTypeFont.postscriptName


subfamilyName ​

Get Signature ​

get subfamilyName(): string | null

Defined in: src/true-type-font.ts:395

The font's sub-family, e.g. "Bold", or null if not present.

Returns ​

string | null

The font's sub-family, e.g. "Bold", or null if not present.

Inherited from ​

TrueTypeFont.subfamilyName


underlinePosition ​

Get Signature ​

get underlinePosition(): number | undefined

Defined in: src/true-type-font.ts:431

The offset from the normal underline position that should be used.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.underlinePosition


underlineThickness ​

Get Signature ​

get underlineThickness(): number | undefined

Defined in: src/true-type-font.ts:439

The weight of the underline that should be used.

Returns ​

number | undefined

Inherited from ​

TrueTypeFont.underlineThickness


unitsPerEm ​

Get Signature ​

get unitsPerEm(): number

Defined in: src/true-type-font.ts:489

The size of the font's internal coordinate grid in units per em. Defaults to 1000, if all other attempts to calculate the value fail.

Returns ​

number

Inherited from ​

TrueTypeFont.unitsPerEm


variationAxes ​

Get Signature ​

get variationAxes(): VariationAxes

Defined in: src/true-type-font.ts:747

Returns ​

VariationAxes

Inherited from ​

TrueTypeFont.variationAxes


variationProcessor ​

Get Signature ​

get variationProcessor(): GlyphVariationProcessor | null

Defined in: src/true-type-font.ts:852

The processor responsible for calculating delta adjustments to glyph outlines along design variation axes. This is initialised when variation coordinates are applied, and is null for static fonts.

Returns ​

GlyphVariationProcessor | null

The processor responsible for calculating delta adjustments to glyph outlines along design variation axes. This is initialised when variation coordinates are applied, and is null for static fonts.

Inherited from ​

TrueTypeFont.variationProcessor


version ​

Get Signature ​

get version(): string | null

Defined in: src/true-type-font.ts:403

The font's version number or null if not present.

Returns ​

string | null

The font's version number or null if not present.

Inherited from ​

TrueTypeFont.version


xHeight ​

Get Signature ​

get xHeight(): number

Defined in: src/true-type-font.ts:468

The height of lowercase letters in the font. See here for more details.

Returns ​

number

Inherited from ​

TrueTypeFont.xHeight

Methods ​

asAATFont() ​

asAATFont(): AATFont | null

Defined in: src/true-type-font.ts:914

Attempts to view this font as an AATFont.

Returns ​

AATFont | null

the font with narrowed to an @{link AATFont} or `null if a required table is missing

Inherited from ​

TrueTypeFont.asAATFont


asOpenTypeFont() ​

asOpenTypeFont(): OpenTypeFont | null

Defined in: src/true-type-font.ts:890

Attempts to view this font instance as a strict OpenType font layout. Returns null, if a structurally required table is missing.

See OpenTypeFont for usage instructions!

Returns ​

OpenTypeFont | null

the font with narrowed to an @{link OpenTypeFont} or `null if a required table is missing

Inherited from ​

TrueTypeFont.asOpenTypeFont


asTrueTypeSubsetFont() ​

asTrueTypeSubsetFont(): TrueTypeSubsetFont | null

Defined in: src/true-type-font.ts:926

Attempts to view this font as an TrueTypeSubsetFont font.

Returns ​

TrueTypeSubsetFont | null

the font with narrowed to a @{link TrueTypeSubsetFont} or `null if a required table is missing

Inherited from ​

TrueTypeFont.asTrueTypeSubsetFont


codePointsForGlyph() ​

codePointsForGlyph(gid): number[]

Defined in: src/true-type-font.ts:641

Returns an array of alternative unicode mapping arrays tied to a specific glyph ID.

Parameters ​

ParameterType
gidnumber

Returns ​

number[]

Inherited from ​

TrueTypeFont.codePointsForGlyph


createSubset() ​

createSubset(): Subset

Defined in: src/true-type-font.ts:716

Creates an empty layout subset utilising this font structure as its baseline data map.

Returns ​

Subset

Inherited from ​

TrueTypeFont.createSubset


decodeDirectory() ​

protected decodeDirectory(): SFNTDirectory

Defined in: src/true-type-font.ts:324

Returns ​

SFNTDirectory

Inherited from ​

TrueTypeFont.decodeDirectory


decodeTable() ​

protected decodeTable<K>(table): ReturnType<object[K]["decode"]> | null

Defined in: src/true-type-font.ts:330

Type Parameters ​

Type Parameter
K extends "name" | "head" | "kern" | "opbd" | "loca" | "hmtx" | "cmap" | "hhea" | "maxp" | "OS/2" | "post" | "fpgm" | "prep" | "cvt " | "glyf" | "CFF " | "CFF2" | "VORG" | "EBLC" | "CBLC" | "sbix" | "COLR" | "CPAL" | "BASE" | "GDEF" | "GPOS" | "GSUB" | "JSTF" | "HVAR" | "DSIG" | "gasp" | "hdmx" | "LTSH" | "PCLT" | "VDMX" | "vhea" | "vmtx" | "avar" | "bsln" | "feat" | "fvar" | "gvar" | "just" | "morx"

Parameters ​

ParameterType
tableSFNTDirectoryEntry

Returns ​

ReturnType<object[K]["decode"]> | null

Inherited from ​

TrueTypeFont.decodeTable


getAvailableFeatures() ​

getAvailableFeatures(script, language?): keyof Features[]

Defined in: src/true-type-font.ts:649

An array of all OpenType feature tags supported by the font for a given script and language.

Parameters ​

ParameterType
script"Caucasian_Albanian" | "Arabic" | "Imperial_Aramaic" | "Armenian" | "Avestan" | "Balinese" | "Bamum" | "Bassa_Vah" | "Batak" | "Bengali" | "Bopomofo" | "Brahmi" | "Braille" | "Buginese" | "Buhid" | "Chakma" | "Canadian_Aboriginal" | "Carian" | "Cham" | "Cherokee" | "Coptic" | "Cypriot" | "Cyrillic" | "Devanagari" | "Deseret" | "Duployan" | "Egyptian_Hieroglyphs" | "Elbasan" | "Ethiopic" | "Georgian" | "Glagolitic" | "Gothic" | "Grantha" | "Greek" | "Gujarati" | "Gurmukhi" | "Hangul" | "Han" | "Hanunoo" | "Hebrew" | "Hiragana" | "Pahawh_Hmong" | "Katakana_Or_Hiragana" | "Old_Italic" | "Javanese" | "Kayah_Li" | "Katakana" | "Kharoshthi" | "Khmer" | "Khojki" | "Kannada" | "Kaithi" | "Tai_Tham" | "Lao" | "Latin" | "Lepcha" | "Limbu" | "Linear_A" | "Linear_B" | "Lisu" | "Lycian" | "Lydian" | "Mahajani" | "Mandaic" | "Manichaean" | "Mende_Kikakui" | "Meroitic_Cursive" | "Meroitic_Hieroglyphs" | "Malayalam" | "Modi" | "Mongolian" | "Mro" | "Meetei_Mayek" | "Myanmar" | "Old_North_Arabian" | "Nabataean" | "Nko" | "Ogham" | "Ol_Chiki" | "Old_Turkic" | "Oriya" | "Osmanya" | "Palmyrene" | "Pau_Cin_Hau" | "Old_Permic" | "Phags_Pa" | "Inscriptional_Pahlavi" | "Psalter_Pahlavi" | "Phoenician" | "Miao" | "Inscriptional_Parthian" | "Rejang" | "Runic" | "Samaritan" | "Old_South_Arabian" | "Saurashtra" | "Shavian" | "Sharada" | "Siddham" | "Khudawadi" | "Sinhala" | "Sora_Sompeng" | "Sundanese" | "Syloti_Nagri" | "Syriac" | "Tagbanwa" | "Takri" | "Tai_Le" | "New_Tai_Lue" | "Tamil" | "Tai_Viet" | "Telugu" | "Tifinagh" | "Tagalog" | "Thaana" | "Thai" | "Tibetan" | "Tirhuta" | "Ugaritic" | "Vai" | "Warang_Citi" | "Old_Persian" | "Cuneiform" | "Yi" | "Inherited" | "Common" | "Unknown"
language?string

Returns ​

keyof Features[]

Inherited from ​

TrueTypeFont.getAvailableFeatures


getFont() ​

getFont(name): TrueTypeFont

Defined in: src/true-type-font.ts:860

Parameters ​

ParameterType
namestring

Returns ​

TrueTypeFont

Inherited from ​

TrueTypeFont.getFont


getGlyfTableStream() ​

getGlyfTableStream(): DecodeStream | null

Defined in: src/true-type-font.ts:320

Extracts a raw readable segment slice targeting vector outline definitions.

Returns ​

DecodeStream | null

Inherited from ​

TrueTypeFont.getGlyfTableStream


getGlyph() ​

getGlyph(glyph, characters?): Glyph | null

Defined in: src/true-type-font.ts:680

Returns a glyph object for the given glyph id. You can pass the array of code points this glyph represents for your use later, and it will be stored in the glyph object.

Parameters ​

ParameterTypeDefault valueDescription
glyphnumberundefinedthe glyph id
charactersreadonly number[][]an array of code points this glyph represents

Returns ​

Glyph | null

the corresponding glyph

Inherited from ​

TrueTypeFont.getGlyph


getName() ​

protected getName(key, lang?): string | null

Defined in: src/true-type-font.ts:360

Parameters ​

ParameterType
keykeyof ProcessedRecords
langstring

Returns ​

string | null

Inherited from ​

TrueTypeFont.getName


getTable() ​

protected getTable<K>(table): SFNTTableMap[K] | null

Defined in: src/true-type-font.ts:275

Type Parameters ​

Type Parameter
K extends "name" | "head" | "kern" | "opbd" | "loca" | "hmtx" | "cmap" | "hhea" | "maxp" | "OS/2" | "post" | "fpgm" | "prep" | "cvt " | "glyf" | "CFF " | "CFF2" | "VORG" | "EBLC" | "CBLC" | "sbix" | "COLR" | "CPAL" | "BASE" | "GDEF" | "GPOS" | "GSUB" | "JSTF" | "HVAR" | "DSIG" | "gasp" | "hdmx" | "LTSH" | "PCLT" | "VDMX" | "vhea" | "vmtx" | "avar" | "bsln" | "feat" | "fvar" | "gvar" | "just" | "morx"

Parameters ​

ParameterType
tableSFNTDirectoryEntry

Returns ​

SFNTTableMap[K] | null

Inherited from ​

TrueTypeFont.getTable


getTableStream() ​

protected getTableStream(tag): DecodeStream | null

Defined in: src/true-type-font.ts:310

Parameters ​

ParameterType
tagstring

Returns ​

DecodeStream | null

Inherited from ​

TrueTypeFont.getTableStream


getVariation() ​

getVariation(settings): TrueTypeFont

Defined in: src/true-type-font.ts:782

Parameters ​

ParameterType
settingsstring | VariationCoordinates

Returns ​

TrueTypeFont

Inherited from ​

TrueTypeFont.getVariation


glyphForCodePoint() ​

glyphForCodePoint(codePoint): Glyph | null

Defined in: src/true-type-font.ts:543

Maps a single unicode code point to a Glyph object. Does not perform any advanced substitutions.

Parameters ​

ParameterTypeDescription
codePointnumberthe unicode code point

Returns ​

Glyph | null

the corresponding glyph

Inherited from ​

TrueTypeFont.glyphForCodePoint


glyphsForString() ​

glyphsForString(str): Glyph[]

Defined in: src/true-type-font.ts:551

Returns an array of Glyph objects for the given string. This is only a static one-to-one mapping from characters to glyphs.

Parameters ​

ParameterTypeDescription
strstringthe string to encode

Returns ​

Glyph[]

the corresponding glyphs

Inherited from ​

TrueTypeFont.glyphsForString


hasGlyphForCodePoint() ​

hasGlyphForCodePoint(codePoint): boolean

Defined in: src/true-type-font.ts:539

Returns whether there is a glyph in the font for the given unicode code point.

Parameters ​

ParameterTypeDescription
codePointnumberthe unicode code point

Returns ​

boolean

true if a glyph is available for the code point, false otherwise

Inherited from ​

TrueTypeFont.hasGlyphForCodePoint


hasTable() ​

hasTable<K>(tag, decode?): boolean

Defined in: src/true-type-font.ts:864

Tests whether a certain table is present in the font file.

Type Parameters ​

Type ParameterDefault type
K extends stringstring

Parameters ​

ParameterTypeDescription
tag"name" | "head" | "kern" | "opbd" | "loca" | "hmtx" | "cmap" | "hhea" | "maxp" | "OS/2" | "post" | "fpgm" | "prep" | "cvt " | "glyf" | "CFF " | "CFF2" | "VORG" | "EBLC" | "CBLC" | "sbix" | "COLR" | "CPAL" | "BASE" | "GDEF" | "GPOS" | "GSUB" | "JSTF" | "HVAR" | "DSIG" | "gasp" | "hdmx" | "LTSH" | "PCLT" | "VDMX" | "vhea" | "vmtx" | "avar" | "bsln" | "feat" | "fvar" | "gvar" | "just" | "morx" | Kthe table name like cmap, OS/2, or hmtx
decode?boolean-

Returns ​

boolean

Inherited from ​

TrueTypeFont.hasTable


layout() ​

layout(str, userFeatures?, script?, language?, direction?): GlyphRun

Defined in: src/true-type-font.ts:621

Returns a GlyphRun object, which includes an array of Glyphs and GlyphPositions for the given string.

Parameters ​

ParameterTypeDescription
strstringthe string to encode
userFeatures?Features | keyof Features[]an array of OpenType feature tags to be applied in addition to the default set.
script?OpenTypeTagthe script of the string
language?stringthe language of the string
direction?BidiDirectionthe writing direction for the string

Returns ​

GlyphRun

the rendered string as a GlyphRun

Inherited from ​

TrueTypeFont.layout


safeGetGlyph() ​

safeGetGlyph(glyph, characters?): Glyph

Defined in: src/true-type-font.ts:699

Like getGlyph but falls back to the fallback glyph .notdef if the glyph cannot be resolved, because of missing tables.

Parameters ​

ParameterTypeDefault valueDescription
glyphnumberundefinedthe glyph id
charactersreadonly number[][]an optional sequence of codepoints

Returns ​

Glyph

Inherited from ​

TrueTypeFont.safeGetGlyph


setDefaultLanguage() ​

setDefaultLanguage(lang?): void

Defined in: src/true-type-font.ts:356

Set the default language.

Parameters ​

ParameterTypeDefault value
langstring | nullnull

Returns ​

void

See ​

defaultLanguage

Inherited from ​

TrueTypeFont.setDefaultLanguage


stringsForGlyph() ​

stringsForGlyph(gid): string[]

Defined in: src/true-type-font.ts:637

Returns an array of strings that map to the given glyph id.

Parameters ​

ParameterTypeDescription
gidnumberthe glyph id

Returns ​

string[]

Inherited from ​

TrueTypeFont.stringsForGlyph