|
@@ -1915,8 +1915,8 @@ struct ImFontConfig
|
|
|
bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).
|
|
bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).
|
|
|
int FontNo; // 0 // Index of font within TTF/OTF file
|
|
int FontNo; // 0 // Index of font within TTF/OTF file
|
|
|
float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height).
|
|
float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height).
|
|
|
- int OversampleH; // 3 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
|
|
|
|
|
- int OversampleV; // 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
|
|
|
|
|
|
|
+ int OversampleH; // 3 // Rasterize at higher quality for sub-pixel positioning. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
|
|
|
|
|
+ int OversampleV; // 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
|
|
|
bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
|
|
bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
|
|
|
ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
|
|
ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
|
|
|
ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input.
|
|
ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input.
|
|
@@ -2081,7 +2081,7 @@ struct ImFontAtlas
|
|
|
struct ImFont
|
|
struct ImFont
|
|
|
{
|
|
{
|
|
|
// Members: Hot ~24/32 bytes (for CalcTextSize)
|
|
// Members: Hot ~24/32 bytes (for CalcTextSize)
|
|
|
- ImVector<float> IndexAdvanceX; // 12/16 // out // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
|
|
|
|
|
|
|
+ ImVector<float> IndexAdvanceX; // 12/16 // out // // Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for CalcTextSize functions which only this this info, and are often bottleneck in large UI).
|
|
|
float FontSize; // 4 // in // <user set> // Height of characters, set during loading (don't change after loading)
|
|
float FontSize; // 4 // in // <user set> // Height of characters, set during loading (don't change after loading)
|
|
|
float FallbackAdvanceX; // 4 // out // = FallbackGlyph->AdvanceX
|
|
float FallbackAdvanceX; // 4 // out // = FallbackGlyph->AdvanceX
|
|
|
ImWchar FallbackChar; // 2 // in // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
|
|
ImWchar FallbackChar; // 2 // in // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
|
|
@@ -2094,21 +2094,18 @@ struct ImFont
|
|
|
|
|
|
|
|
// Members: Cold ~28/40 bytes
|
|
// Members: Cold ~28/40 bytes
|
|
|
ImFontAtlas* ContainerAtlas; // 4-8 // out // // What we has been loaded into
|
|
ImFontAtlas* ContainerAtlas; // 4-8 // out // // What we has been loaded into
|
|
|
- ImFontConfig* ConfigData; // 4-8 // in // // Pointer within ContainerAtlas->ConfigData
|
|
|
|
|
|
|
+ const ImFontConfig* ConfigData; // 4-8 // in // // Pointer within ContainerAtlas->ConfigData
|
|
|
short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
|
|
short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
|
|
|
bool DirtyLookupTables; // 1 // out //
|
|
bool DirtyLookupTables; // 1 // out //
|
|
|
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
|
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
|
|
- float Ascent, Descent; // 8 // out // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
|
|
|
|
- int MetricsTotalSurface;// 4 // out // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
|
|
|
|
|
|
+ float Ascent, Descent; // 8 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
|
|
|
|
+ int MetricsTotalSurface;// 4 // out // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
|
|
|
|
|
|
|
// Methods
|
|
// Methods
|
|
|
IMGUI_API ImFont();
|
|
IMGUI_API ImFont();
|
|
|
IMGUI_API ~ImFont();
|
|
IMGUI_API ~ImFont();
|
|
|
- IMGUI_API void ClearOutputData();
|
|
|
|
|
- IMGUI_API void BuildLookupTable();
|
|
|
|
|
IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const;
|
|
IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const;
|
|
|
IMGUI_API const ImFontGlyph*FindGlyphNoFallback(ImWchar c) const;
|
|
IMGUI_API const ImFontGlyph*FindGlyphNoFallback(ImWchar c) const;
|
|
|
- IMGUI_API void SetFallbackChar(ImWchar c);
|
|
|
|
|
float GetCharAdvance(ImWchar c) const { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; }
|
|
float GetCharAdvance(ImWchar c) const { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; }
|
|
|
bool IsLoaded() const { return ContainerAtlas != NULL; }
|
|
bool IsLoaded() const { return ContainerAtlas != NULL; }
|
|
|
const char* GetDebugName() const { return ConfigData ? ConfigData->Name : "<unknown>"; }
|
|
const char* GetDebugName() const { return ConfigData ? ConfigData->Name : "<unknown>"; }
|
|
@@ -2120,10 +2117,13 @@ struct ImFont
|
|
|
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const;
|
|
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const;
|
|
|
IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;
|
|
IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;
|
|
|
|
|
|
|
|
- // [Internal]
|
|
|
|
|
|
|
+ // [Internal] Don't use!
|
|
|
|
|
+ IMGUI_API void BuildLookupTable();
|
|
|
|
|
+ IMGUI_API void ClearOutputData();
|
|
|
IMGUI_API void GrowIndex(int new_size);
|
|
IMGUI_API void GrowIndex(int new_size);
|
|
|
IMGUI_API void AddGlyph(ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x);
|
|
IMGUI_API void AddGlyph(ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x);
|
|
|
IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.
|
|
IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.
|
|
|
|
|
+ IMGUI_API void SetFallbackChar(ImWchar c);
|
|
|
|
|
|
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
|
typedef ImFontGlyph Glyph; // OBSOLETE 1.52+
|
|
typedef ImFontGlyph Glyph; // OBSOLETE 1.52+
|