Atrium — shared contracts and the typesetting engine
    Preparing search index...

    Interface FontHandle

    interface FontHandle {
        ascent: number;
        capHeight: number;
        data: Uint8Array;
        descent: number;
        id: string;
        lineGap: number;
        postscriptName: string;
        unitsPerEm: number;
        xHeight: number;
        advanceWidth(glyphId: number): number;
        glyphsForString(text: string): number[];
        kern(leftGlyphId: number, rightGlyphId: number): number;
        shape(text: string, size: number): ShapedText;
    }
    Index
    ascent: number

    Font units above the baseline, positive.

    capHeight: number

    Height of uppercase H, in font units.

    data: Uint8Array

    The original font file. PDF emission embeds a subset built from these bytes; the engine itself never reads a file, so whoever constructs the handle is responsible for supplying them.

    descent: number

    Font units below the baseline, positive downwards. OpenType stores this as a negative number; handles normalise the sign so layout never has to remember which convention a given face used.

    id: string

    Stable identifier for this face, e.g. lmroman10-regular. Appears verbatim in golden dumps, so it must not change between runs or platforms.

    lineGap: number

    Extra leading the designer asked for between lines, in font units.

    postscriptName: string

    The name PDF embeds the font under.

    unitsPerEm: number

    The font's design grid — 1000 for CFF, commonly 2048 for TrueType.

    xHeight: number

    Height of lowercase x, in font units.

    • Advance of one glyph, in font units.

      Parameters

      • glyphId: number

      Returns number

    • Glyph ids for a string, with ligature substitution applied.

      Parameters

      • text: string

      Returns number[]

    • Kern between an adjacent pair, in font units. 0 when the pair is not kerned.

      Parameters

      • leftGlyphId: number
      • rightGlyphId: number

      Returns number

    • Shape a string at a size: ligatures, kerning and scaling to points in one step. This is what layout calls.

      Parameters

      • text: string
      • size: number

      Returns ShapedText