diff options
author | Tomofumi Yagi <yagit@mknada.sakura.ne.jp> | 2019-10-20 08:24:13 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-03-21 10:29:13 +0100 |
commit | c663d0bcc93b278f50c8f6802928a7a6154207f2 (patch) | |
tree | 4bf2578bb5c82e06f42f012684d93743f5484004 /unotools | |
parent | 7f45cbace44141e22c159dc2216fefd787e14d1f (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/qa/unit/testGetEnglishSearchName.cxx | 25 | ||||
-rw-r--r-- | unotools/source/misc/fontdefs.cxx | 2 |
2 files changed, 23 insertions, 4 deletions
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 }, |