JDK-8287540 : Corruption of CJK Unified Ideograph character after upgrade to JDK 11
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 11,17,19
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux
  • Submitted: 2022-05-31
  • Updated: 2022-06-20
  • Resolved: 2022-06-20
Related Reports
Relates :  
Description
ADDITIONAL OS VERSION INFORMATION:
Red Hat Enterprise Linux 8

A DESCRIPTION OF THE PROBLEM:
After upgrade to JDK 11 "java.awt.Graphics2D.drawString​(String, int, int)" method draws the character "金", whose code point is "U+91D1" from CJK Unified Ideograph Unicode block, incorrectly. The drawn character looks as corrupted. The issue is not reproducible with JDK 8 release family.

In the test scenario the produced instance of "java.awt.image.BufferedImage" is stored in BMP file using "javax.imageio.ImageWriter" instance. Also the test scenario requires installation of the additional two fonts: "MS PMincho", "SUPMincho" in the JDK.

EXPECTED VERSUS ACTUAL BEHAVIOR:
EXPECTED - The correct character is shown on the attached image "NormalChar-LinuxOS-JDK8u331-b09-MSPMincho.bmp".
ACTUAL - The corrupted character is shown on the attached image "CorruptedChar-LinuxOS-JDK11.0.15+8-MSPMincho.bmp".
Comments
The following facts are defined: - Installing FreeType "2.10.0" or later library on Linux OS (verified it on CentOS Linux 8) resolves the issue, so the issue cannot be reproduced anymore with JDK 11 and later release families (verified it with JDK 19+25, JDK 11.0.15+8, JDK 11.0.5+10). - Upgrade of FreeType library to the version "2.10.0" was made in JDK 11.0.5 for MS Windows OS by the fix for JDK-8222362, and this change resolved the issue on MS Windows OS. - On Linux OS JDK 11 including its latest release JDK 11.0.15 indeed loads and depends on FreeType library installed in OS. - Starting from its first release, JDK 11 for Linux OS has not been bundled with the FreeType library. - Source code of FreeType library became part of JDK 11 source code as a result of the fix for JDK-8193017. CONCLUSION: 1. The issue is a bug in FreeType library which became resolved in FreeType "2.10.0". 2. In order to resolve this issue on Linux OS the user of JDK 11 or later release family needs to install FreeType "2.10.0" or later library in the system (verified that the issue stays resolved also with FreeType "2.10.4"). Closing the issue with "Not an Issue" resolution.
20-06-2022

Two image files were attached to the issue: 1. "NormalChar-LinuxOS-JDK8u331-b09-MSPMincho.bmp" - Correct character look. Image is generated by a test case on Linux OS with JDK 8u331 b09 and "MS PMincho" font. 2. "CorruptedChar-LinuxOS-JDK11.0.15+8-MSPMincho.bmp" - Corrupted character. Image is generated by a test case on Linux OS with JDK 11.0.15+8 and "MS PMincho" font.
17-06-2022

By means of the bug filer's test case I reproduced the issue on: - CentOS Linux 8 with JDK 19+25, JDK 17.0.3+8, JDK 11.0.15+8, JDK 11.0.5+10. - MS Windows 10 OS with JDK 11.0.4+10. I could not reproduce the issue on: - CentOS Linux 8 with JDK 8u331 b09. - MS Windows 10 OS with JDK 19+25, JDK 17.0.3+8, JDK 11.0.15+8, JDK 11.0.5+10, JDK 8u331 b09. These test results correspond to the test results provided by the bug filer. This issue does not affect JDK release families later or equal to JDK 8 on MS Windows OS. By recommendation and direction from Phil Race provided in his evaluation of the bug in the comment above, I checked the version of FreeType library installed on my machine with CentOS Linux 8, where I reproduced the issue, and it is - "freetype 2.9.1", which is older than 2.10. I will try to update FreeType library on my machine and will check, either it resolves the issue or not.
03-06-2022

Let's suppose the problem is a font rasterisation problem that didn't exist in 8u - at least the Oracle ones - because it uses its own rasteriser. Let's also suppose the suggestion that this was "fixed" on windows in 11.0.5 is correct and so is only a Linux issue now. Let's further suppose that is because 11.0.5 got an updated version of freetype (2.10) https://bugs.openjdk.java.net/browse/JDK-8287540 Then it is important to know which EXACT "Linux" is being tested, since perhaps it is a freetype bug and on Linux it will be using freetype from the platform which may be older than 2.10 In fact more than just the Linux, you really should check all the way down to the freetype version.
31-05-2022