From de7625b8c25b07214a7ed6540d2225a1547c2231 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 28 Jun 2025 16:45:58 +0200 Subject: [PATCH] Docs: tweak/fixed comments. (#8750, #8749) --- docs/CHANGELOG.txt | 12 +++++------- docs/FONTS.md | 2 +- imgui.cpp | 9 ++++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 3bf28c689..b548fb657 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -117,13 +117,11 @@ Breaking changes: `PushFont(NULL, some_size)` now keeps current change and changes size. - 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 - for the first font input which the desired glyph. This is technically a different behavior - than before! - - e.g. If you are merging fonts you may have glyphs that you expected to load from - Font Source 2 which exists in Font Source 1. After the update and when using a new backend, - those glyphs may now loaded from Font Source 1! - - You can use `ImFontConfig::GlyphExcludeRanges[]` to specify ranges to ignore in given Input: + - When searching for a glyph in multiple merged fonts: we search for the FIRST font source + which contains the desired glyph. Because the user doesn't need to provide glyph ranges + any more, it is possible that a glyph that you expected to fetch from a secondary/merged + icon font may be erroneously fetched from the primary font. + - We added `ImFontConfig::GlyphExcludeRanges[]` to specify ranges to exclude from a given font source: // Add Font Source 1 but ignore ICON_MIN_FA..ICON_MAX_FA range static ImWchar exclude_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; ImFontConfig cfg1; diff --git a/docs/FONTS.md b/docs/FONTS.md index f8431507c..ce08f176d 100644 --- a/docs/FONTS.md +++ b/docs/FONTS.md @@ -387,7 +387,7 @@ io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\seguiemj.ttf", 16.0f, &cfg); ## Using Custom Glyph Ranges -🆕 **Since 1.92, with an up to date backend: specifying glyph ranges is necessary, so this is not needed.** +🆕 **Since 1.92, with an up to date backend: specifying glyph ranges is unnecessary. Therefore this is not really useful any more.** :rewind: You can use the `ImFontGlyphRangesBuilder` helper to create glyph ranges based on text input. For example: for a game where your script is known, if you can feed your entire script to it and only build the characters the game needs. ```cpp diff --git a/imgui.cpp b/imgui.cpp index acdbf33e4..8aaa901fc 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -416,9 +416,12 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures: - 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! - - e.g. If you are merging fonts you may have glyphs that you expected to load from Font Source 2 which exists in Font Source 1. After the update and when using a new backend, those glyphs may now loaded from Font Source 1! - - You can use `ImFontConfig::GlyphExcludeRanges[]` to specify ranges to ignore in given Input: + - When searching for a glyph in multiple merged fonts: we search for the FIRST font source which contains the desired glyph. + Because the user doesn't need to provide glyph ranges any more, it is possible that a glyph that you expected to fetch from a secondary/merged icon font may be erroneously fetched from the primary font. + - When searching for a glyph in multiple merged fonts: we now search for the FIRST font source which contains the desired glyph. This is technically a different behavior than before! + - e.g. If you are merging fonts you may have glyphs that you expected to load from Font Source 2 which exists in Font Source 1. + After the update and when using a new backend, those glyphs may now loaded from Font Source 1! + - We added `ImFontConfig::GlyphExcludeRanges[]` to specify ranges to exclude from a given font source: // Add Font Source 1 but ignore ICON_MIN_FA..ICON_MAX_FA range static ImWchar exclude_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; ImFontConfig cfg1;