(Breaking) Fonts: removed PushFontSize(), PopFontSize().

This commit is contained in:
ocornut
2025-06-24 19:01:59 +02:00
parent ca72eb0596
commit 97e0d59619
8 changed files with 11 additions and 28 deletions

View File

@@ -150,7 +150,7 @@ Breaking changes:
ImGuiContext to create one, you'll need to call ImFontAtlasUpdateNewFrame() yourself.
An assert will trigger if you don't.
- Fonts: obsolete ImGui::SetWindowFontScale() which is not useful anymore. Prefer using
PushFontSize(style.FontSizeBase * factor) or to manipulate other scaling factors.
PushFont(NULL, style.FontSizeBase * factor) or to manipulate other scaling factors.
- Fonts: obsoleted ImFont::Scale which is not useful anymore.
- Fonts: changed ImFont::CalcWordWrapPositionA() to ImFont::CalcWordWrapPosition():
- old: const char* CalcWordWrapPositionA(float scale, const char* text, ....);
@@ -270,7 +270,6 @@ Other changes:
- Fonts: ImFontAtlas::AddFontXXX() functions may be called at any time during the frame.
- Fonts: ImFontAtlas::AddFontXXX() can fail more gracefully if error handling is configured
to not assert (this will be better exposed via future font flags).
- Fonts: added ImGui::PushFontSize()/PopFontSize() functions.
- Fonts: added style.FontScaleBase scaling factor (previously called io.FontGlobalScale).
- Fonts: added style.FontScaleDpi scaling factor. This is designed to be be changed on
per-monitor/per-viewport basis, which `io.ConfigDpiScaleFonts` does automatically.

View File

@@ -572,7 +572,7 @@ Since 1.92 (June 2025) fonts may be dynamically used at any size.
To change font size:
```cpp
ImGui::PushFontSize(42.0f);
ImGui::PushFont(NULL, 42.0f);
```
To change font and font size:
```cpp

View File

@@ -77,7 +77,7 @@ Future versions of Dear ImGui should solve this problem.
v1.92 introduces a newer, dynamic font system. It requires backend to support the `ImGuiBackendFlags_HasTextures` feature:
- Users of icons, Asian and non-English languages do not need to pre-build all glyphs ahead of time. Saving on loading time, memory, and also reducing issues with missing glyphs. Specifying glyph ranges is not needed anymore.
- `PushFontSize()` may be used anytime to change font size.
- `PushFont(NULL, new_size)` may be used anytime to change font size.
- Packing custom rectangles is more convenient as pixels may be written to immediately.
- Any update to fonts previously required backend specific calls to re-upload the texture, and said calls were not portable across backends. It is now possible to scale fonts etc. in a way that doesn't require you to make backend-specific calls.
- It is possible to plug a custom loader/backend to any font source.

View File

@@ -249,7 +249,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- font: finish CustomRectRegister() to allow mapping Unicode codepoint to custom texture data
- font: remove ID from CustomRect registration, it seems unnecessary!
- font: make it easier to submit own bitmap font (same texture, another texture?). (#2127, #2575)
- font: PushFontSize API (#1018)
- font: MemoryTTF taking ownership confusing/not obvious, maybe default should be opposite?
- font: storing MinAdvanceX per font would allow us to skip calculating line width (under a threshold of character count) in loops looking for block width
- font/demo: add tools to show glyphs used by a text blob, display U16 value, list missing glyphs.