From 5793f78b16000fb8e7fce6ecb3bedb6c3acc5cb8 Mon Sep 17 00:00:00 2001 From: glx Date: Wed, 18 Mar 2009 00:51:44 +0000 Subject: (svn r15757) -Fix/hackaround (r15314): of course on some system searching a font using its english name fails. So now we search the font using the localised name and use the english name for the final 'validation' only. --- src/fontcache.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fontcache.cpp b/src/fontcache.cpp index a3f45ec07..8a3f684f6 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -172,6 +172,8 @@ static FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) if (err != FT_Err_Ok) break; if (strncasecmp(font_name, (*face)->family_name, strlen((*face)->family_name)) == 0) break; + /* Try english name if font name failed */ + if (strncasecmp(font_name + strlen(font_name) + 1, (*face)->family_name, strlen((*face)->family_name)) == 0) break; err = FT_Err_Cannot_Open_Resource; } while ((FT_Long)++index != (*face)->num_faces); @@ -296,12 +298,18 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT if ((fs.fsCsb[0] & info->locale.lsCsbSupported[0]) == 0 && (fs.fsCsb[1] & info->locale.lsCsbSupported[1]) == 0) return 1; } - const char *font_name = GetEnglishFontName(logfont); - DEBUG(freetype, 1, "Fallback font: %s", font_name); + const char *english_name = GetEnglishFontName(logfont); + const char *font_name = WIDE_TO_MB(logfont->elfFullName); + DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name); 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)); + + /* Add english name after font name */ + strecpy(info->settings->small_font + strlen(info->settings->small_font) + 1, english_name, lastof(info->settings->small_font)); + strecpy(info->settings->medium_font + strlen(info->settings->medium_font) + 1, english_name, lastof(info->settings->medium_font)); + strecpy(info->settings->large_font + strlen(info->settings->large_font) + 1, english_name, lastof(info->settings->large_font)); return 0; // stop enumerating } -- cgit v1.2.3-70-g09d2