Skip to content

Use mainui's truetype font rendering for on screen text - #2577

Open
54ac wants to merge 13 commits into
FWGS:masterfrom
54ac:truetype-fonts
Open

Use mainui's truetype font rendering for on screen text#2577
54ac wants to merge 13 commits into
FWGS:masterfrom
54ac:truetype-fonts

Conversation

@54ac

@54ac 54ac commented May 1, 2026

Copy link
Copy Markdown

This adds hud_truetype and hud_truetype_size cvars which allow for rendering CenterPrint text using mainui's truetype stack since currently the text looks horrendous in higher resolutions, especially with gl_nearest. Tested on Windows. Equivalent PR in mainui_cpp repo.

I'm not particularly proficient in C so let me know if there are any obvious pitfalls or possible improvements.

Comparison:

@a1batross

a1batross commented May 2, 2026

Copy link
Copy Markdown
Member

It shouldn't go through mainui. Engine by itself should provide, not consume.

I have branch with font rendering completely in the engine. But it's far from completion, and thus is private.

@54ac

54ac commented May 2, 2026

Copy link
Copy Markdown
Author

Thanks for your comment. What would be the alternative, moving truetype font rendering to the engine and then mainui would consume from that?

@a1batross

Copy link
Copy Markdown
Member

Truetype renderer must be completely in engine. Making mainui the consumer must be a separate task.

In my branch only console font renderer is hooked to the truetype renderer and it only pre-renderers latin symbols, without adding up unknown glyphs.

_shot0000

@54ac

54ac commented May 2, 2026

Copy link
Copy Markdown
Author

Looks good. I might look into how viable a lift and shift would be when I have some time.

@mittorn

mittorn commented May 2, 2026 via email

Copy link
Copy Markdown
Member

@a1batross

a1batross commented May 2, 2026 via email

Copy link
Copy Markdown
Member

@54ac

54ac commented May 13, 2026

Copy link
Copy Markdown
Author

I've been steadily tinkering with this mostly on the weekends and it seems to be working pretty well so far. Mostly simply copied from mainui, though I had to do some random guesswork to get the characters to render right so there are probably some possible optimizations there.

@54ac
54ac force-pushed the truetype-fonts branch from ab555e3 to 131fe91 Compare July 26, 2026 23:27
@54ac
54ac force-pushed the truetype-fonts branch from 131fe91 to 34eccde Compare July 27, 2026 09:51
@54ac

54ac commented Aug 1, 2026

Copy link
Copy Markdown
Author

@a1batross got back to this after some time, I assume there's oversights/missed optimizations due to my inexperience with C/C++ but seems to be working fine (font rendering moved to engine, console/centerprint rendered with TTF). Any further suggestions/issues you can see?

@a1batross

Copy link
Copy Markdown
Member

I still disagree with the font renderering being driven by game-developer-facing DLL. It's cool to reuse code, but the dependency must be flipped as it's engine who provides.

@54ac

54ac commented Aug 2, 2026

Copy link
Copy Markdown
Author

That's basically what happens now in this PR, the engine now handles everything and exposes ttf_funcs_t, TTF_GetFuncs. I guess one more refactor would be to get rid of miniutl from the engine. Then in the mainui PR I can refactor it to be the consumer.

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.

3 participants