diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 639b23e4e5..84586b1c1c 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -252,5 +252,5 @@ void UninitFontCache() #if !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA) -bool SetFallbackFont(FontCacheSettings *, const std::string &, int, MissingGlyphSearcher *) { return false; } +bool SetFallbackFont(FontCacheSettings *, const std::string &, MissingGlyphSearcher *) { return false; } #endif /* !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA) */ diff --git a/src/fontdetection.h b/src/fontdetection.h index 2a316da505..c6083878b3 100644 --- a/src/fontdetection.h +++ b/src/fontdetection.h @@ -33,10 +33,9 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face); * This function must set all fonts of settings. * @param settings the settings to overwrite the fontname of. * @param language_isocode the language, e.g. en_GB. - * @param winlangid the language ID windows style. * @param callback The function to call to check for missing glyphs. * @return true if a font has been set, false otherwise. */ -bool SetFallbackFont(struct FontCacheSettings *settings, const std::string &language_isocode, int winlangid, class MissingGlyphSearcher *callback); +bool SetFallbackFont(struct FontCacheSettings *settings, const std::string &language_isocode, class MissingGlyphSearcher *callback); #endif diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp index 5d8b79e1be..5ec493fa51 100644 --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -24,7 +24,7 @@ #include "safeguards.h" -bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int, MissingGlyphSearcher *callback) +bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, MissingGlyphSearcher *callback) { /* Determine fallback font using CoreText. This uses the language isocode * to find a suitable font. CoreText is available from 10.5 onwards. */ diff --git a/src/os/unix/font_unix.cpp b/src/os/unix/font_unix.cpp index 6ab1d99823..207c248f98 100644 --- a/src/os/unix/font_unix.cpp +++ b/src/os/unix/font_unix.cpp @@ -98,7 +98,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) return err; } -bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int, MissingGlyphSearcher *callback) +bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, MissingGlyphSearcher *callback) { bool ret = false; diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index c0ae666bee..c10404d74f 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -86,13 +86,14 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT return 0; // stop enumerating } -bool SetFallbackFont(FontCacheSettings *settings, const std::string &, int winlangid, MissingGlyphSearcher *callback) +bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, MissingGlyphSearcher *callback) { Debug(fontcache, 1, "Trying fallback fonts"); EFCParam langInfo; - if (GetLocaleInfo(MAKELCID(winlangid, SORT_DEFAULT), LOCALE_FONTSIGNATURE, (LPTSTR)&langInfo.locale, sizeof(langInfo.locale) / sizeof(wchar_t)) == 0) { - /* Invalid langid or some other mysterious error, can't determine fallback font. */ - Debug(fontcache, 1, "Can't get locale info for fallback font (langid=0x{:x})", winlangid); + std::wstring lang = OTTD2FS(language_isocode.substr(0, language_isocode.find('_'))); + if (GetLocaleInfoEx(lang.c_str(), LOCALE_FONTSIGNATURE, reinterpret_cast(&langInfo.locale), sizeof(langInfo.locale) / sizeof(wchar_t)) == 0) { + /* Invalid isocode or some other mysterious error, can't determine fallback font. */ + Debug(fontcache, 1, "Can't get locale info for fallback font (isocode={})", language_isocode); return false; } langInfo.settings = settings; diff --git a/src/stdafx.h b/src/stdafx.h index c0c58f865c..3629e85ff3 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -11,12 +11,9 @@ #define STDAFX_H #if defined(_WIN32) - /* MinGW defaults to Windows 7 if none of these are set, and they must be set before any MinGW header is included */ -# define NTDDI_VERSION NTDDI_WINXP // Windows XP -# define _WIN32_WINNT 0x501 // Windows XP -# define _WIN32_WINDOWS 0x501 // Windows XP -# define WINVER 0x0501 // Windows XP -# define _WIN32_IE_ 0x0600 // 6.0 (XP+) + /* Minimum supported version is Windows 7. */ +# define NTDDI_VERSION NTDDI_WIN7 +# define _WIN32_WINNT _WIN32_WINNT_WIN7 #endif #ifdef _MSC_VER diff --git a/src/strings.cpp b/src/strings.cpp index d58f41fc8b..b87790ff54 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -2297,7 +2297,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher) _fcsettings.mono.os_handle = nullptr; _fcsettings.medium.os_handle = nullptr; - bad_font = !SetFallbackFont(&_fcsettings, _langpack.langpack->isocode, _langpack.langpack->winlangid, searcher); + bad_font = !SetFallbackFont(&_fcsettings, _langpack.langpack->isocode, searcher); _fcsettings = backup;