ImFont: Renamed ImFont::Glyph to ImFontGlyph (for consistency and so ImFontAtlas types can use it without ordering half of the file). Left a redirection type.
floatSizePixels;// // Size in pixels for rasterizer.
intOversampleH,OversampleV;// 3, 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
boolPixelSnapH;// 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.
ImVec2GlyphExtraSpacing;// 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
ImVec2GlyphExtraSpacing;// 1, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
ImVec2GlyphOffset;// 0, 0 // Offset all glyphs from this font input.
constImWchar*GlyphRanges;// NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
boolMergeMode;// false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.
@ -1346,6 +1346,14 @@ struct ImFontConfig
IMGUI_APIImFontConfig();
};
structImFontGlyph
{
ImWcharCodepoint;// 0x0000..0xFFFF
floatXAdvance;// Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in)
floatX0,Y0,X1,Y1;// Glyph corners
floatU0,V0,U1,V1;// Texture coordinates
};
// Load and rasterize multiple TTF/OTF fonts into a same texture.
// Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering.
// We also add custom graphic data into the texture that serves for ImGui.
@ -1444,22 +1452,14 @@ struct ImFontAtlas
// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().
structImFont
{
structGlyph
{
ImWcharCodepoint;
floatXAdvance;
floatX0,Y0,X1,Y1;// Glyph corners
floatU0,V0,U1,V1;// Texture coordinates
};
// Members: Hot ~62/78 bytes
floatFontSize;// <user set> // Height of characters, set during loading (don't change after loading)
floatScale;// = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
ImVec2DisplayOffset;// = (0.f,1.f) // Offset font rendering by xx pixels
ImVector<Glyph>Glyphs;// // All glyphs.
ImVector<ImFontGlyph>Glyphs;// // All glyphs.
ImVector<float>IndexXAdvance;// // Sparse. Glyphs->XAdvance in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
ImVector<unsignedshort>IndexLookup;// // Sparse. Index glyphs by Unicode code-point.
IMGUI_APIvoidAddRemapChar(ImWchardst,ImWcharsrc,booloverwrite_dst=true);// Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.
// Display all glyphs of the fonts in separate pages of 256 characters
constImFont::Glyph*glyph_fallback=font->FallbackGlyph;// Forcefully/dodgily make FindGlyph() return NULL on fallback, which isn't the default behavior.
constImFontGlyph*glyph_fallback=font->FallbackGlyph;// Forcefully/dodgily make FindGlyph() return NULL on fallback, which isn't the default behavior.
font->RenderChar(draw_list,cell_size.x,cell_p1,ImGui::GetColorU32(ImGuiCol_Text),(ImWchar)(base+n));// We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.