Skip to content

Interface: FontMetrics ​

Per-(face,bold,italic) advance-width source backed by a parsed font file.

Properties ​

advanceWidthPt ​

advanceWidthPt: (text, sizePt, charSpacingPt?) => number

Advance width of text at sizePt, in points. Sums raw glyph advances (no kerning) and adds charSpacingPt after every character, matching how PowerPoint widens runs with character spacing.

Parameters ​

ParameterType
textstring
sizePtnumber
charSpacingPt?number

Returns ​

number


hasCodepoint ​

hasCodepoint: (cp) => boolean

True if this face's cmap maps code point cp to a real glyph (not the .notdef fallback). Use it to flag source code points the face cannot render. Authoritative only for file-backed metrics; the unregistered-font heuristic has no cmap and reports every code point as covered.

Parameters ​

ParameterType
cpnumber

Returns ​

boolean


unitsPerEm ​

readonly unitsPerEm: number

Font design units per em (advances are in these units).