Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup: Seperate platform-specific code for font handling. #8666

merged 5 commits into from Feb 13, 2021


Copy link

@michicc michicc commented Feb 13, 2021

Motivation / Problem

A lot of platform-specific code for font handling is mashed into two files with lots of #ifdefs sprinkled around. Separating it makes for more readable code.


OS-specific code is moved into files in the various OS directories. As Fontconfig is only used for Unix-oid systems, it's implementation is moved into os/unix. FreeType code stays in the normal fontcache.cpp file.


The current code is quite complicated with how stuff like settings globals are enabled/disabled. This PR simplifies this by always enabling them no matter if TrueType fonts are actually used.

In the best case, the compiler/linker will just strip them out, in the worst case the binaries gets a few bytes larger than needed.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')
Copy link

@TrueBrain TrueBrain left a comment

LGTM; I am sure people will complain when you broke it, and I am sure you will fix it. So .. YOLO!

@michicc michicc merged commit 63ed3f3 into OpenTTD:master Feb 13, 2021
9 checks passed
@michicc michicc deleted the pr/split_font branch Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants