(Breaking) Fonts: Removed support for PushFont(NULL) which was a shortcut for "default font".

This commit is contained in:
ocornut
2025-06-24 14:44:38 +02:00
parent 6e846c56b4
commit 6722d789e9
2 changed files with 6 additions and 2 deletions

View File

@@ -83,6 +83,7 @@ Breaking changes:
(not desirable as it requires e.g. all third-party code to be aware of it).
- ImFont::FontSize was removed and does not make sense anymore.
ImFont::LegacySize is the size passed to AddFont().
- Removed support for PushFont(NULL) which was a shortcut for "default font".
- Renamed/moved 'io.FontGlobalScale' to 'style.FontScaleMain'.
- Fonts: **IMPORTANT** on Font Merging:
- When searching for a glyph in multiple merged fonts: font inputs are now scanned in order

View File

@@ -489,6 +489,7 @@ CODE
io.Fonts->AddFontFromFileTTF("FontAwesome4.ttf", 0.0f, &cfg2);
- You can use `Metrics/Debugger->Fonts->Font->Input Glyphs Overlap Detection Tool` to see list of glyphs available in multiple font sources. This can facilitate unde
- Fonts: ImFont::FontSize was removed and does not make sense anymore. ImFont::LegacySize is the size passed to AddFont().
- Fonts: Removed support for PushFont(NULL) which was a shortcut for "default font".
- Fonts: Renamed/moved 'io.FontGlobalScale' to 'style.FontScaleMain'.
- Textures: all API functions taking a 'ImTextureID' parameter are now taking a 'ImTextureRef'. Affected functions are: ImGui::Image(), ImGui::ImageWithBg(), ImGui::ImageButton(), ImDrawList::AddImage(), ImDrawList::AddImageQuad(), ImDrawList::AddImageRounded().
- Fonts: obsoleted ImFontAtlas::GetTexDataAsRGBA32(), GetTexDataAsAlpha8(), Build(), SetTexID(), IsBuilt() functions. The new protocol for backends to handle textures doesn't need them. Kept redirection functions (will obsolete).
@@ -8906,9 +8907,11 @@ void ImGui::SetFontRasterizerDensity(float rasterizer_density)
void ImGui::PushFont(ImFont* font, float font_size_base)
{
ImGuiContext& g = *GImGui;
//if (font == NULL) // Before 1.92 (June 2025), PushFont(NULL) == PushFont(GetDefaultFont())
// font = g.Font;
IM_ASSERT(font != NULL);
g.FontStack.push_back({ g.Font, g.FontSizeBase, g.FontSize });
if (font == NULL)
font = GetDefaultFont();
if (font_size_base <= 0.0f)
{
if (font->Flags & ImFontFlags_DefaultToLegacySize)