Fonts: make ImFont::Sources a vector.

Later it should become a ImSpan<>
This commit is contained in:
ocornut
2025-06-11 15:57:23 +02:00
parent e7efe94fd2
commit 2b0d49a905
4 changed files with 58 additions and 67 deletions
+2 -3
View File
@@ -3759,8 +3759,7 @@ struct ImFont
// Conceptually Sources[] is the list of font sources merged to create this font.
ImGuiID FontId; // Unique identifier for the font
float DefaultSize; // 4 // in // Default font size
short SourcesCount; // 2 // in // Number of ImFontConfig involved in creating this font. Usually 1, or >1 when merging multiple font sources into one ImFont.
ImFontConfig* Sources; // 4-8 // in // Pointer within ContainerAtlas->Sources[], to SourcesCount instances
ImVector<ImFontConfig*> Sources; // 16 // in // List of sources. Pointers within ContainerAtlas->Sources[]
ImWchar EllipsisChar; // 2-4 // out // Character used for ellipsis rendering ('...').
ImWchar FallbackChar; // 2-4 // out // Character used if a glyph isn't found (U+FFFD, '?')
float Scale; // 4 // in // Base font scale (~1.0f), multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
@@ -3773,7 +3772,7 @@ struct ImFont
IMGUI_API ImFontBaked* GetFontBaked(float font_size); // Get or create baked data for given size
IMGUI_API bool IsGlyphInFont(ImWchar c);
bool IsLoaded() const { return ContainerAtlas != NULL; }
const char* GetDebugName() const { return Sources ? Sources[0].Name : "<unknown>"; } // Fill ImFontConfig::Name.
const char* GetDebugName() const { return Sources.Size ? Sources[0]->Name : "<unknown>"; } // Fill ImFontConfig::Name.
// [Internal] Don't use!
// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.