Skip to content

Dynamic font loading#2190

Draft
vkedwardli wants to merge 11 commits intoflyinghead:devfrom
vkedwardli:feat-imgui-dynamic-font
Draft

Dynamic font loading#2190
vkedwardli wants to merge 11 commits intoflyinghead:devfrom
vkedwardli:feat-imgui-dynamic-font

Conversation

@vkedwardli
Copy link
Collaborator

@vkedwardli vkedwardli commented Jan 6, 2026

  • Update all rendering backends based on imgui v1.92.5
    • OpenGL: Reorganized function calling tree, but keeping our original usage of glcache, this one deviates from upstream the most.
    • DX9, DX11: Using upstream version but keeping pointSampler for VMU stuff + XXX_BORDER drawing for non-rectangular texture
    • Vulkan: Using upstream version directly

For dynamic font loading, we are now:

  • registering all fonts into a list
  • Pan-CJK fonts has the highest priority
  • Language specific font matching user's locale has the second priority
  • Only 1 font would be loaded for each language
  • If Pan-CJK font is loaded, all C/J/K fonts are skipped
  • Removed the glyph range completely

Checklist:

  • Verify OpenGL

    • Windows
    • macOS
    • Linux
    • Android
  • Verify DirectX 9

  • Verify DirectX 11

  • Verify Vulkan

    • Windows
    • macOS
    • Linux
    • Android
  • Verify nearest-point sampling

  • Verify non-rectangular texture

  • Optimize font size

    • Windows
    • macOS
    • Linux
    • Android
  • Emoji

    • Windows
    • macOS
    • Linux
    • Android

@vkedwardli vkedwardli force-pushed the feat-imgui-dynamic-font branch from 080b322 to 8f91347 Compare March 23, 2026 07:09
@vkedwardli
Copy link
Collaborator Author

vkedwardli commented Mar 23, 2026

  • Removed static from the locale string in registerFont
  • A UI Language picker
  • Added Bold Font Weight
  • Improved CJK Fallback Logic
    • Pan-CJK fonts
    • Fonts specifically matching the user's current locale
    • Other available language fonts
    • Generic fallback fonts
  • Supports multiple paths per font entry for Linux
  • Emoji support
  • Merged fonts are fine tuned with size and offsetY, so they looks good with Roboto
  • Wait for C++20 #2275 so we can remove the temp fix

with the current state, we can now call PushFont(NULL, new_size) to change any size for our regular font, and call PushFont(boldFont, new_size) to change to bold at any time.

This draft currently didn't touch any other part, so ImGui::PushFont(largeFont); are still being used

@vkedwardli vkedwardli force-pushed the feat-imgui-dynamic-font branch from 8f91347 to 2051805 Compare March 24, 2026 18:06
@vkedwardli vkedwardli mentioned this pull request Mar 24, 2026
@vkedwardli
Copy link
Collaborator Author

uiLargeFontSize() + boldFont
image

uiLargeFontSize() and regular
image

@vkedwardli vkedwardli force-pushed the feat-imgui-dynamic-font branch from f144b16 to 5ac0b9c Compare March 25, 2026 08:35
@vkedwardli
Copy link
Collaborator Author

Reject COLRv1 font so that emoji support will be fallback to Font Awesome (latest Fedora and possibly some Androids)

screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants