officecfg/registry/data/org/openoffice/VCL.xcu |   16 ++++++++--------
 unotools/qa/unit/testGetEnglishSearchName.cxx  |   25 +++++++++++++++++++++----
 unotools/source/misc/fontdefs.cxx              |    2 ++
 vcl/quartz/ctfonts.cxx                         |    7 ++-----
 4 files changed, 33 insertions(+), 17 deletions(-)

New commits:
commit c663d0bcc93b278f50c8f6802928a7a6154207f2
Author:     Tomofumi Yagi <ya...@mknada.sakura.ne.jp>
AuthorDate: Sun Oct 20 08:24:13 2019 +0900
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Mar 21 10:29:13 2020 +0100

    tdf#128276 Font names are not localized on macOS Catalina
    
    1. We would like to call CTFontDescriptorCopyLocalizedAttribute function
    simply.
    We don't need to compare language settings of LibreOffice UI to OS lang-
    uage settings.
    This comparison was a way to save users from confusion, but it was bad
    idea.
    Because CTFontDescriptorCopyLocalizedAttribute function before macOS
    Catalina returns RFC 3066 bis as a language tag, but LibreOffice and
    macOS Catalina uses BCP 47 as a language tag.
    CTFontDescriptorCopyLocalizedAttribute function use the language setting
    for the operating system, therefore Users will change it if needed.
    
    2. Fix font aliases on macOS Catalina
    I added some entries because I notice that those doesn't working with
    a Hiragino Sans font alias.
    
    Change-Id: Ie05a96f45cba13a19fcc1b855bd908f397e585a1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/81145
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu 
b/officecfg/registry/data/org/openoffice/VCL.xcu
index 40fce619cf7c..271731c28e65 100644
--- a/officecfg/registry/data/org/openoffice/VCL.xcu
+++ b/officecfg/registry/data/org/openoffice/VCL.xcu
@@ -214,28 +214,28 @@
         <value>Noto Serif CJK JP;游明朝;MS 明朝;MS P明朝;ヒラギノ明朝 ProN;ヒラギノ明朝 Pro;IPA 
明朝;IPA P明朝;Mincho;Serif</value>
       </prop>
       <prop oor:name="CJK_HEADING" oor:type="xs:string" oor:op="replace">
-        <value>Noto Sans CJK JP;游ゴシック;MS ゴシック;MS Pゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPA ゴシック;IPA Pゴシック;Gothic;MS 明朝;Mincho;MS P明朝;Gothic</value>
+        <value>Noto Sans CJK JP;游ゴシック;MS ゴシック;MS Pゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ 
ProN;ヒラギノ角ゴ Pro;IPA ゴシック;IPA Pゴシック;Gothic;MS 明朝;Mincho;MS P明朝;Gothic</value>
       </prop>
       <prop oor:name="CJK_PRESENTATION" oor:type="xs:string" oor:op="replace">
-        <value>Noto Sans CJK JP;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS Pゴシック;IPA 
Pゴシック;MS ゴシック;MS Pゴシック;Gothic</value>
+        <value>Noto Sans CJK JP;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS 
Pゴシック;IPA Pゴシック;MS ゴシック;MS Pゴシック;Gothic</value>
       </prop>
       <prop oor:name="LATIN_PRESENTATION" oor:type="xs:string" 
oor:op="replace">
-        <value>Noto Sans CJK JP;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS Pゴシック;IPA 
Pゴシック;MS ゴシック;MS Pゴシック;Gothic</value>
+        <value>Noto Sans CJK JP;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS 
Pゴシック;IPA Pゴシック;MS ゴシック;MS Pゴシック;Gothic</value>
       </prop>
       <prop oor:name="CJK_SPREADSHEET" oor:type="xs:string" oor:op="replace">
-        <value>Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;IPA 
Pゴシック;Gothic</value>
+        <value>Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPA Pゴシック;Gothic</value>
       </prop>
       <prop oor:name="LATIN_SPREADSHEET" oor:type="xs:string" oor:op="replace">
-        <value>Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;IPA 
Pゴシック;MS Gothic;MS PGothic;Gothic</value>
+        <value>Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPA Pゴシック;MS Gothic;MS PGothic;Gothic</value>
       </prop>
       <prop oor:name="UI_FIXED" oor:type="xs:string" oor:op="replace">
-        <value>Noto Sans Mono CJK JP;Yu Gothic UI;MS ゴシック;Osaka;ヒラギノ角ゴ 
ProN;ヒラギノ角ゴ Pro;IPAゴシック;Gothic</value>
+        <value>Noto Sans Mono CJK JP;Yu Gothic UI;MS 
ゴシック;Osaka;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;IPAゴシック;Gothic</value>
       </prop>
       <prop oor:name="FIXED" oor:type="xs:string" oor:op="replace">
-        <value>Noto Sans Mono CJK JP:MS ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPAゴシック;Gothic</value>
+        <value>Noto Sans Mono CJK JP:MS ゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPAゴシック;Gothic</value>
       </prop>
       <prop oor:name="UI_SANS" oor:type="xs:string" oor:op="replace">
-        <value>IPA Pゴシック;IPA P Gothic;Noto Sans CJK JP;Yu Gothic UI;Meiryo 
UI;ヒラギノ角ゴ ProN;Hiragino Kaku Gothic ProN;ヒラギノ角ゴ Pro;Hiragino Kaku Gothic 
Pro</value>
+        <value>IPA Pゴシック;IPA P Gothic;Noto Sans CJK JP;Yu Gothic UI;Meiryo 
UI;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;Hiragino Kaku Gothic ProN;ヒラギノ角ゴ Pro;Hiragino Kaku 
Gothic Pro</value>
       </prop>
       <prop oor:name="LATIN_FIXED" oor:type="xs:string" oor:op="replace">
         
<value>cumberlandamt;cumberland;couriernew;nimbusmonol;courier;lucidasanstypewriter;lucidatypewriter;monaco;monospaced</value>
diff --git a/unotools/qa/unit/testGetEnglishSearchName.cxx 
b/unotools/qa/unit/testGetEnglishSearchName.cxx
index 2889ffaedcf7..4534187052fa 100644
--- a/unotools/qa/unit/testGetEnglishSearchName.cxx
+++ b/unotools/qa/unit/testGetEnglishSearchName.cxx
@@ -43,10 +43,27 @@ void Test::testSingleElement()
 
     //transformation
 
-    sal_Unicode const transfor[] ={ 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 
0x30B4, 'p','r','o','n',0};
-
-    test1 = GetEnglishSearchFontName(transfor );
-    CPPUNIT_ASSERT_EQUAL( OUString("hiraginomarugothicpron"),test1);
+    //for Japanese fontname
+    // IPAMincho
+    sal_Unicode const aIPAMincho[]={'i','p','a', 0x660e, 0x671d,0};
+    OUString test_ja_JP1 = GetEnglishSearchFontName(aIPAMincho);
+    CPPUNIT_ASSERT_EQUAL( OUString("ipamincho"),test_ja_JP1);
+    // IPAGothic
+    sal_Unicode const aIPAGothic[]={'i','p','a', 0x30b4, 0x30b7, 0x30c3, 
0x30af,0};
+    OUString test_ja_JP2 = GetEnglishSearchFontName(aIPAGothic);
+    CPPUNIT_ASSERT_EQUAL( OUString("ipagothic"),test_ja_JP2);
+    // HiraginoKakuGothic
+    sal_Unicode const aHiraginoKakuGothic[]={0x30D2, 0x30E9, 0x30AE, 0x30CE, 
0x89D2, 0x30B4, 0x30B7, 0x30C3, 0x30AF,0};
+    OUString test_ja_JP3 = GetEnglishSearchFontName(aHiraginoKakuGothic);
+    CPPUNIT_ASSERT_EQUAL( OUString("hiraginosans"),test_ja_JP3);
+    // HiraginoMincho Pro N
+    sal_Unicode const aHiraginoMinchoProN[]={0x30D2, 0x30E9, 0x30AE, 0x30CE, 
0x660E, 0x671D, 'p','r','o','n',0};
+    OUString test_ja_JP4 = GetEnglishSearchFontName(aHiraginoMinchoProN);
+    CPPUNIT_ASSERT_EQUAL( OUString("hiraginominchopron"),test_ja_JP4);
+    // HiraginoMaruGothic Pro N
+    sal_Unicode const aHiraginoMaruGothicProN[]={ 0x30D2, 0x30E9, 0x30AE, 
0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0};
+    OUString test_ja_JP5 = GetEnglishSearchFontName(aHiraginoMaruGothicProN);
+    CPPUNIT_ASSERT_EQUAL( OUString("hiraginomarugothicpron"),test_ja_JP5);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/unotools/source/misc/fontdefs.cxx 
b/unotools/source/misc/fontdefs.cxx
index 3e0b78a37f39..3eb4d69bd3a7 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -177,6 +177,7 @@ static sal_Unicode const aHGSeikaishotaiPRO[]       = { 
'h','g', 0x6B63,0x6977,0
 static sal_Unicode const aHGMaruGothicMPRO[]        = { 'h','g', 
0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0};
 static sal_Unicode const aHiraginoMinchoPro[]       = { 0x30D2, 0x30E9, 
0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0};
 static sal_Unicode const aHiraginoMinchoProN[]      = { 0x30D2, 0x30E9, 
0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0};
+static sal_Unicode const aHiraginoKakuGothic[]      = { 0x30D2, 0x30E9, 
0x30AE, 0x30CE, 0x89D2, 0x30B4, 0x30B7, 0x30C3, 0x30AF,0};
 static sal_Unicode const aHiraginoKakuGothicPro[]   = { 0x30D2, 0x30E9, 
0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0};
 static sal_Unicode const aHiraginoKakuGothicProN[]  = { 0x30D2, 0x30E9, 
0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0};
 static sal_Unicode const aHiraginoMaruGothicPro[]   = { 0x30D2, 0x30E9, 
0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0};
@@ -317,6 +318,7 @@ static const ImplLocalizedFontName 
aImplLocalizedNamesList[] =
 {   "hgmarugothicmpro",     aHGMaruGothicMPRO },
 {   "hiraginominchopro",    aHiraginoMinchoPro },
 {   "hiraginominchopron",   aHiraginoMinchoProN },
+{   "hiraginosans",         aHiraginoKakuGothic },
 {   "hiraginokakugothicpro", aHiraginoKakuGothicPro },
 {   "hiraginokakugothicpron", aHiraginoKakuGothicProN },
 {   "hiraginomarugothicpro", aHiraginoMaruGothicPro },
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index b0e9e8f5644a..eb67d981fe95 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -317,16 +317,13 @@ FontAttributes DevFontFromCTFontDescriptor( 
CTFontDescriptorRef pFD, bool* bFont
 
     // get font name
 #ifdef MACOSX
-    const OUString aUILang = 
Application::GetSettings().GetUILanguageTag().getLanguage();
-    CFStringRef pUILang = CFStringCreateWithCharacters( kCFAllocatorDefault,
-                                                        
reinterpret_cast<UniChar const *>(aUILang.getStr()), aUILang.getLength() );
     CFStringRef pLang = nullptr;
     CFStringRef pFamilyName = static_cast<CFStringRef>(
             CTFontDescriptorCopyLocalizedAttribute( pFD, 
kCTFontFamilyNameAttribute, &pLang ));
 
-    if ( !pLang || ( CFStringCompare( pUILang, pLang, 0 ) != kCFCompareEqualTo 
))
+    if ( !pLang )
     {
-        if(pFamilyName)
+        if( pFamilyName )
         {
             CFRelease( pFamilyName );
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to