summaryrefslogtreecommitdiff
path: root/src/fontcache.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-19 21:02:37 +0000
committerrubidium <rubidium@openttd.org>2011-11-19 21:02:37 +0000
commit4e1c4f90794eac4d63a08da41e75427950a50929 (patch)
tree51bbd7d840fbb14cb00e50b52f8dcf4d5f3d3eee /src/fontcache.cpp
parent02bff061f85f68bc6ad35e5777b3bf6b0ecedb5e (diff)
downloadopenttd-4e1c4f90794eac4d63a08da41e75427950a50929.tar.xz
(svn r23267) -Codechange: unify the font name setting of the font cache
Diffstat (limited to 'src/fontcache.cpp')
-rw-r--r--src/fontcache.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 255589943..4cdd11132 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -347,9 +347,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
if (!found) return 1;
- strecpy(info->settings->small_font, font_name, lastof(info->settings->small_font));
- strecpy(info->settings->medium_font, font_name, lastof(info->settings->medium_font));
- strecpy(info->settings->large_font, font_name, lastof(info->settings->large_font));
+ callback->SetFontNames(info->settings, font_name);
if (info->callback->FindMissingGlyphs(NULL)) return 1;
DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name);
return 0; // stop enumerating
@@ -487,9 +485,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
strncmp(name, "GB18030 Bitmap", 14) == 0) continue;
/* Save result. */
- strecpy(settings->small_font, name, lastof(settings->small_font));
- strecpy(settings->medium_font, name, lastof(settings->medium_font));
- strecpy(settings->large_font, name, lastof(settings->large_font));
+ callback->SetFontNames(settings, name);
DEBUG(freetype, 2, "CT-Font for %s: %s", language_isocode, name);
result = true;
break;
@@ -574,9 +570,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
name[act_len > 127 ? 127 : act_len] = '\0';
/* Save Result. */
- strecpy(settings->small_font, name, lastof(settings->small_font));
- strecpy(settings->medium_font, name, lastof(settings->medium_font));
- strecpy(settings->large_font, name, lastof(settings->large_font));
+ callback->SetFontNames(settings, name);
DEBUG(freetype, 2, "ATSUI-Font for %s: %s", language_isocode, name);
result = true;
}
@@ -598,9 +592,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
/* Init FreeType if needed. */
if ((ft_init || FT_Init_FreeType(&_library) == FT_Err_Ok) && GetFontByFaceName("Arial Unicode MS", &face) == FT_Err_Ok) {
FT_Done_Face(face);
- strecpy(settings->small_font, "Arial Unicode MS", lastof(settings->small_font));
- strecpy(settings->medium_font, "Arial Unicode MS", lastof(settings->medium_font));
- strecpy(settings->large_font, "Arial Unicode MS", lastof(settings->large_font));
+ callback->SetFontNames(settings, "Arial Unicode MS");
DEBUG(freetype, 1, "Replacing font 'Geeza Pro' with 'Arial Unicode MS'");
}
if (!ft_init) {
@@ -719,9 +711,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
continue;
}
- strecpy(settings->small_font, (const char*)file, lastof(settings->small_font));
- strecpy(settings->medium_font, (const char*)file, lastof(settings->medium_font));
- strecpy(settings->large_font, (const char*)file, lastof(settings->large_font));
+ callback->SetFontNames(settings, (const char*)file);
bool missing = callback->FindMissingGlyphs(NULL);
DEBUG(freetype, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no");