API reference
Preparing search index…

ImGui.ImFontAtlas_AddCustomRectRegular

  • Reserve a custom rectangle in the font atlas.

    Parameters

    self

    ImFontAtlas handle on which this method operates.

    width
    number

    Width of the custom atlas rectangle in pixels.

    height
    number

    Height of the custom atlas rectangle in pixels.

    Returns

    number

    Zero-based custom-rectangle index for ImFontAtlas_GetCustomRectByIndex(self, index); packing coordinates become available after atlas building.

    You can request arbitrary rectangles to be packed into the atlas, for your own purposes.

    • After calling ImFontAtlas_Build(self), you can query the rectangle position and render your pixels.

    • For colored output, native backends may use the atlas's TexPixelsUseColors flag to choose a texture format. This flag is not exposed by the JS atlas view.

    • You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), so you can render e.g. custom colorful icons and use them as regular glyphs.

    • Read docs/FONTS.md for more details about using colorful icons.

    • Note: this API may be redesigned later in order to support multi-monitor varying DPI settings.

    Source & inheritance

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