Bug 128276 - Font names are not localized on macOS Catalina
Summary: Font names are not localized on macOS Catalina
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha1+
Hardware: x86-64 (AMD64) macOS (All)
: medium normal
Assignee: Tomofumi Yagi
URL:
Whiteboard: target:7.0.0
Keywords:
Depends on:
Blocks: CJK Fonts
  Show dependency treegraph
 
Reported: 2019-10-20 14:14 UTC by Tomofumi Yagi
Modified: 2020-07-23 09:18 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
on macOS Mojave (156.98 KB, image/png)
2019-10-20 14:30 UTC, Tomofumi Yagi
Details
on macOS Catalina (146.16 KB, image/png)
2019-10-20 14:32 UTC, Tomofumi Yagi
Details
a screenshot on macOS Catalina (254.31 KB, image/png)
2019-10-22 01:28 UTC, Tomofumi Yagi
Details
LocalizedFontnameTestPatchedMaster.fodt (30.75 KB, application/vnd.oasis.opendocument.text-flat-xml)
2019-10-22 01:32 UTC, Tomofumi Yagi
Details
LocalizedFontnameTestLibO6.2.6.fodt (30.89 KB, application/vnd.oasis.opendocument.text-flat-xml)
2019-10-22 01:33 UTC, Tomofumi Yagi
Details
a screenshot on macOS Catalina take2 (264.21 KB, image/png)
2019-10-23 11:03 UTC, Tomofumi Yagi
Details
Font list from my Mac in macOS Catalina(Japanese environment) (18.52 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-11-10 05:18 UTC, Tomofumi Yagi
Details
Font list from my Mac in macOS Catalina and Mojave(Japanese environment) (29.40 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-11-23 22:29 UTC, Tomofumi Yagi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomofumi Yagi 2019-10-20 14:14:12 UTC
Description:
After mac OS Update, on LibreOffice Vanilla 6.2.6.2 and macOS Catalina, I noticed that font names in drop down list at the formatting toolbar are not localized.
The Japanese font names were localized before macOS update(macOS Mojave) on LibreOffice Vanilla 6.2.6.2.

バージョン: 6.2.6.2
Build ID: 684e730861356e74889dfe6dbddd3562aae2e6ad
CPU threads: 4; OS:Mac OS X 10.15; UI render: default; VCL: osx; 
ロケール: ja-JP (zh_Hans.UTF-8); UIの言語: ja-JP
Calc: threaded

I reproduced this bug on LibreOffice master(6.4.0 alpha).


Steps to Reproduce:
1.Start Writer.
2.Click Font Name dropdown list in Formatting Toolbar 
3.There is "Hiragino Sans" Font in the font list

Actual Results:
"Hiragino Sans" font lists in the font list.

Expected Results:
"ヒラギノ角ゴシック" font lists in the font list.


Reproducible: Always


User Profile Reset: No



Additional Info:
The font list is created by / core / vcl / quartz / ctfonts.cxx.
CTFontDescriptorCopyLocalizedAttribute function used in this file seems to have changed from macOS Catalina.
Comment 1 Tomofumi Yagi 2019-10-20 14:30:22 UTC
Created attachment 155161 [details]
on macOS Mojave
Comment 2 Tomofumi Yagi 2019-10-20 14:32:42 UTC
Created attachment 155162 [details]
on macOS Catalina
Comment 3 Tomofumi Yagi 2019-10-20 14:40:18 UTC
The patch on Gerrit can be found at :

https://gerrit.libreoffice.org/#/c/81145/
Comment 4 Tomofumi Yagi 2019-10-20 15:34:35 UTC
I quote a comment from Gerrit :
----- start ----- 
Thank you for your advice, Julie Nabet.
(snip)
>My main point is, is this patch also right for MacOS before Catalina?

Yes.I think so.
After this patch is applied, LibreOffice always uses CTFontDescriptorCopyLocalizedAttribute function to get the font name.
Therefore, the font name is always localized.
- For example, Japanese fonts are in Japanese and Simplified Chinese fonts are displayed in English.
  It works the same as Apple Pages in Japanese language environment( it looks like ).
- The behavior is the same, both before and after macOS Catalina.
- I think that almost users were expecting this behavior.

Now(before this patch is applied),
I think there may be some cases like this.

Please refer the following url:

Code point /core/vcl/quartz/ctfonts.cxx
https://opengrok.libreoffice.org/xref/core/vcl/quartz/ctfonts.cxx?r=60d4be99

Apple's CTFontDescriptorCopyLocalizedAttribute reference:
https://developer.apple.com/documentation/coretext/1509510-ctfontdescriptorcopylocalizedatt?language=objc


(Case 1-1) Japanese language environment before Catalina
 Font names in LibreOffice are localized(OK)
 CTFontDescriptorCopyLocalizedAttribute function's third parameter returns:
 -> ja(Japanese fonts) or en(Non Japanese fonts)
 LibreOffice's Application::GetSettings().GetUILanguageTag().getLanguage() returns:
 -> ja
(Case 1-2) Japanese language environment in(after) Catalina
 Font names in LibreOffice are *not* localized(NG)
 CTFontDescriptorCopyLocalizedAttribute function's third parameter returns:
 -> ja-JP(Japanese fonts) or ja(some Chinese fonts,It is probably a OS's bug) or en(others) 
 LibreOffice's Application::GetSettings().GetUILanguageTag().getLanguage() returns:
 -> ja


(Case 2-1) Simplified Chinese language environment before Catalina
 Font names in LibreOffice are *not* localized(NG).
 CTFontDescriptorCopyLocalizedAttribute function's third parameter returns:
 -> zh-CN(Chinese fonts) or ja(some Chinese fonts) or en
 LibreOffice's Application::GetSettings().GetUILanguageTag().getLanguage() returns:
 -> zh-Hans
(Case 2-2) Simplified chinese language environment in(after) Catalina
 Font names in LibreOffice are localized(OK).
 CTFontDescriptorCopyLocalizedAttribute function's third parameter returns:
 -> zh-Hans(Chinese fonts) or ja-JP(Japanese fonts) or en 
 LibreOffice's Application::GetSettings().GetUILanguageTag().getLanguage() returns:
 -> zh-Hans


(Case 3) others
Font names in LibreOffice are *not* localized both before and after Catalina.
But font names are displayed in English as it is desired by the user,so no problem.


Sorry for my long reply.
----- e n d -----
Comment 5 Tomofumi Yagi 2019-10-22 00:23:43 UTC
(In reply to Tomofumi Yagi from comment #0)

The locale was wrong.
The following version is correct.

バージョン: 6.2.6.2
Build ID: 684e730861356e74889dfe6dbddd3562aae2e6ad
CPU threads: 4; OS:Mac OS X 10.15; UI render: default; VCL: osx; 
ロケール: ja-JP (ja_JP.UTF-8); UIの言語: ja-JP
Calc: threaded
 
> バージョン: 6.2.6.2
> Build ID: 684e730861356e74889dfe6dbddd3562aae2e6ad
> CPU threads: 4; OS:Mac OS X 10.15; UI render: default; VCL: osx; 
> ロケール: ja-JP (zh_Hans.UTF-8); UIの言語: ja-JP
> Calc: threaded
Comment 6 Tomofumi Yagi 2019-10-22 01:28:44 UTC
Created attachment 155221 [details]
a screenshot on macOS Catalina
Comment 7 Tomofumi Yagi 2019-10-22 01:32:11 UTC
Created attachment 155222 [details]
LocalizedFontnameTestPatchedMaster.fodt
Comment 8 Tomofumi Yagi 2019-10-22 01:33:03 UTC
Created attachment 155223 [details]
LocalizedFontnameTestLibO6.2.6.fodt
Comment 9 Tomofumi Yagi 2019-10-22 02:26:19 UTC
I quote a comment from Gerrit :
----- start ----- 
Thank you for your review, Khaled Hosny.

>What happens if a document that uses a localized font name is open in a system that uses the English (or other language) font name?

The document is displayed in a different font, because font fallback occurs.
I uploaded screenshots to Bugzilla, so please refer.
https://bugs.documentfoundation.org/show_bug.cgi?id=128276

>Is the localized name stored in the document?

Yes.
I uploaded Writer documents(flat odf) to Bugzilla, so please refer.
https://bugs.documentfoundation.org/show_bug.cgi?id=128276
----- e n d -----
Comment 10 Xisco Faulí 2019-10-22 09:34:10 UTC
(In reply to Tomofumi Yagi from comment #3)
> The patch on Gerrit can be found at :
> 
> https://gerrit.libreoffice.org/#/c/81145/

Moving to ASSIGNED
Comment 11 Tomofumi Yagi 2019-10-23 11:03:59 UTC
Created attachment 155253 [details]
a screenshot on macOS Catalina take2

Fix font aliases on macOS Catalina.
I added an entry because It doesn't working with a Hiragino Sans font-Alias.
Comment 12 Xisco Faulí 2019-10-24 09:59:08 UTC
I don't think this is a regression...
Comment 13 Tomofumi Yagi 2019-11-10 01:52:34 UTC
(In reply to Xisco Faulí from comment #12)
> I don't think this is a regression...

Thank you for your investigation.
This bug is a regression of an old bug in LibreOffice version 4.
Is it better not to tag the regression bug?
Comment 14 Tomofumi Yagi 2019-11-10 05:18:18 UTC
Created attachment 155671 [details]
Font list from my Mac in macOS Catalina(Japanese environment)

I got a font list from my MacBook in macOS Catalina(Japanese environment).
Comment 15 Tomofumi Yagi 2019-11-23 22:29:57 UTC
Created attachment 156068 [details]
Font list from my Mac in macOS Catalina and Mojave(Japanese environment)
Comment 16 Commit Notification 2020-03-21 09:30:06 UTC
Tomofumi Yagi committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c663d0bcc93b278f50c8f6802928a7a6154207f2

tdf#128276 Font names are not localized on macOS Catalina

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Xisco Faulí 2020-07-22 15:07:02 UTC
A polite ping to Tomofumi Yagi:
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ?
Otherwise, Could you please explain what's missing?
Thanks
Comment 18 Tomofumi Yagi 2020-07-23 09:18:33 UTC
(In reply to Xisco Faulí from comment #17)
> A polite ping to Tomofumi Yagi:
> Is this bug fixed? if so, could you please close it as RESOLVED FIXED ?
> Otherwise, Could you please explain what's missing?
> Thanks

Sorry.
I forgot to close this bug.
Thanks.