Commits

Anonymous committed 495484a

#i114703# better selection of localized fontnames (thanks cmc)

  • Participants
  • Parent commits c308a15

Comments (0)

Files changed (1)

File vcl/unx/source/fontmanager/fontconfig.cxx

 
         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;
     }
 }