mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
ImFont: Rearranged members toward an optimal CalcTextSize() loop. Removed comments from destructor. Made constructor more explicit.
This commit is contained in:
36
imgui.h
36
imgui.h
@ -2078,24 +2078,26 @@ struct ImFontAtlas
|
||||
// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().
|
||||
struct ImFont
|
||||
{
|
||||
// Members: Hot ~62/78 bytes
|
||||
float FontSize; // <user set> // Height of characters, set during loading (don't change after loading)
|
||||
float Scale; // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
||||
ImVec2 DisplayOffset; // = (0.f,0.f) // Offset font rendering by xx pixels
|
||||
ImVector<ImFontGlyph> Glyphs; // // All glyphs.
|
||||
ImVector<float> IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
|
||||
ImVector<ImWchar> IndexLookup; // // Sparse. Index glyphs by Unicode code-point.
|
||||
const ImFontGlyph* FallbackGlyph; // == FindGlyph(FontFallbackChar)
|
||||
float FallbackAdvanceX; // == FallbackGlyph->AdvanceX
|
||||
ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
|
||||
// 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).
|
||||
float FontSize; // 4 // in // <user set> // Height of characters, set during loading (don't change after loading)
|
||||
float FallbackAdvanceX; // 4 // out // = FallbackGlyph->AdvanceX
|
||||
ImWchar FallbackChar; // 2 // in // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
|
||||
|
||||
// Members: Cold ~18/26 bytes
|
||||
short ConfigDataCount; // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
|
||||
ImFontConfig* ConfigData; // // Pointer within ContainerAtlas->ConfigData
|
||||
ImFontAtlas* ContainerAtlas; // // What we has been loaded into
|
||||
float Ascent, Descent; // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
||||
bool DirtyLookupTables;
|
||||
int MetricsTotalSurface;// // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
||||
// Members: Hot ~36/48 bytes (for CalcTextSize + render loop)
|
||||
ImVector<ImWchar> IndexLookup; // 12-16 // out // // Sparse. Index glyphs by Unicode code-point.
|
||||
ImVector<ImFontGlyph> Glyphs; // 12-16 // out // // All glyphs.
|
||||
ImVec2 DisplayOffset; // 8 // in // = (0,0) // Offset font rendering by xx pixels
|
||||
const ImFontGlyph* FallbackGlyph; // 4-8 // out // = FindGlyph(FontFallbackChar)
|
||||
|
||||
// Members: Cold ~28/40 bytes
|
||||
ImFontAtlas* ContainerAtlas; // 4-8 // out // // What we has been loaded into
|
||||
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.
|
||||
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 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
|
||||
IMGUI_API ImFont();
|
||||
|
Reference in New Issue
Block a user