diff options
author | Herbert Duerr [hdu] <herbert.duerr@oracle.com> | 2010-09-24 14:08:30 +0200 |
---|---|---|
committer | Herbert Duerr [hdu] <herbert.duerr@oracle.com> | 2010-09-24 14:08:30 +0200 |
commit | 585906551012bb231308bcc26a290b4c99651dbe (patch) | |
tree | a8caffbbb0f817c95769661d9ed043be6011e20a /vcl | |
parent | #i114706# fix registration of alternative font names (thanks cmc) (diff) | |
download | core-585906551012bb231308bcc26a290b4c99651dbe.tar.gz core-585906551012bb231308bcc26a290b4c99651dbe.zip |
#i114703# better selection of localized fontnames (thanks cmc)
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/source/fontmanager/fontconfig.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index 2ff4298b7658..01e183a68dce 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -544,22 +544,29 @@ namespace std::vector<lang_and_family>::const_iterator aEnd = families.end(); bool alreadyclosematch = false; - for (std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter) + for( std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter ) { const char *pLang = (const char*)aIter->first; - //perfect - if( rtl_str_compare(pLang,sFullMatch.getStr() ) == 0) + if( rtl_str_compare( pLang, sFullMatch.getStr() ) == 0) { + // both language and country match candidate = aIter->second; break; } - else if( (rtl_str_compare(pLang,sLangMatch.getStr()) == 0) && (!alreadyclosematch)) + else if( alreadyclosematch ) + continue; + else if( rtl_str_compare( pLang, sLangMatch.getStr()) == 0) { + // just the language matches candidate = aIter->second; alreadyclosematch = true; } + else if( rtl_str_compare( pLang, "en") == 0) + { + // fallback to the english family name + candidate = aIter->second; + } } - return candidate; } } |