summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-20 11:52:11 +0000
committerrubidium <rubidium@openttd.org>2011-11-20 11:52:11 +0000
commit0a4a75b0afbeeab6be1eb7ccfd03ef603a4646b9 (patch)
treee715f7238d2685980dd5fd352505346504eb9783 /src/strings.cpp
parent2075bc702c673067113dc127a7d3dca91eb13ffa (diff)
downloadopenttd-0a4a75b0afbeeab6be1eb7ccfd03ef603a4646b9.tar.xz
(svn r23273) -Codechange: allow passing a MissingGlyphSearcher to CheckForMissingGlyphs (default to the language pack strings)
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index 3054dcdaf..dd549bdfc 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -1833,11 +1833,14 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
* font, which is the whole reason this check has
* been added.
* @param base_font Whether to look at the base font as well.
+ * @param searcher The methods to use to search for strings to check.
+ * If NULL the loaded language pack searcher is used.
*/
-void CheckForMissingGlyphsInLoadedLanguagePack(bool base_font)
+void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
{
- LanguagePackGlyphSearcher searcher;
- bool bad_font = !base_font || searcher.FindMissingGlyphs(NULL);
+ static LanguagePackGlyphSearcher pack_searcher;
+ if (searcher == NULL) searcher = &pack_searcher;
+ bool bad_font = !base_font || searcher->FindMissingGlyphs(NULL);
#ifdef WITH_FREETYPE
if (bad_font) {
/* We found an unprintable character... lets try whether we can find
@@ -1845,7 +1848,7 @@ void CheckForMissingGlyphsInLoadedLanguagePack(bool base_font)
FreeTypeSettings backup;
memcpy(&backup, &_freetype, sizeof(backup));
- bad_font = !SetFallbackFont(&_freetype, _langpack->isocode, _langpack->winlangid, &searcher);
+ bad_font = !SetFallbackFont(&_freetype, _langpack->isocode, _langpack->winlangid, searcher);
memcpy(&_freetype, &backup, sizeof(backup));