@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 ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
streamOrBuffer | Uint8Array<ArrayBufferLike> | DecodeStream | undefined | binary font data |
variationCoords | number[] | null | null | Normalised 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 ​
Properties ​
| Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
|---|---|---|---|---|---|---|
avar | public | avar | null | undefined | Axis Variations Table. Modifies normalised coordinates across axes in variable fonts. | TrueTypeFont.avar | src/font.ts:324 |
BASE | public | BASE | null | undefined | Baseline Data Table. Sets alignment values dynamically shifting script baselines. | TrueTypeFont.BASE | src/font.ts:235 |
bsln | public | bsln | null | undefined | Baseline Table. Provides baseline shift measurements for multi-script alignment. | TrueTypeFont.bsln | src/font.ts:330 |
CBLC | public | EBLC | null | undefined | Colour Bitmap Data Table. Variant containing colour bitmap raw data blocks. | TrueTypeFont.CBLC | src/font.ts:211 |
CFF | public | CFF1Font | null | undefined | Alternate PostScript Compact Font Format alias mapping. | TrueTypeFont.CFF | src/font.ts:188 |
CFF2 | public | CFF2Font | null | undefined | PostScript Compact Font Format (CFF) Outline Table version 2. | TrueTypeFont.CFF2 | src/font.ts:193 |
cmap | public | cmap | null | undefined | Character to Glyph Index Mapping Table. Maps characters to internal glyph indices. | TrueTypeFont.cmap | src/font.ts:106 |
COLR | public | COLR | null | undefined | Colour Table. Outlines layering configurations for multi-coloured vector icon layouts. | TrueTypeFont.COLR | src/font.ts:223 |
CPAL | public | CPAL | null | undefined | Colour Palette Table. Maps index arrays declaring hex colours utilised by COLR elements. | TrueTypeFont.CPAL | src/font.ts:229 |
cvt | public | cvt | null | undefined | Control Value Table. Stores indexed control values used by TrueType instructions to maintain consistency when hinting glyphs. | TrueTypeFont.cvt | src/font.ts:172 |
defaultLanguage | public | string | null | undefined | The default language as an ISO 639-1 code ('en', 'fr', ...). | TrueTypeFont.defaultLanguage | src/true-type-font.ts:152 |
DSIG | public | DSIG | null | undefined | Digital Signature Table. Encapsulates cryptographic signatures validating binary authenticity. | TrueTypeFont.DSIG | src/font.ts:271 |
EBLC | public | EBLC | null | undefined | Embedded Bitmap Data Table. Stores bitmap images for specific point sizes. | TrueTypeFont.EBLC | src/font.ts:205 |
feat | public | feat | null | undefined | Feature Name Table. Maps AAT feature selectors to localised string references. | TrueTypeFont.feat | src/font.ts:336 |
fpgm | public | fpgm | null | undefined | Font Program Table. Contains low-level hints executing instruction sets across grid points. | TrueTypeFont.fpgm | src/font.ts:154 |
fvar | public | fvar | null | undefined | Font Variations Table. Declares design axes and instance configurations in variable fonts. | TrueTypeFont.fvar | src/font.ts:342 |
gasp | public | gasp | null | undefined | Grid-fitting and Scan-conversion Procedure Table. Optimises text raster rendering constraints. | TrueTypeFont.gasp | src/font.ts:277 |
GDEF | public | GDEF | null | undefined | Glyph Definition Table. Categorises glyph types (e.g., base, ligature, mark) for layout alignment. | TrueTypeFont.GDEF | src/font.ts:241 |
glyf | public | glyph | null | undefined | Glyph Data Table. Describes TrueType glyph outlines, including contour coordinates, composite glyph components, and hinting instructions. | TrueTypeFont.glyf | src/font.ts:178 |
glyphs | protected | Record<number, Glyph> | {} | - | TrueTypeFont.glyphs | src/true-type-font.ts:145 |
GPOS | public | GPOS | null | undefined | Glyph Positioning Table. Provides precise metric adjustments handling kerning and attachment marks. | TrueTypeFont.GPOS | src/font.ts:247 |
GSUB | public | GSUB | null | undefined | Glyph Substitution Table. Supplies glyph substitutions for contextual alternates, ligatures, and script-specific rendering. | TrueTypeFont.GSUB | src/font.ts:253 |
gvar | public | gvar | null | undefined | Glyph Variations Table. Controls structural outline distortion transformations for variable glyphs. | TrueTypeFont.gvar | src/font.ts:348 |
hdmx | public | hdmx | null | undefined | Horizontal Device Metrics Table. Preserves explicit pixel width mappings optimising spacing. | TrueTypeFont.hdmx | src/font.ts:283 |
head | public | head | null | undefined | Font Header Table. Tracks global typographic metrics, scale grid bounds, and metadata. | TrueTypeFont.head | src/font.ts:112 |
hhea | public | hhea | null | undefined | Horizontal Header Table. Stores global metric parameters for horizontal glyph layouts. | TrueTypeFont.hhea | src/font.ts:118 |
hmtx | public | hmtx | null | undefined | Horizontal Metrics Table. Contains advance widths and left side bearings for all glyphs. | TrueTypeFont.hmtx | src/font.ts:124 |
HVAR | public | HVAR | null | undefined | Horizontal Variation Metrics Table. Adjusts advance metrics across design spaces in variable fonts. | TrueTypeFont.HVAR | src/font.ts:265 |
JSTF | public | JSTF | null | undefined | Justification Table. Provides options for justification adjustments in complex scripts. | TrueTypeFont.JSTF | src/font.ts:259 |
just | public | just | null | undefined | Justification Table (just). Provides layout rules for line justification, glyph width deltas, and post-compensation actions in AAT typography. | TrueTypeFont.just | src/font.ts:354 |
kern | public | kern | null | undefined | Kerning Table. Contains traditional pairwise spacing adjustments. | TrueTypeFont.kern | src/font.ts:288 |
loca | public | loca | null | undefined | Index to Location Table. Maps local offsets for binary data streams resolving glyph outlines. | TrueTypeFont.loca | src/font.ts:160 |
LTSH | public | LTSH | null | undefined | Linear Threshold Table. Sets pixel-per-em limits where scaling instructions degrade. | TrueTypeFont.LTSH | src/font.ts:294 |
maxp | public | maxp | null | undefined | Maximum Profile Table. Explicitly defines memory boundaries and total glyph count constraints. | TrueTypeFont.maxp | src/font.ts:130 |
morx | public | morx | null | undefined | Extended Glyph Metamorphosis Table. Powers state-machine transformations substituting AAT items. | TrueTypeFont.morx | src/font.ts:360 |
name | public | name | null | undefined | Naming Table. Contains multilingual string records for copyrights, families, and system IDs. | TrueTypeFont.name | src/font.ts:136 |
objType | readonly | string | TrueTypeFont.objType | Discriminating property. Has the same value as the static TrueTypeFont.objType property. | TrueTypeFont.objType | src/true-type-font.ts:133 |
opbd | public | opbd | null | undefined | Optical Bounds Table. Sets bounding limits to align glyphs based on visual centre points. | TrueTypeFont.opbd | src/font.ts:366 |
OS/2 | public | OS2 | null | undefined | OS/2 and Windows Metrics Table. Contains subsystem configurations, weights, and unicode ranges. | TrueTypeFont.OS/2 | src/font.ts:142 |
outlines | public | "" | "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 - OpenTypePostScriptFont | TrueTypeFont.outlines | src/true-type-font.ts:178 |
outlineVersion | public | number | 0 | Discriminator 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.outlineVersion | src/true-type-font.ts:188 |
PCLT | public | PCLT | null | undefined | PCL 5 Table. Contains metrics and command parameters for HP LaserJet compatibility. | TrueTypeFont.PCLT | src/font.ts:300 |
post | public | post | null | undefined | PostScript Table. Encapsulates printer operational bounds and memory-tracking metrics. | TrueTypeFont.post | src/font.ts:148 |
prep | public | prep | null | undefined | Control Value Program Table. Provides global instructions establishing variable outline alignment. | TrueTypeFont.prep | src/font.ts:166 |
sbix | public | sbix | null | undefined | Standard Bitmap Graphics Table. Embeds raster configurations (PNG/JPEG) directly within glyph IDs. | TrueTypeFont.sbix | src/font.ts:217 |
type | readonly | string | TrueTypeFont.objType | Deprecated Use TrueTypeFont#objType instead! | TrueTypeFont.type | src/true-type-font.ts:138 |
VDMX | public | VDMX | null | undefined | Vertical Device Metrics Table. Preserves explicit vertical pixel height mappings. | TrueTypeFont.VDMX | src/font.ts:306 |
vhea | public | vhea | null | undefined | Vertical Header Table. Stores global metric parameters for vertical text directions. | TrueTypeFont.vhea | src/font.ts:312 |
vmtx | public | vmtx | null | undefined | Vertical Metrics Table. Contains advance heights and top side bearings for vertical layouts. | TrueTypeFont.vmtx | src/font.ts:318 |
VORG | public | VORG | null | undefined | Vertical Origin Table. Specifies vertical coordinate origins for dynamic metrics scaling. | TrueTypeFont.VORG | src/font.ts:199 |
objType | readonly | string | 'TTF' | Identifier for TrueType fonts. Always 'TTF'. | TrueTypeFont.objType | src/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 ​
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 ​
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 ​
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 ​
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 ​
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 ​
copyright ​
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 ​
descent ​
Get Signature ​
get descent():
number|undefined
Defined in: src/true-type-font.ts:415
The font’s descender.
Returns ​
number | undefined
Inherited from ​
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 ​
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 ​
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 ​
layoutEngine ​
Get Signature ​
get layoutEngine():
LayoutEngine
Defined in: src/true-type-font.ts:613
The shaping engine matching text scripts to font tables.
Returns ​
The shaping engine matching text scripts to font tables.
Inherited from ​
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 ​
namedVariations ​
Get Signature ​
get namedVariations():
NamedVariations
Defined in: src/true-type-font.ts:774
Returns ​
Inherited from ​
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 ​
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 ​
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 ​
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 ​
variationAxes ​
Get Signature ​
get variationAxes():
VariationAxes
Defined in: src/true-type-font.ts:747
Returns ​
Inherited from ​
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 ​
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 ​
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 ​
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 ​
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 ​
| Parameter | Type |
|---|---|
gid | number |
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 ​
Inherited from ​
decodeDirectory() ​
protecteddecodeDirectory():SFNTDirectory
Defined in: src/true-type-font.ts:324
Returns ​
Inherited from ​
decodeTable() ​
protecteddecodeTable<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 ​
| Parameter | Type |
|---|---|
table | SFNTDirectoryEntry |
Returns ​
ReturnType<object[K]["decode"]> | null
Inherited from ​
getAvailableFeatures() ​
getAvailableFeatures(
script,language?): keyofFeatures[]
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 ​
| Parameter | Type |
|---|---|
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 ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
Inherited from ​
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 ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
glyph | number | undefined | the glyph id |
characters | readonly number[] | [] | an array of code points this glyph represents |
Returns ​
Glyph | null
the corresponding glyph
Inherited from ​
getName() ​
protectedgetName(key,lang?):string|null
Defined in: src/true-type-font.ts:360
Parameters ​
| Parameter | Type |
|---|---|
key | keyof ProcessedRecords |
lang | string |
Returns ​
string | null
Inherited from ​
getTable() ​
protectedgetTable<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 ​
| Parameter | Type |
|---|---|
table | SFNTDirectoryEntry |
Returns ​
SFNTTableMap[K] | null
Inherited from ​
getTableStream() ​
protectedgetTableStream(tag):DecodeStream|null
Defined in: src/true-type-font.ts:310
Parameters ​
| Parameter | Type |
|---|---|
tag | string |
Returns ​
DecodeStream | null
Inherited from ​
getVariation() ​
getVariation(
settings):TrueTypeFont
Defined in: src/true-type-font.ts:782
Parameters ​
| Parameter | Type |
|---|---|
settings | string | VariationCoordinates |
Returns ​
Inherited from ​
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 ​
| Parameter | Type | Description |
|---|---|---|
codePoint | number | the 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 ​
| Parameter | Type | Description |
|---|---|---|
str | string | the string to encode |
Returns ​
Glyph[]
the corresponding glyphs
Inherited from ​
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 ​
| Parameter | Type | Description |
|---|---|---|
codePoint | number | the 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 Parameter | Default type |
|---|---|
K extends string | string |
Parameters ​
| Parameter | Type | Description |
|---|---|---|
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" | K | the table name like cmap, OS/2, or hmtx |
decode? | boolean | - |
Returns ​
boolean
Inherited from ​
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 ​
| Parameter | Type | Description |
|---|---|---|
str | string | the string to encode |
userFeatures? | Features | keyof Features[] | an array of OpenType feature tags to be applied in addition to the default set. |
script? | OpenTypeTag | the script of the string |
language? | string | the language of the string |
direction? | BidiDirection | the writing direction for the string |
Returns ​
the rendered string as a GlyphRun
Inherited from ​
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 ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
glyph | number | undefined | the glyph id |
characters | readonly number[] | [] | an optional sequence of codepoints |
Returns ​
Inherited from ​
setDefaultLanguage() ​
setDefaultLanguage(
lang?):void
Defined in: src/true-type-font.ts:356
Set the default language.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
lang | string | null | null |
Returns ​
void
See ​
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 ​
| Parameter | Type | Description |
|---|---|---|
gid | number | the glyph id |
Returns ​
string[]