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 | 011ac751da6ad88af5ff9e6547f568549e6675c3 (patch) | |
tree | 1e9fc804c1795326bc7530fab5e3cabe17314655 /vcl/unx | |
parent | fb46f7604731b35033691987ef4936a5248c9b88 (diff) |
#i114703# better selection of localized fontnames (thanks cmc)
Diffstat (limited to 'vcl/unx')
-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 03816857f27c..5b18ec002aa9 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -509,22 +509,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; } } |