Bug 146653 - Font rendering for localized "Source Han Sans CN" and "Source Han Serif CN" fonts (i.e. "思源黑体 CN" and "思源宋体 CN") is showing as bold rather than normal weight
Summary: Font rendering for localized "Source Han Sans CN" and "Source Han Serif CN" f...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All Linux (All)
: medium normal
Assignee: ⁨خالد حسني⁩
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks: CJK Fonts
  Show dependency treegraph
 
Reported: 2022-01-08 13:53 UTC by Kevin Suo
Modified: 2023-08-08 16:20 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
test-localized-font-names.odt (27.20 KB, application/vnd.oasis.opendocument.text)
2022-01-08 13:53 UTC, Kevin Suo
Details
test-localized-font-name.pdf (63.32 KB, application/pdf)
2022-01-08 13:55 UTC, Kevin Suo
Details
test-non-localized-font-names.odt (27.47 KB, application/vnd.oasis.opendocument.text)
2022-01-08 13:57 UTC, Kevin Suo
Details
test-non-localized-font-names.pdf (119.48 KB, application/pdf)
2022-01-08 13:59 UTC, Kevin Suo
Details
screenshot showing the problem in Calc with default template (231.42 KB, image/png)
2022-04-09 06:27 UTC, Kevin Suo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2022-01-08 13:53:53 UTC
Created attachment 177395 [details]
test-localized-font-names.odt

The attached file named "test-localized-font-name.odt" uses "思源黑体 CN" (i.e., localized font name of "Source Han Sans CN") in the 1st paragraph, and uses "思源宋体 CN" (i.e., localized font name of "Source Han Serif CN") in the 3rd paragraph. The font weights are set to normal. When open this document in a Simplified Chinese desktop environment (so that when open in LibreOffice the localized font names can be correctly recognized), the 1st and the 3rd paragraphs are shown as bold weight.

Steps to Reproduce:

1. Make sure you have "Source Han Sans CN" and "Source Han Serif CN" fonts installed. (on Fedora system, the packages names should be: adobe-source-han-sans-cn-fonts and adobe-source-han-serif-cn-fonts)

2. Switch your operating system language (not your LibreOffice language) to Simplified Chinese, then open the attached "test-localized-font-name.odt". 
(Note: If you do not switch your system language to Chinese then when you open the file the fonts are shown as italic, indicating that the font is not found, although you have already installed the font)

Current Result:
The text in the 1st and the 3rd paragraphs are wrongly shown as bold weight. 

Expected Result:
They should show as normal weight.

I attach the (wrong) rendering result in this step as "test-localized-font-name.pdf".

3. As a comparison, now switch your system to English language, then open the file named "test-non-localized-font-name.odt". In this file, the 1st and the 3rd paragraphs uses "Source Han Sans CN" and ""Source Han Serif CN" fonts, respectively, which are identical to the localized names as in the file in step 2 above.

--> The text in the 1st and the 3rd paragraphs are correctly shown as normal weight.

I attach the (correct) rendering result in this step as "test-non-localized-font-name.pdf".

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: a6415004630c28ac4c0a64b83d8f0fd5c77a6a31
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: zh-CN (zh_CN.UTF-8); UI: en-US
Build Platform: Fedora34@X64, Branch:master, bibisect-linux-64-7.4-CN
Calc: threaded
Fedora 34 and Fedora 35.
Comment 1 Kevin Suo 2022-01-08 13:55:52 UTC
Created attachment 177396 [details]
test-localized-font-name.pdf

Rendering result of "test-localized-font-name.odt" in operating system of Simplified Chinese language.
Comment 2 Kevin Suo 2022-01-08 13:57:58 UTC
Created attachment 177397 [details]
test-non-localized-font-names.odt

This should be open in a English system language for comparison.
Comment 3 Kevin Suo 2022-01-08 13:59:22 UTC
Created attachment 177398 [details]
test-non-localized-font-names.pdf

Rendering result of the file "test-non-localized-font-names.odt" in an English language operating system. The text are correctly shown as non-bold for the 1st and 3rd paragraphs.
Comment 4 Kevin Suo 2022-01-08 14:01:19 UTC
Bug already existed in 
Version: 6.0.0.0.alpha1+
Build ID: 6eeac3539ea4cac32d126c5e24141f262eb5a4d9
Comment 5 Kevin Suo 2022-01-23 07:15:32 UTC
The impact of this bug is actually obvious, as we have set the localized font name "思源黑体 CN" as default font for zh-CN in:
https://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/VCL.xcu

This makes the default font to be bold when new document is created, thus the user need to manually change the font of default style every time a new doc is created.
Comment 6 Kevin Suo 2022-04-09 06:27:57 UTC
Created attachment 179419 [details]
screenshot showing the problem in Calc with default template
Comment 7 Commit Notification 2022-04-12 17:28:58 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/22c7ce6c8e7d5b7f8b37ad6c519c2b8ca4853724

UI Workaround for tdf#146653: change localized Source Han {Sans,Serif} CN...

It will be available in 7.4.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 8 Kevin Suo 2022-05-06 12:29:35 UTC
Removing the "target" whiteboard as the fix in comment 7 is just a workaround and does not fix the root problem.
Comment 9 ⁨خالد حسني⁩ 2023-08-08 13:08:38 UTC
Fixed with 0b5e88bc88df6f0cd47e84cbd8bc53b649678f8b (bug 114192)
Comment 10 ⁨خالد حسني⁩ 2023-08-08 13:53:47 UTC
For the record, getting the localized font name now requires changing LO UI language not the system locale (at least on Linux).
Comment 11 Commit Notification 2023-08-08 16:20:00 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1e13ee5273848306cc6000d90e9f48593ea39bd8

Revert "UI Workaround for tdf#146653: change localized Source Han {Sans,Serif}

It will be available in 24.2.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.