Skip to content

Feature: use fonts generated from TTF Files#879

Open
River-Salmon wants to merge 152 commits into
UZDoom:trunkfrom
River-Salmon:dynamic-font-rendering
Open

Feature: use fonts generated from TTF Files#879
River-Salmon wants to merge 152 commits into
UZDoom:trunkfrom
River-Salmon:dynamic-font-rendering

Conversation

@River-Salmon
Copy link
Copy Markdown
Contributor

@River-Salmon River-Salmon commented Jan 7, 2026

Description

Features:
Adds capability of rendering bitmap fonts rendered from ttf files.
Adds user options for font overrides, remappings, and preferences.
Font API for semantic font choice (ex: Font.GetSmallTextFont() rather than using NewSmallFont directly)

Primary use cases:
Accessibility: fonts like Atkinson Hyperlegible are substantially easier to read for some users.
Customization / modding: making it easier to control the presentation of text in UZDoom.

What this does NOT do:
-Pixel-perfect vector rendering of fonts: The fonts generate a bitmap atlas at startup.

Third party dependencies:
-FreeType
-Harfbuzz
-Trex
-simdutf
-stb_image_write
-Included font files

Checklist

ucosty and others added 30 commits November 17, 2025 12:46
This update configures cmake to instruct the compiler to use the C++23
standard. Most of the code was already compliant, but some changes to
the range_map library were required to get it to compile on C++20 and
later.

Specifically, I removed the use of `allocator::rebind` which has been
deprecated, and instead use `std::allocator_traits`. I also implemented
a small number of code changes to make the compiler a little happier,
though there is still plenty of scope to clean the code up more.
Cleans up the clang warning
```
Clangd: Implicit capture of 'this' with a capture default of '=' is deprecated
```
… type

expand-and-fix for ZoneVector<>

manual expand-and-fix for asmjit  ZoneList<> ctors

include deleting move ctor is 'asmjit noncopyable'

removed __VA_ARGS__ from asmjit ctor deletes

We do not actually use the VA ARGS functionality, and GCC is not accepting the resulting syntax. Also see https://stackoverflow.com/questions/5588855/standard-alternative-to-gccs-va-args-trick for how GCC and other compilers disagree on how to handle VA ARGS
-This was causing a parsing error on GCC when using c++20.
-Instead, we can omit the template arguments since they do not need to be specified if the arguments are the same on both sides of the ctors.
-uses trex to line up glyphs and render them
-FFont uses Trex's spacing information that makes alignment stuff mostly "just work"
-added a very important comment to indicate that the src settings for texture rects are in 0-1 space
When we cannot render a string using the provided font, fallback to Noto Sans.
-The desired fallback font is selected when Language is changed
-IBM Plex fonts are used for fallbacks as they are stylistically not too far from Lexend Deca and have good character support.
-virtual scale is ignored when using Dynamic Fonts
-text is still really really small.. to be continued
-This is meant to really properly handle the text scaling. It takes into account the source subrect of the texture when determining virtual coordinates.
-Appears to work on the non-Normal resolution scaling modes.
-doesn't seem to work in the big text menus.
-allows for the removal of many hacks.
Comment thread wadsrc/static/fonts/dynamic/New Text Document.txt Outdated
@River-Salmon
Copy link
Copy Markdown
Contributor Author

River-Salmon commented Mar 28, 2026 via email

@the-phinet
Copy link
Copy Markdown
Member

What does this file do?

Nothing. I'll remove it

No, keep it. It might be important 😂

-SymbolsFont is now a duplicate of the ConFont, but with post fixup.
-TODO: the color theming for the sliders is not working
@River-Salmon
Copy link
Copy Markdown
Contributor Author

For those following this; a fairly recent build off this PR is available on the Experimental Releases. Please give it a shake and post feedback!

@giwake
Copy link
Copy Markdown

giwake commented Apr 4, 2026

gave this a go, so far it's really promising!

some small bugs/thoughts:

the console cursor seems to have a small 1px(?) space after hitting the spacebar, which then expands to a proper sized space when another character is added afterwards. this doesn't happen in the chat text input. it's particularly visible after "brown" and "dog" in this clip. this is a little disorienting and made me think i didn't hit the spacebar.

uzdoomfontjumping

additionally it appears that having something like cleartype or font smoothing turned on or off in windows applies it in uzdoom. you can see how the text in the gif above looks weird because i have cleartype and font smoothing turned off (personal preference) struckthrough - cleartype/font smoothing doesn't seem to actually cause this bug? strange...
the console cursor bug happens regardless of if cleartype/font smoothing is enabled.

i don't know the intricacies of TTF rendering but i think it would be neat to have the ability to enable/disable font smoothing within uzdoom for modders/devs, what with doom being retro and all. some fonts (my goto being any of microsoft's old "core fonts for web") look particularly nice with it disabled.

i'm pretty excited for this especially because i could no longer have to faff around with trying to import comic sans in a roundabout way.

@the-phinet
Copy link
Copy Markdown
Member

Minor issue with non-ttf rendering: Listmenu is colourless sometimes and the cursor is off-centre

Screencast_20260416_215344.webm

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants