JDK-8219901 : Noto fonts for East Asian countries cannot belong to CompositeFont
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 11,12,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2019-02-28
  • Updated: 2024-03-12
  • Resolved: 2019-06-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13 JDK 14
13 b24Fixed 14Fixed
Related Reports
Relates :  
Description
When Google Noto fonts[1] were installed and listed by fontconfig library on Linux, CompositeFont couldn't contain it.
The entry of Noto font could be replaced by another font which depends on an environment.

Under our Ubuntu18.04 zLinux,
"Noto Sans CJK JP Regular" was listed at the top of Japanese, but was replaced by
"BPG Ingiri GPL&GNU".
Then, we cannot show Japanese in the system.

Under another our Ubuntu18.04 x86_64,
"Noto Sans CJK JP Regular" was replaced by
"Noto Serif CJK KR Light".
Then, we saw unexpected glyphs. JP(Japanese) and KR(Korean) use similar but different glyphs.

This problem is only for CompositeFont. Specific Font by filename can show expectedly.

Evaluation:
src/java.desktop/share/classes/sun/font/CompositeFont.java:doDeferredInitialisation() (l. 296)
validates the target font by comparing names.
The current code stored FamilyName to faceNames variable, then compared it with FullName (getFontName()).
If they were different, the target font was treated as invalid.
So, faceNames should be created by FullName.

Noto fonts have different values between a preferred family name and a full name. And, this is the reason the problem was found with Noto fonts.

The cached font list is stored under ~/.java/fonts directory. We should delete it before testing.

[1] https://www.google.com/get/noto/

Attached screenshots and a log file:
Noto-problem.jpg - In the case that Noto font is the only Japanese font.
Noto-fixed.jpg - With the proposed fix.
fc-match.log - The result of fc-match command in above environment. 
Comments
Fix request [11u] I backport this to correctly display Noto fonts. Patch is clean. Testing: original issue test case passes, all tests in test/jdk/java/awt/font/ pass and tier 1 with GHA. Update: Deleting backport request per regression introduced by this issue.
12-03-2024

Hi Goetz, I missed the regression introduced. Doesn't seem worthwhile since that hasn't been resolved. That's my mistake, I'll delete the backport request. Thanks.
12-03-2024

Hi [~szaldana], should we really backport this? It has an open follow-up.
12-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/2586 Date: 2024-03-07 19:40:50 +0000
08-03-2024

URL: http://hg.openjdk.java.net/jdk/jdk/rev/26dd6fdc4165 User: psadhukhan Date: 2019-06-04 08:52:03 +0000
04-06-2019

URL: http://hg.openjdk.java.net/jdk/client/rev/26dd6fdc4165 User: prr Date: 2019-06-03 00:01:43 +0000
03-06-2019

I tried to run the testcase with all locales. The result files were uploaded in AllLocalesFontTest.tar.gz. "*_13-b19.txt" are the original results, and "*_fix.txt" are the ones with the fix. > http://cr.openjdk.java.net/~tnakamura/8219901/webrev.02/ There are many improvements in RHEL8, Ubuntu1604 and Ubuntu1804. On the other hand, there are still some Exceptions. I believe we can categorize three cases. 1) is no problem. 2) and 3) can be a problem, but they have different causes. I'd like to treat them separately. 1) NullPointerException: JVM doesn't support the locale. We can ignore them. CentOS7_fix.txt: cy_GB, cy_GB.iso885914, hy_AM.armscii8, ka_GE, ka_GE.georgianps, kk_KZ, kk_KZ.pt154, lg_UG, lg_UG.iso885910, tg_TJ, tg_TJ.koi8t, yi_US, yi_US.cp1255 RHEL7_fix.txt: cy_GB, cy_GB.iso885914, hy_AM.armscii8, ka_GE, ka_GE.georgianps, kk_KZ, kk_KZ.pt154, lg_UG, lg_UG.iso885910, tg_TJ, tg_TJ.koi8t, yi_US, yi_US.cp1255 RHEL8_fix.txt: cy_GB, kk_KZ 2) Two English fullnames are returned by fontconfig API. The current code picked up the first one, but the second one was expected in these cases. Ubuntu1604_fix.txt: or_IN, or_IN.utf8 (Two English fullnames: ori1Uni Medium, utkal medium) Ubuntu1804_fix.txt: fur_IT, fur_IT.utf8 (Two English fullnames: Nafees, Nafees Nastaleeq) or_IN, or_IN.utf8 (Two English fullnames: ori1Uni Medium, utkal medium) 3) Different language parameter to call fontconfig API RHEL8_fix.txt: or_IN (FullName mismatch: Samyak Odia|:fullname=FreeSerif) Ubuntu1604_fix.txt: es_PA.utf8 (FullName mismatch: Saab|:fullname=DejaVu Sans) Ubuntu1804_fix.txt: es_PA.utf8 (FullName mismatch: Saab|:fullname=DejaVu Sans)
20-05-2019