vcl/unx/generic/fontmanager/fontmanager.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 45da2754222d1fd6ffb02636b8568b4ac6472979
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Mar 24 12:32:13 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Mar 24 20:42:07 2023 +0000

    tdf#151722 restore use of localized font name
    
    basically disabled back with:
    
    commit cc93f06f93eeaaee5811588d90929ebc72bf9724
    Date:   Fri Apr 23 12:28:26 2010 +0200
    
        #i111108# do not prefer fontconfig familyname because of i79878
    
    to avoid stuff like "DejaVu Condensed" getting reported as "DejaVu" with
    a "Condensed" style.
    
    Rather than reopen that problem, just tweak analyzeSfntFamilyName to
    use the UI lang instead of the system lang as the preferred lang.
    
    Change-Id: I41f128d1a21397ff7880f34985c1553b890b4747
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149542
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index dc8feaa6d0b3..b8f99d122e1f 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -23,6 +23,7 @@
 
 #include <unx/fontmanager.hxx>
 #include <impfontcharmap.hxx>
+#include <unotools/syslocaleoptions.hxx>
 #include <unx/gendata.hxx>
 #include <unx/helper.hxx>
 #include <vcl/fontcharmap.hxx>
@@ -453,8 +454,8 @@ void PrintFontManager::analyzeSfntFamilyName( void const * 
pTTFont, ::std::vecto
     GetTTNameRecords( static_cast<TrueTypeFont const *>(pTTFont), aNameRecords 
);
     if( !aNameRecords.empty() )
     {
-        LanguageTag aSystem("");
-        LanguageType eLang = aSystem.getLanguageType();
+        LanguageTag aUILang(SvtSysLocaleOptions().GetRealUILanguageTag());
+        LanguageType eLang = aUILang.getLanguageType();
         int nLastMatch = -1;
         for( size_t i = 0; i < aNameRecords.size(); i++ )
         {
@@ -480,7 +481,7 @@ void PrintFontManager::analyzeSfntFamilyName( void const * 
pTTFont, ::std::vecto
             {
                 AppleLanguageId aAppleId = 
static_cast<AppleLanguageId>(static_cast<sal_uInt16>(aNameRecords[i].languageID));
                 LanguageTag 
aApple(makeLanguageTagFromAppleLanguageId(aAppleId));
-                if (aApple == aSystem)
+                if (aApple == aUILang)
                     nMatch = 8000;
                 else if (aAppleId == AppleLanguageId::ENGLISH)
                     nMatch = 2000;

Reply via email to