Package imgui

Class ImFont


public final class ImFont extends ImGuiStructDestroyable
Font runtime data. A single logical font that can be baked at multiple sizes (see ImFontBaked via getFontBaked).

In Dear ImGui 1.92 the font subsystem was reworked: ImFont now represents the font source set, while size-specific data (glyphs, ascent/descent, character metrics) lives on ImFontBaked. Many previously-exposed fields moved there and are no longer reachable through ImFont.

  • Field Summary

    Fields inherited from class imgui.binding.ImGuiStruct

    ptr
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    ImFont(long ptr)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    calcTextSizeA(float size, float maxWidth, float wrapWidth, String textBegin)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    calcTextSizeA(float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    void
    calcTextSizeA(ImVec2 dst, float size, float maxWidth, float wrapWidth, String textBegin)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    void
    calcTextSizeA(ImVec2 dst, float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    float
    calcTextSizeAX(float size, float maxWidth, float wrapWidth, String textBegin)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    float
    calcTextSizeAX(float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    float
    calcTextSizeAY(float size, float maxWidth, float wrapWidth, String textBegin)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    float
    calcTextSizeAY(float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
    'max_width' stops rendering after a certain width (could be turned into a 2d size).
    calcWordWrapPositionA(float scale, String text, String textEnd, float wrapWidth)
    Deprecated.
    since imgui 1.92; prefer CalcWordWrapPosition(size, ...).
    protected long
     
     
    short
    Character used for ellipsis rendering.
    short
    Character used if a glyph isn't found (U+FFFD, '?').
    float
    Font size passed to AddFontXXX().
    float
    Legacy base font scale (~1.0f), multiplied by the per-window font scale which you can adjust with SetWindowFontScale().
    boolean
     
    void
    renderChar(ImDrawList drawList, float size, float posX, float posY, int col, int c)
     
    void
    renderChar(ImDrawList drawList, float size, ImVec2 pos, int col, int c)
     
    void
    renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd, float wrapWidth)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd, float wrapWidth, int flags)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd, int flags)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd, float wrapWidth)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd, float wrapWidth, int flags)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd, int flags)
    The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    void
    setEllipsisChar(short value)
    Character used for ellipsis rendering.
    void
    setFallbackChar(short value)
    Character used if a glyph isn't found (U+FFFD, '?').
    void
    setLegacySize(float value)
    Font size passed to AddFontXXX().
    void
    setScale(float value)
    Legacy base font scale (~1.0f), multiplied by the per-window font scale which you can adjust with SetWindowFontScale().

    Methods inherited from class imgui.binding.ImGuiStructDestroyable

    destroy

    Methods inherited from class imgui.binding.ImGuiStruct

    isNotValidPtr, isValidPtr

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ImFont

      public ImFont()
    • ImFont

      public ImFont(long ptr)
  • Method Details

    • create

      protected long create()
      Specified by:
      create in class ImGuiStructDestroyable
    • getLegacySize

      public float getLegacySize()
      Font size passed to AddFontXXX(). Use for legacy code calling ImGui.pushFont(ImFont, float) that expected the original size (use ImGui::GetFontBaked() in new code).
    • setLegacySize

      public void setLegacySize(float value)
      Font size passed to AddFontXXX(). Use for legacy code calling ImGui.pushFont(ImFont, float) that expected the original size (use ImGui::GetFontBaked() in new code).
    • getEllipsisChar

      public short getEllipsisChar()
      Character used for ellipsis rendering.
    • setEllipsisChar

      public void setEllipsisChar(short value)
      Character used for ellipsis rendering.
    • getFallbackChar

      public short getFallbackChar()
      Character used if a glyph isn't found (U+FFFD, '?').
    • setFallbackChar

      public void setFallbackChar(short value)
      Character used if a glyph isn't found (U+FFFD, '?').
    • getScale

      public float getScale()
      Legacy base font scale (~1.0f), multiplied by the per-window font scale which you can adjust with SetWindowFontScale(). Obsolete since 1.92; kept behind IMGUI_DISABLE_OBSOLETE_FUNCTIONS.
    • setScale

      public void setScale(float value)
      Legacy base font scale (~1.0f), multiplied by the per-window font scale which you can adjust with SetWindowFontScale(). Obsolete since 1.92; kept behind IMGUI_DISABLE_OBSOLETE_FUNCTIONS.
    • isLoaded

      public boolean isLoaded()
    • getDebugName

      public String getDebugName()
    • calcTextSizeA

      public ImVec2 calcTextSizeA(float size, float maxWidth, float wrapWidth, String textBegin)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcTextSizeAX

      public float calcTextSizeAX(float size, float maxWidth, float wrapWidth, String textBegin)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcTextSizeAY

      public float calcTextSizeAY(float size, float maxWidth, float wrapWidth, String textBegin)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcTextSizeA

      public void calcTextSizeA(ImVec2 dst, float size, float maxWidth, float wrapWidth, String textBegin)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcTextSizeA

      public ImVec2 calcTextSizeA(float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcTextSizeAX

      public float calcTextSizeAX(float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcTextSizeAY

      public float calcTextSizeAY(float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcTextSizeA

      public void calcTextSizeA(ImVec2 dst, float size, float maxWidth, float wrapWidth, String textBegin, String textEnd)
      'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
    • calcWordWrapPositionA

      @Deprecated public String calcWordWrapPositionA(float scale, String text, String textEnd, float wrapWidth)
      Deprecated.
      since imgui 1.92; prefer CalcWordWrapPosition(size, ...). This overload is kept as a legacy redirect; internally it passes LegacySize * scale as the size.
    • renderChar

      public void renderChar(ImDrawList drawList, float size, ImVec2 pos, int col, int c)
    • renderChar

      public void renderChar(ImDrawList drawList, float size, float posX, float posY, int col, int c)
    • renderText

      public void renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    • renderText

      public void renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    • renderText

      public void renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd, float wrapWidth)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    • renderText

      public void renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd, float wrapWidth)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    • renderText

      public void renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd, float wrapWidth, int flags)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    • renderText

      public void renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd, float wrapWidth, int flags)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    • renderText

      public void renderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd, int flags)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).
    • renderText

      public void renderText(ImDrawList drawList, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectZ, float clipRectW, String textBegin, String textEnd, int flags)
      The flags parameter is ImDrawTextFlags (since imgui 1.92; previously a bool cpu_fine_clip).