Skip to content

modern-pdf-lib


modern-pdf-lib / extractMetrics

Function: extractMetrics()

extractMetrics(fontData): FontMetrics

Defined in: src/assets/font/fontMetrics.ts:629

Extract font metrics from raw TrueType / OpenType font bytes.

Parses the head, hhea, hmtx, cmap, maxp, OS/2, name, and post tables to produce a complete FontMetrics object.

Parameters

fontData

Uint8Array

The raw TTF or OTF file as a Uint8Array.

Returns

FontMetrics

Parsed font metrics.

Throws

If required tables are missing or the data is corrupt.

Released under the MIT License.