Merge branch 'master' into docking

This commit is contained in:
ocornut
2025-06-24 19:10:26 +02:00
9 changed files with 58 additions and 70 deletions

View File

@@ -73,17 +73,22 @@ Breaking changes:
Platform_GetWindowFramebufferScale() handler in 'docking' branch.
- Fonts: **IMPORTANT** on Font Sizing:
- Before 1.92, fonts were of a single size. They can now be dynamically sized.
- PushFont() API now has an optional size parameter. PushFontSize() was also added.
void PushFont(ImFont* font) --> void PushFont(ImFont* font, float size = 0.0f);
- Before 1.92: ImGui::PushFont() always used font "default" size specified in AddFont() call.
- Since 1.92: ImGui::PushFont() preserve the current font size which is a shared value.
- 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).
- PushFont() API now has a REQUIRED size parameter.
void PushFont(ImFont* font) --> void PushFont(ImFont* font, float size);
- PushFont(font, 0.0f) // Change font and keep current size
- PushFont(NULL, 20.0f) // Keep font and change current size
- 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.
We intentionally didn't add a default parameter because it would make the long-term
transition more difficult.
- Kept inline redirection font. Will obsolete.
- External scale factors may be applied over the provided size.
This is why it is called 'FontSizeBase' in the style structure.
- 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".
- Removed support for old PushFont(NULL) which was a shortcut for "revert to 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
@@ -142,7 +147,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, ....);
@@ -182,8 +187,8 @@ Breaking changes:
- renamed ImGuiFreeType::GetBuilderForFreeType() to ImGuiFreeType::GetFontLoader()
- old: io.Fonts->FontBuilderIO = ImGuiFreeType::GetBuilderForFreeType()
- new: io.Fonts.FontLoader = ImGuiFreeType::GetFontLoader();
- DrawList: Fixed a regression from 1.91.1 where a Begin()/PushFont()/AddImage() sequence
would not restore the correct atlas Texture Identifier when the PushFont() call used
- DrawList: Fixed a regression from 1.91.1 where a Begin()/PushFont()/AddImage() sequence
would not restore the correct atlas Texture Identifier when the PushFont() call used
a font from a different atlas. (#8694, caused by #3224, #3875, #6398, #7903)
- DrawList: Renamed ImDrawList::PushTextureID()/PopTextureID() to PushTexture()/PopTexture().
- Fonts: (users of custom rectangles)
@@ -265,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.
@@ -286,8 +290,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.
@@ -335,7 +337,7 @@ Other changes:
one in docking (they accidentally diverged). (#8554)
- Windows: BeginChild(): fixed being unable to combine manual resize on one axis
and automatic resize on the other axis. (#8690)
e.g. neither ImGuiChildFlags_ResizeX | ImGuiChildFlags_AutoResizeY
e.g. neither ImGuiChildFlags_ResizeX | ImGuiChildFlags_AutoResizeY
or ImGuiChildFlags_ResizeY | ImGuiChildFlags_AutoResizeX worked before.
- TreeNode: added experimental flags to draw tree hierarchy outlines linking
parent and tree nodes: (#2920)
@@ -360,7 +362,7 @@ Other changes:
- TreeNode: fixed incorrect clipping of arrow/bullet when using ImGuiTreeNodeFlags_SpanAllColumns.
- InputText: fixed cursor positioning issue using up/down keys near end of lines while
editing non-ASCII text. (Regression from 1.91.2) (#8635, #7925)
- InputText: fixed a buffer overrun that could happen when using dynamically resizing
- InputText: fixed a buffer overrun that could happen when using dynamically resizing
buffers (e.g. imgui_stdlib.cpp for std::string, or ImGuiInputTextFlags_CallbackRezize)
and programmatically making an insertion. (#8689) [@ocornut, @m9710797]
- Tables: fixed TableHeader() eager vertical clipping of text which may be noticeable
@@ -448,6 +450,8 @@ Other changes:
memory ownership change. (#8530, #7801) [@Green-Sky]
- Backends: SDL3: honor ImGuiPlatformImeData->WantTextInput as an alternative
way to call SDL_StartTextInput(), without IME being necessarily visible. (#8584)
- Backends: SDL3: fixed pulling SDL_PROP_WINDOW_COCOA_WINDOW_POINTER into
viewport->PlatformHandleRaw. (#8725, #8726) [@eertbleyen]
- Backends: OSX: ImGui_ImplOSX_HandleEvent() only process event for window containing
our view. (#8644) [@BingoXuan]
- Examples:

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

@@ -277,7 +277,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.