Skip to content

Add pre-rasterized scaled GUI fonts (1.5x, 2x) - #86265

Merged
GuardianDll merged 1 commit into
CleverRaven:masterfrom
dobbry-vechur:feature/imgui-scaled-fonts
Apr 5, 2026
Merged

GuardianDll merged 1 commit into
CleverRaven:masterfrom
dobbry-vechur:feature/imgui-scaled-fonts

Conversation

@dobbry-vechur

@dobbry-vechur dobbry-vechur commented Apr 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Interface "Add pre-rasterized scaled ImGui fonts instead of bitmap scaling"

Purpose of change

SetWindowFontScale() is marked [OBSOLETE] in ImGui. It stretches bitmap glyphs and produces blurry text. The crafting GUI uses it at 1.4x for the recipe title.

Describe the solution

Load the GUI font into the atlas at 1.5x and 2x fontheight during load_fonts(). Add PushGuiFont1_5x() and PushGuiFont2x() helpers. Replace SetWindowFontScale(1.4f) in the crafting GUI with PushGuiFont1_5x().

Describe alternatives you've considered

Keep using SetWindowFontScale(). It works but the text is blurry and the API is obsolete.

Testing

Opened crafting GUI, recipe title renders without blur at the larger size.
Pre:
image

Post:
image

Additional context

Extra atlas entries add some texture memory proportional to glyph count and size. Mostly relevant for CJK languages, negligible for Latin.

@github-actions github-actions Bot added Info / User Interface Game - player communication, menus, etc. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Apr 5, 2026
- Add font_size parameter to load_font(), load GUI font at 1.5x and 2x
  into the atlas alongside the regular gui and mono fonts
- Expose PushGuiFont1_5x() and PushGuiFont2x() helpers in cata_imgui.h
- Replace SetWindowFontScale(1.4f) in crafting GUI with PushGuiFont1_5x()
  for crisp text instead of blurry bitmap scaling
- Loop over all fonts for fallback callbacks and validation
@dobbry-vechur
dobbry-vechur force-pushed the feature/imgui-scaled-fonts branch from 2543a8d to 4958b7e Compare April 5, 2026 11:39
@GuardianDll
GuardianDll merged commit 9681c8f into CleverRaven:master Apr 5, 2026
31 checks passed
@github-actions github-actions Bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 5, 2026
@dobbry-vechur
dobbry-vechur deleted the feature/imgui-scaled-fonts branch May 25, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants