Merge branch 'master' into jgrpp

# Conflicts:
#	src/fontcache.cpp
#	src/openttd.cpp
#	src/os/macosx/font_osx.cpp
#	src/os/unix/font_unix.cpp
#	src/os/windows/font_win32.cpp
#	src/strings.cpp
This commit is contained in:
Jonathan G Rennison
2022-10-03 20:32:26 +01:00
48 changed files with 897 additions and 828 deletions

View File

@@ -2400,7 +2400,7 @@ const char *GetCurrentLanguageIsoCode()
*/
bool MissingGlyphSearcher::FindMissingGlyphs()
{
InitFreeType(this->Monospace());
InitFontCache(this->Monospace());
const Sprite *question_mark[FS_END];
for (FontSize size = this->Monospace() ? FS_MONO : FS_BEGIN; size < (this->Monospace() ? FS_END : FS_MONO); size++) {
@@ -2425,7 +2425,7 @@ bool MissingGlyphSearcher::FindMissingGlyphs()
default: NOT_REACHED();
}
DEBUG(freetype, 0, "Font is missing glyphs to display char 0x%X in %s font size", c, size_name.c_str());
DEBUG(fontcache, 0, "Font is missing glyphs to display char 0x%X in %s font size", c, size_name.c_str());
return true;
}
}
@@ -2469,7 +2469,7 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
return false;
}
void SetFontNames(FreeTypeSettings *settings, const char *font_name, const void *os_data) override
void SetFontNames(FontCacheSettings *settings, const char *font_name, const void *os_data) override
{
#if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA)
settings->small.font = font_name;
@@ -2505,15 +2505,15 @@ 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;
bool any_font_configured = !_fcsettings.medium.font.empty();
FontCacheSettings backup = _fcsettings;
_freetype.mono.os_handle = nullptr;
_freetype.medium.os_handle = nullptr;
_fcsettings.mono.os_handle = nullptr;
_fcsettings.medium.os_handle = nullptr;
bad_font = !SetFallbackFont(&_freetype, _langpack.langpack->isocode, _langpack.langpack->winlangid, searcher);
bad_font = !SetFallbackFont(&_fcsettings, _langpack.langpack->isocode, _langpack.langpack->winlangid, searcher);
_freetype = backup;
_fcsettings = backup;
if (!bad_font && any_font_configured) {
/* If the user configured a bad font, and we found a better one,
@@ -2532,7 +2532,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
/* Our fallback font does miss characters too, so keep the
* user chosen font as that is more likely to be any good than
* the wild guess we made */
InitFreeType(searcher->Monospace());
InitFontCache(searcher->Monospace());
}
}
#endif