diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 7c7daf79d..01694d50a 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -80,10 +80,7 @@ Breaking changes: - PushFont(font, 20.0f) // Change font and set size to 20.0f - PushFont(font, style.FontSizeBase * 2.0f) // Change font and set size to be twice bigger than current size. - PushFont(font, font->LegacySize) // Change font and set size to size passed to AddFontXXX() function. Same as pre-1.92 behavor, for fixed size fonts. - - To use old behavior: - - use 'ImGui::PushFont(font, font->LegacySize)' at call site (preferred). - - or set 'ImFontConfig::Flags |= ImFontFlags_DefaultToLegacySize' in AddFont() call - (not desirable as it requires e.g. all third-party code to be aware of it). + - To use old behavior use 'ImGui::PushFont(font, font->LegacySize)' at call site. We intentionally didn't add a default parameter because it would make the long-term transition more difficult. - Kept inline redirection font. Will obsolete. @@ -290,8 +287,6 @@ Other changes: window and other locations). - Fonts: added ImFontFlags (currently needs to be passed through ImFontConfig until we revamp font loading API): - - ImFontFlags_DefaultToLegacySize: for legacy compatibility: make PushFont() calls - without explicit size use font->LegacySize instead of current font size. - ImFontFlags_NoLoadError: disable erroring/assert when calling AddFontXXX() with missing file/data. Calling code is expected to check AddFontXXX() return value. - ImFontFlags_NoLoadGlyphs: disable loading new glyphs. diff --git a/imgui.cpp b/imgui.cpp index eceda68f1..e36d0a9e2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -473,7 +473,7 @@ CODE - PushFont() API now has a REQUIRED size parameter. - Before 1.92: PushFont() always used font "default" size specified in AddFont() call. It is equivalent to calling PushFont(font, font->LegacySize). - Since 1.92: PushFont(font, 0.0f) preserve the current font size which is a shared value. - - To use old behavior: (A) use 'ImGui::PushFont(font, font->LegacySize)' at call site (preferred). (B) Set 'ImFontConfig::Flags |= ImFontFlags_DefaultToLegacySize' in AddFont() call (not desirable as it requires e.g. third-party code to be aware of it). + - To use old behavior: use 'ImGui::PushFont(font, font->LegacySize)' at call site. - Kept inline single parameter function. Will obsolete. - Fonts: **IMPORTANT** on Font Merging: - When searching for a glyph in multiple merged fonts: font inputs are now scanned in orderfor the first font input which the desired glyph. This is technically a different behavior than before! @@ -8911,12 +8911,7 @@ void ImGui::PushFont(ImFont* font, float font_size_base) g.FontStack.push_back({ g.Font, g.FontSizeBase, g.FontSize }); if (font_size_base == 0.0f) - { - if (font->Flags & ImFontFlags_DefaultToLegacySize) - font_size_base = font->LegacySize; // Legacy: use AddFont() specified font size. Same as doing PushFont(font, font->LegacySize) - else - font_size_base = g.FontSizeBase; // Keep current font size - } + font_size_base = g.FontSizeBase; // Keep current font size SetCurrentFont(font, font_size_base, 0.0f); } diff --git a/imgui.h b/imgui.h index 1022ea3fa..44ab90869 100644 --- a/imgui.h +++ b/imgui.h @@ -3759,7 +3759,6 @@ struct ImFontBaked enum ImFontFlags_ { ImFontFlags_None = 0, - ImFontFlags_DefaultToLegacySize = 1 << 0, // Legacy compatibility: make `PushFont(font)` == `PushFont(font, font->LegacySize)`. Otherwise by default/shared current font size is used. ImFontFlags_NoLoadError = 1 << 1, // Disable throwing an error/assert when calling AddFontXXX() with missing file/data. Calling code is expected to check AddFontXXX() return value. ImFontFlags_NoLoadGlyphs = 1 << 2, // [Internal] Disable loading new glyphs. ImFontFlags_LockBakedSizes = 1 << 3, // [Internal] Disable loading new baked sizes, disable garbage collecting current ones. e.g. if you want to lock a font to a single size. Important: if you use this to preload given sizes, consider the possibility of multiple font density used on Retina display.