JDK-8228713 : [Windows] Incorrect mapping from font file to GDI font results in the wrong glyphs being displayed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8u161
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • Submitted: 2019-07-29
  • Updated: 2020-05-14
  • Resolved: 2020-05-14
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
JDK 8u161 b12

ADDITIONAL OS VERSION INFORMATION :
MS Windows 10 OS

A DESCRIPTION OF THE PROBLEM :
When Microsoft ClearType font technology is switched on, Swing UI components for example JLabel display incorrect random characters instead of the required text. Switching off MS ClearType font technology through the application "C:\Windows\System32\cttune.exe" before running the Java application allows to resolve the issue.

Original screenshot from the bug filer which demonstrates the issue is available as the attached file "text_garbled.png".

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Install all Roboto fonts from the archive "Roboto-fonts.zip" attached to the bug JDK-8236996 in alphabetical order in OS. Run "File Explorer" standard OS application, go to the directory of the unpacked archive, right-click on the font file and select "Install".
2. Compile and run the attached test case "TestClearText.java".
Comments
Backport of the fix for JDK-8236996 from JDK 15 to JDK 8 is accomplished, JDK-8236996 is resolved in JDK 8u271. Closing the bug as a duplicate of JDK-8236996.
14-05-2020

As part of works on this bug, tried to check the assumption that this issue can be similar to the bug JDK-8192972. And I was able to reproduce JDK-8192972 with JDK 8 compiled from the latest version of the development source code, but JDK-8192972 could not be reproduced with JDK 15+22. The next research and experiments with the fix in JDK 8, which I did this week, allow to come to a conclusion that this issue and JDK-8192972 are both resolved in JDK 15 by the fix for the bug JDK-8236996. Was not able to reproduce the issue with the original test case from the bug filer until this week, when came to a conclusion that the issue is related to a specific font used by the Java application. In the original test case from the bug filer it was seen that it was trying to set the font with the name "roboto-light" as the component foreground font. As soon as I installed Roboto fonts on the host and changed the test case to specify the correct name of the font "Roboto" instead of "roboto-light", the issue became reproducible in JDK 8 release family. THE DEFINED FACTS: 1. This issue is by description and a sum of details exact duplicate of JDK-8236996. 2. It was verified that these three bugs: this bug, JDK-8192972, JDK-8236996 are all reproducible with JDK 8 compiled from the latest version of the development source code. 3. It was verified that by porting the fix for JDK-8236996 from JDK 15 to JDK 8 all three bugs: this bug, JDK-8192972, JDK-8236996 are resolved. Working on a backport of the fix for JDK-8236996 to JDK 8.
14-05-2020

The next 2 files were attached to the bug: 1. "text_garbled.png" - The original screenshot from the bug filer demonstrating the issue. 2. "TestClearText.java" - The test case.
14-05-2020

The bug I am thinking of for which this is a probable duplicate is https://bugs.openjdk.java.net/browse/JDK-8192972
14-08-2019

Looking at the image, the glyphs are for the wrong chars. What this means is that the font we wanted Windows to use to generate the glyph images is not the one it actually used .. so the glyph ids are different. So this is a platform font name/lookup problem. I am fairly sure this is a duplicate report. A bug on this exists somewhere and it might even have been fixed in a later release.
14-08-2019