summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-23 20:08:13 +0000
committerfrosch <frosch@openttd.org>2013-06-23 20:08:13 +0000
commit798f4725523e423c51513894bd2efe0fefeec55c (patch)
treee6f55e0a1c0f546513d588d437e7bdea88b30dc2
parentaa3c1068434f7ec22ffddec2d218037ff06bddd0 (diff)
downloadopenttd-798f4725523e423c51513894bd2efe0fefeec55c.tar.xz
(svn r25451) -Fix (r25445): Ini configuration for medium font was overwritten by front configuration of other sizes.
-rw-r--r--src/fontcache.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index ab044ae58..a49ea820c 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -284,16 +284,16 @@ FreeTypeFontCache::FreeTypeFontCache(FontSize fs, FT_Face face, int pixels) : Fo
*/
static void LoadFreeTypeFont(FontSize fs)
{
- FreeTypeSubSetting &settings = _freetype.medium;
+ FreeTypeSubSetting *settings = NULL;
switch (fs) {
default: NOT_REACHED();
- case FS_SMALL: settings = _freetype.small; break;
- case FS_NORMAL: settings = _freetype.medium; break;
- case FS_LARGE: settings = _freetype.large; break;
- case FS_MONO: settings = _freetype.mono; break;
+ case FS_SMALL: settings = &_freetype.small; break;
+ case FS_NORMAL: settings = &_freetype.medium; break;
+ case FS_LARGE: settings = &_freetype.large; break;
+ case FS_MONO: settings = &_freetype.mono; break;
}
- if (StrEmpty(settings.font)) return;
+ if (StrEmpty(settings->font)) return;
if (_library == NULL) {
if (FT_Init_FreeType(&_library) != FT_Err_Ok) {
@@ -305,12 +305,12 @@ static void LoadFreeTypeFont(FontSize fs)
}
FT_Face face = NULL;
- FT_Error error = FT_New_Face(_library, settings.font, 0, &face);
+ FT_Error error = FT_New_Face(_library, settings->font, 0, &face);
- if (error != FT_Err_Ok) error = GetFontByFaceName(settings.font, &face);
+ if (error != FT_Err_Ok) error = GetFontByFaceName(settings->font, &face);
if (error == FT_Err_Ok) {
- DEBUG(freetype, 2, "Requested '%s', using '%s %s'", settings.font, face->family_name, face->style_name);
+ DEBUG(freetype, 2, "Requested '%s', using '%s %s'", settings->font, face->family_name, face->style_name);
/* Attempt to select the unicode character map */
error = FT_Select_Charmap(face, ft_encoding_unicode);
@@ -340,11 +340,11 @@ static void LoadFreeTypeFont(FontSize fs)
FT_Done_Face(face);
static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" };
- ShowInfoF("Unable to use '%s' for %s font, FreeType reported error 0x%X, using sprite font instead", settings.font, SIZE_TO_NAME[fs], error);
+ ShowInfoF("Unable to use '%s' for %s font, FreeType reported error 0x%X, using sprite font instead", settings->font, SIZE_TO_NAME[fs], error);
return;
found_face:
- new FreeTypeFontCache(fs, face, settings.size);
+ new FreeTypeFontCache(fs, face, settings->size);
}