Merge branch 'master' into jgrpp-nrt

# Conflicts:
#	src/fontcache.cpp
#	src/game/game_text.cpp
#	src/lang/korean.txt
#	src/os/macosx/crashlog_osx.cpp
#	src/os/windows/crashlog_win.cpp
#	src/station_cmd.cpp
#	src/viewport.cpp
This commit is contained in:
Jonathan G Rennison
2019-07-11 20:03:23 +01:00
118 changed files with 2968 additions and 1235 deletions

View File

@@ -2329,13 +2329,18 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
return false;
}
void SetFontNames(FreeTypeSettings *settings, const char *font_name) override
void SetFontNames(FreeTypeSettings *settings, const char *font_name, const void *os_data) override
{
#ifdef WITH_FREETYPE
#if defined(WITH_FREETYPE) || defined(_WIN32)
strecpy(settings->small.font, font_name, lastof(settings->small.font));
strecpy(settings->medium.font, font_name, lastof(settings->medium.font));
strecpy(settings->large.font, font_name, lastof(settings->large.font));
#endif /* WITH_FREETYPE */
free(settings->medium.os_handle); // Only free one, they are all the same pointer.
settings->small.os_handle = os_data;
settings->medium.os_handle = os_data;
settings->large.os_handle = os_data;
#endif
}
};
@@ -2357,15 +2362,21 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
static LanguagePackGlyphSearcher pack_searcher;
if (searcher == nullptr) searcher = &pack_searcher;
bool bad_font = !base_font || searcher->FindMissingGlyphs(nullptr);
#ifdef WITH_FREETYPE
#if defined(WITH_FREETYPE) || defined(_WIN32)
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. */
FreeTypeSettings backup;
memcpy(&backup, &_freetype, sizeof(backup));
_freetype.mono.os_handle = nullptr;
_freetype.medium.os_handle = nullptr;
bad_font = !SetFallbackFont(&_freetype, _langpack->isocode, _langpack->winlangid, searcher);
free(_freetype.mono.os_handle);
free(_freetype.medium.os_handle);
memcpy(&_freetype, &backup, sizeof(backup));
if (bad_font && base_font) {