Skip to content

Commit 80c9cd1

Browse files
committed
Font: reduce unnecessary padding in ImFontConfig struct too.
1 parent d7454de commit 80c9cd1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

imgui.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -3233,26 +3233,27 @@ struct ImDrawData
32333233
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont)
32343234
//-----------------------------------------------------------------------------
32353235

3236+
// A font input/source (we may rename this to ImFontSource in the future)
32363237
struct ImFontConfig
32373238
{
32383239
void* FontData; // // TTF/OTF data
32393240
int FontDataSize; // // TTF/OTF data size
32403241
bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).
3242+
bool MergeMode; // 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.
3243+
bool PixelSnapH; // false // Align every glyph AdvanceX to pixel boundaries. 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.
32413244
int FontNo; // 0 // Index of font within TTF/OTF file
3242-
float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height).
32433245
int OversampleH; // 2 // Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal. You can reduce this to 1 for large glyphs save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
32443246
int OversampleV; // 1 // Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis.
3245-
bool PixelSnapH; // false // Align every glyph AdvanceX to pixel boundaries. 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.
3247+
float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height).
32463248
ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs when rendered: essentially add to glyph->AdvanceX. Only X axis is supported for now.
32473249
ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input.
32483250
const ImWchar* GlyphRanges; // NULL // THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
32493251
float GlyphMinAdvanceX; // 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font
32503252
float GlyphMaxAdvanceX; // FLT_MAX // Maximum AdvanceX for glyphs
3251-
bool MergeMode; // 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.
32523253
unsigned int FontBuilderFlags; // 0 // Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
32533254
float RasterizerMultiply; // 1.0f // Linearly brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. This is a silly thing we may remove in the future.
32543255
float RasterizerDensity; // 1.0f // DPI scale for rasterization, not altering other font metrics: make it easy to swap between e.g. a 100% and a 400% fonts for a zooming display. IMPORTANT: If you increase this it is expected that you increase font scale accordingly, otherwise quality may look lowered.
3255-
ImWchar EllipsisChar; // 0 // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
3256+
ImWchar EllipsisChar; // 0 // Explicitly specify Unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
32563257

32573258
// [Internal]
32583259
char Name[40]; // Name (strictly to ease debugging)

0 commit comments

Comments
 (0)