harfbuzzjs
    Preparing search index...

    Class Font

    An object representing a HarfBuzz font. A font represents a face at a specific size and with certain other parameters (pixels-per-em, variation settings) specified. Fonts are the primary input to the shaping process.

    Index

    Constructors

    Properties

    ptr: number

    Methods

    • Return glyph extents.

      Parameters

      • glyphId: number

        ID of the requested glyph in the font.

      Returns GlyphExtents | null

      An object with xBearing, yBearing, width, and height, or null.

    • Return glyph ID from name.

      Parameters

      • name: string

        Name of the requested glyph in the font.

      Returns number | null

      The glyph ID, or null if not found.

    • Return glyph horizontal advance.

      Parameters

      • glyphId: number

        ID of the requested glyph in the font.

      Returns number

      The horizontal advance width.

    • Return glyph horizontal origin.

      Parameters

      • glyphId: number

        ID of the requested glyph in the font.

      Returns [number, number] | null

      [x, y] origin coordinates, or null if not available.

    • Return glyph name.

      Parameters

      • glyphId: number

        ID of the requested glyph in the font.

      Returns string

      The glyph name string.

    • Return a glyph as an SVG path string.

      Parameters

      • glyphId: number

        ID of the requested glyph in the font.

      Returns string

      SVG path data string.

    • Return glyph vertical advance.

      Parameters

      • glyphId: number

        ID of the requested glyph in the font.

      Returns number

      The vertical advance height.

    • Return glyph vertical origin.

      Parameters

      • glyphId: number

        ID of the requested glyph in the font.

      Returns [number, number] | null

      [x, y] origin coordinates, or null if not available.

    • Set the font's scale factor, affecting the position values returned from shaping.

      Parameters

      • xScale: number

        Units to scale in the X dimension.

      • yScale: number

        Units to scale in the Y dimension.

      Returns void

    • Set the font's variations.

      Parameters

      • variations: Record<string, number>

        Dictionary of variations to set.

      Returns void

    • Create a sub font that inherits this font's properties.

      Returns Font

      A new Font object representing the sub font.