AddFontDefault() uses implicit ref size. Passing an explicit size (13.0f) to
AddFontFromFileTTF() in MergeMode triggers the assertion because the two fonts
use different ref size conventions. Pass 0.0f instead so both fonts share the
same implicit ref size and scale together with style.FontSizeBase.
In v1.92+ with an updated backend, glyph ranges are handled dynamically
and do not need to be specified. Remove GetGlyphRangesChineseSimplifiedCommon(),
the zh_label_ranges English stub, and the explicit SizePixels on AddFontDefault()
that was added to work around the ImplicitRefSize assertion. Use plain
MergeMode instead.
misc/ already hosts optional supplemental modules (cpp/imgui_stdlib,
freetype/, fonts/). i18n fits the same pattern: opt-in, not part of
the core library. Update all include paths, Makefile, Xcode project
and README accordingly.
- Do not translate 'Hello, world!' (universally recognized programming example)
- Do not translate 'This is some useful text.' (standard example boilerplate)
- Do not translate 'float' / 'counter = %d' (C++ type/variable labels)
- Keep 'blah blah blah' as-is (intentional nonsense filler, not real content)
- Keep 'dear imgui' brand name untranslated in greeting message
- Fix 'Another bullet point' -> 正确翻译为项目符号而非叶节点
- Fix 'Metrics/Debugger' -> 指标/调试器 (Metrics = indicators, not performance)
- Remove redundant identity entries for API function names (IsItemXxx etc.)
- Wrap RebuildFonts(), g_need_font_rebuild, and font rebuild calls in
#ifdef IMGUI_DEMO_ENABLE_I18N so main.mm compiles cleanly without i18n
- Include imgui_i18n.h unconditionally (provides no-op Tr() stub when
IMGUI_DEMO_ENABLE_I18N is not defined, enabling Tr() in the demo window)
- Remove IMGUI_DEMO_ENABLE_I18N and i18n sources from iOS Xcode target
(untested on iOS; macOS-only system font paths would not work on device)
Add imgui_i18n.cpp and locale/zh_CN.cpp to both iOS and macOS targets.
Set IMGUI_DEMO_ENABLE_I18N=1 in GCC_PREPROCESSOR_DEFINITIONS for all
four build configurations (iOS/macOS × Debug/Release).
- imgui_demo.cpp: wrap all user-visible string literals with Tr(); add
Language menu in DemoWindowMenuBar (guarded by IMGUI_DEMO_ENABLE_I18N);
guard extern g_need_font_rebuild with IMGUI_DEMO_ENABLE_I18N + __APPLE__
- examples/example_apple_metal/main.mm: CJK font loading via RebuildFonts()
(always loads 2-glyph stub in English, full range in zh_CN); Language menu
triggers font atlas rebuild before next NewFrame(); wrap demo window strings
with Tr(); fix v1.92 ImplicitRefSize assertion by passing explicit SizePixels
to AddFontDefault()
- examples/example_apple_metal/Makefile: add i18n sources and
-DIMGUI_DEMO_ENABLE_I18N flag
- in Firefox, scrollbar would appear => adding overflow: hidden fixes this issue
- when the canvas has the focus, Chrome draws a very small blue outline, setting it to none fixes this issue
- This commit removes the option of using -sUSE_WEBGPU=1 from CMake and make
- Compiling with a version of Emscripten >= 4.0.10 will work the same way as it was before
- Compiling with a version of Emscripten < 4.0.10 will print an error message and abort the build (in the case of CMake)
- Since there can only be 1 implementation for the backend in the case of Emscripten, this commit cleans the code accordingly
Without tabindex, the canvas element is not focusable in the DOM, so pongasoft/emscripten-glfw's focus/blur listeners on the canvas
never fire. This means glfwSetWindowFocusCallback is never called etc.
Ref: https://github.com/pongasoft/emscripten-glfw/issues/29