1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

(Breaking) Fonts: PushFont() default to preserve current font size.

This commit is contained in:
ocornut 2025-03-21 19:13:23 +01:00
parent 168b97c291
commit 44498825cd
3 changed files with 19 additions and 7 deletions

View file

@ -3005,6 +3005,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)
font = IM_NEW(ImFont)();
font->FontId = FontNextUniqueID++;
font->Flags = font_cfg->Flags;
font->DefaultSize = font_cfg->SizePixels;
Fonts.push_back(font);
}
else
@ -3248,7 +3249,7 @@ int ImFontAtlas::AddCustomRectRegular(int width, int height)
// myfont->Flags |= ImFontFlags_LockBakedSizes;
int ImFontAtlas::AddCustomRectFontGlyph(ImFont* font, ImWchar codepoint, int width, int height, float advance_x, const ImVec2& offset)
{
float font_size = font->Sources[0].SizePixels;
float font_size = font->DefaultSize;
return AddCustomRectFontGlyphForSize(font, font_size, codepoint, width, height, advance_x, offset);
}
// FIXME: we automatically set glyph.Colored=true by default.