diff options
author | frosch <frosch@openttd.org> | 2021-11-13 21:01:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-13 21:01:16 +0100 |
commit | 5f6303f985928d8fe2a9f75b80a32c9564b88fd6 (patch) | |
tree | 1d00770d50eaecf76d073a9f0b0a932e93a1716c | |
parent | f8efab4653b195de2a16c331a90d56c0d8ccaa03 (diff) | |
download | openttd-5f6303f985928d8fe2a9f75b80a32c9564b88fd6.tar.xz |
Fix: don't complain when the sprite font is missing glyphs. (#9692)
Silently auto-pick a suitable font.
-rw-r--r-- | src/strings.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 7ff1cee31..bfbde9b0d 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -2116,6 +2116,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher) if (bad_font) { /* We found an unprintable character... lets try whether we can find * a fallback font that can print the characters in the current language. */ + bool any_font_configured = !_freetype.medium.font.empty(); FreeTypeSettings backup = _freetype; _freetype.mono.os_handle = nullptr; @@ -2125,10 +2126,10 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher) _freetype = backup; - if (!bad_font) { - /* Show that we loaded fallback font. To do this properly we have - * to set the colour of the string, otherwise we end up with a lot - * of artifacts.* The colour 'character' might change in the + if (!bad_font && any_font_configured) { + /* If the user configured a bad font, and we found a better one, + * show that we loaded the better font instead of the configured one. + * The colour 'character' might change in the * future, so for safety we just Utf8 Encode it into the string, * which takes exactly three characters, so it replaces the "XXX" * with the colour marker. */ |