API reference
Preparing search index…

ImGui.ImFontAtlas_AddFontFromMemoryTTF

  • Add a font from uncompressed TrueType data in memory.

    Parameters

    self

    ImFontAtlas handle on which this method operates.

    font_data
    null | bigint

    Address of TTF/OTF bytes. By default the atlas takes ownership and frees them; set FontDataOwnedByAtlas=false to retain ownership and keep the memory alive.

    font_data_size
    number

    Byte length of the supplied font data.

    size_pixels
    number

    Requested font height in pixels.

    font_cfg
    null | ImFontConfig = null

    Font-loading configuration; optional variants accept null for defaults. Ownership and merge settings affect how font data is retained.

    glyph_ranges
    null | Uint16Array = null

    Uint16Array of inclusive [first, last] pairs followed by 0. getGlyphRanges* helpers omit that terminator: append it explicitly with new Uint16Array([...getGlyphRangesDefault(atlas), 0]). Keep this input alive until atlas build; null selects default ranges.

    Returns

    null | ImFont

    Atlas-owned font handle (the destination font in merge mode). Glyphs become available after atlas building; invalid input may trigger native assertions.

    Note: Transfer ownership of 'ttf_data' to ImFontAtlas!

    Will be deleted after destruction of the atlas.

    Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed.

    Source & inheritance

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