JDK-8214284 : Font rendering shows artifacts around glyphs
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 11,12
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2018-11-22
  • Updated: 2020-02-12
  • Resolved: 2020-02-12
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.
Other
tbdResolved
Description
ADDITIONAL SYSTEM INFORMATION :
Xubuntu 18.10 - 64 Bit
JDK 11.0.1 from http://jdk.java.net/11/

A DESCRIPTION OF THE PROBLEM :
The initial problem was observed with a development version of netbeans. Netbeans was run with JDK 11 and in labels with bold text black distortions in the font rendering were observed.

The problem was reproducible with the logical "Dialog" font and also with the font "DejaVu Sans Light". It is unclear if the problem only occurs with bold fonts, but was only observed there.

To make this reproducible a minimal sample was created that just renders a "big" sample label. 
That is a maven project with a single java class. To reproduce please:

1. Download the tar mentioned above
2. Extract it, change into the "SimpleSample" folder
3. Run "mvn package"
4. Run "java -jar target/SimpleSample-1.0-SNAPSHOT.jar"

I was able to reproduce this on Xubuntu 18.10 with a clean user profile. The results for JDK 8, JDK 10 and JDK 11 can be found (attachments).
As visible in the screenshots, the rendering is slightly different in each version, but the artifacts are only present in JDK 11. The artifacts seem to  be concentrated at the edges of the bounding box of the glyph.

REGRESSION : Last worked in version 10.0.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Rendering without artifacts as in JDK 8 + JDK 10
ACTUAL -
Rendering artifacts around the edge of the bounding box of the glyphs

---------- BEGIN SOURCE ----------
Download link is provided in description
---------- END SOURCE ----------

FREQUENCY : always



Comments
So this is no longer reproducible, but we do have a bug with LCD + fractional metrics. That is filed as https://bugs.openjdk.java.net/browse/JDK-8238942
12-02-2020

Additional note from submitter: =============================== I did a "git bisect" session against the github mirror (https://github.com/openjdk/jdk) and could track it down to this commit: ee8af63017a93a5a80413a88b4b00694bb9171a2 is the first bad commit commit ee8af63017a93a5a80413a88b4b00694bb9171a2 ............... .......................... 8204929: Fonts with embedded bitmaps are not always rotated That commit corresponds to this mercurial commit: http://hg.openjdk.java.net/jdk/jdk/rev/db4f24a6cf34 =============================================
28-12-2018

Testing by someone who could reproduce this confirms that the fix for 8214002 cured this one too. Presumably what was happening was a mismatch of one pixel, eg the size zeroed out in the cache may have been one pixel too small .. or one pixel too many was used when reading from the cache ? But unless we go through the bitmap bolding path I'd not expect this to be seen. And I'd expect to have "real" bold fonts for these cases. I think we checked that 18.10 had real bold fonts, so I am not sure I have the exact picture yet. And whywas it a problem only for the system bundled freetype ? Downgrading to P4 .. I want to keep it open for at least a little bit in case I get some time to understand it better.
11-12-2018

A perhaps unrelated issue due to 8204929 was just fixed as 8214002. If anyone has 18.10 and could reproduce THIS problem, it would be interesting to know if it is still there in a build with the fix for 8214002. Meanwhile re-targeting to 13.
09-12-2018

This was recently (since 18.10 is recent) observed internally too. Interestingly it reproduced only with the version of freetype shipped with 18.10 If we simply recompiled to use the version of freetype in the JDK sources (a very new version) the problem went away.
27-11-2018

Additional from submitter: =========================== Additional Information: I did a "git bisect" session against the github mirror (https://github.com/openjdk/jdk) and could track it down to this commit: ee8af63017a93a5a80413a88b4b00694bb9171a2 is the first bad commit commit ee8af63017a93a5a80413a88b4b00694bb9171a2 Author: ............... Date: Fri Jun 15 13:05:34 2018 -0700 8204929: Fonts with embedded bitmaps are not always rotated That commit corresponds to this mercurial commit: http://hg.openjdk.java.net/jdk/jdk/rev/db4f24a6cf34 ===========================================
27-11-2018

Font rendering shows artifacts around glyphs with JDK 11. Checked this for reported versions and could confirm the issue. Results: ========== 8u191: OK 10.0.2: OK 11: Fail 11.0.1: Fail 12 ea b20: Fail To reproduce, follow instructions as below: 1. Download and untar attached file 2. Extract it, change into the "SimpleSample" folder 3. Run "mvn package" 4. Run "java -jar target/SimpleSample-1.0-SNAPSHOT.jar" Rendering artifacts appears around the edge of the bounding box of the glyphs with JDK 11 and onward (See attached screenshots as reference).
26-11-2018