API reference
Preparing search index…

Native-owned font face, input storage and retained glyph atlases.

Source & inheritance
Member directory19

Constructors

Properties

Methods

Constructors

  • Creates an empty font or copies an existing font.

    Parameters

    sourceOptional
    Readonly<
        Pick<
            Font,
            | typeof graphicsNative
            | "isSmooth"
            | typeof fontRevision
            | "getInfo"
            | "getGlyph"
            | "getGlyphById"
            | "hasGlyph"
            | "getKerning"
            | "getAscent"
            | "getDescent"
            | "getLineSpacing"
            | "getUnderlinePosition"
            | "getUnderlineThickness"
            | "getTexture",
        >,
    >

    Returns

    Source & inheritance

Methods

  • Returns the ascent in pixels for the specified pixel character size.

    Parameters

    size
    number

    Returns

    number
    Source & inheritance
  • Returns the descent in pixels for the specified pixel character size.

    Parameters

    size
    number

    Returns

    number
    Source & inheritance
  • Gets the cached glyph for a Unicode code point; size and outline thickness are in pixels, and bold controls emboldening.

    Parameters

    codePoint
    number
    characterSize
    number
    bold
    boolean
    outlineThickness
    number = 0

    Returns

    Source & inheritance
  • Gets a glyph by its internal font glyph index; size and outline thickness are in pixels.

    Parameters

    id
    number
    characterSize
    number
    bold
    boolean
    outlineThickness
    number = 0

    Returns

    Source & inheritance
  • Returns kerning between two Unicode code points in pixels.

    Parameters

    first
    number
    second
    number
    characterSize
    number
    bold
    boolean = false

    Returns

    number
    Source & inheritance
  • Returns recommended baseline spacing for the specified pixel character size.

    Parameters

    size
    number

    Returns

    number
    Source & inheritance
  • Returns a read-only glyph atlas texture reference for the specified pixel character size; loading more glyphs may update its contents.

    Parameters

    characterSize
    number

    Returns

    Readonly
    Source & inheritance
  • Returns the underline position relative to the baseline in pixels.

    Parameters

    size
    number

    Returns

    number
    Source & inheritance
  • Returns the underline thickness in pixels.

    Parameters

    size
    number

    Returns

    number
    Source & inheritance
  • Returns whether the font has a glyph for the specified Unicode code point.

    Parameters

    codePoint
    number

    Returns

    boolean
    Source & inheritance
  • Returns whether font textures use smooth filtering.

    Returns

    boolean
    Source & inheritance
  • Opens a font file asynchronously; on success replaces the font and clears metric caches. Returns whether it succeeded.

    Parameters

    filename
    string

    Returns

    Promise<boolean>
    Source & inheritance
  • Opens encoded font bytes asynchronously and returns whether it succeeded.

    Parameters

    data
    Uint8Array

    Returns

    Promise<boolean>
    Source & inheritance
  • Reads all font bytes from the start of the stream and opens asynchronously; returns success, and stream errors reject the Promise.

    Parameters

    Returns

    Promise<boolean>
    Source & inheritance
  • Sets whether font textures use smooth filtering.

    Parameters

    smooth
    boolean

    Returns

    void
    Source & inheritance

Symbol members

"[fontRevision]": number = 0
Source & inheritance
"[graphicsNative]": NativeGraphicsHandle<"font">
Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0