JDK-8243332 : [macos] Horrible font rendering to offscreen bitmaps
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8,8u251
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • Submitted: 2020-04-17
  • Updated: 2020-08-05
  • Resolved: 2020-06-09
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
java 1.8.0_251 Oracle Corporation
OSX Catalina

A DESCRIPTION OF THE PROBLEM :
Fonts rendered to the Graphics objects create by image.getGraphics() are rendered horribly, barely readable and clearly unacceptable.  The exact same drawing algorithm, rendering to the graphics object provided to Paint methods, look fine.

This applies only to OSX, not to Windows platforms.  I don't know when this damage occurred, but it wasn't always so.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Best seen on my web app, Boardspace.net. I have a switch embedded in the code that switches from internal double buffering to direct drawing, so the difference is easily producible.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Nice fonts!
https://drive.google.com/open?id=136DyxEnOnyopDuYlASFx5aFoohuTRHnD

ACTUAL -
Terrible fonts!
https://drive.google.com/open?id=1N7GyP7WOJKlruqQqPwnyIel2CMYvDV2k

and for reference, here is the same rendering as done on windows
https://drive.google.com/open?id=1gh5dXiJrKdZZyHKcA5LLDjEGjKVEfyZn

FREQUENCY : always
Comments
The fix for the bug JDK-8220150 was ported to JDK 11, JDK 8.
20-06-2020

Was able to reproduce the issue using the attached to the issue test case "example.zip" on macOS Catalina 10.15.2 with JDK 8u251 b08, JDK 8 b132. What means that the issue is not a regression in JDK 8 but a regression caused by changes in the OS. Was not able to reproduce the issue on the same host with JDK 15+26. Defined that the issue became resolved in JDK 15+19 by the fix for the bug JDK-8220150. Verified it by compiling JDK 15 from "http://hg.openjdk.java.net/jdk/client" repository with the fix JDK-8220150 and without it after its manual reversion. Porting the fix JDK-8220150 to JDK 11 release family, but currently do not plan to port the fix to JDK 8 release family. Closing the issue as a duplicate of JDK-8220150.
09-06-2020

Submitter has shared additional information with examples (attached): Here are some self contained binaries that demonstrate the problem, just run the jar contained. On the initial screen, click on "play offline" and the next screen has the problem. The "good test" is essentially the same code, but using the volatile image workaround. bad test (attached) good test (attached) These test cases are embedded in a complex ecosystem, and I'm not willing to spend the hours necessary to construct a compilable source example. The thumbnail of pseudocode for the test case is pretty simple: public void paint(Graphics realG) { Image im = Image.createImage(w,h); Graphics g = im.getGraphics(); f.stringOut("this is bad"); realG.drawImage(im,0,0); }
23-04-2020

Additional information from submitter: ================================ This appears to be a case where osx catalina changed in a way that breaks existing java binaries. A workaround is to be sure to use volatile images for offscreen drawing. https://stackoverflow.com/questions/61279721/java-1-8-0-251-osx-catalina-rendering-of-fonts-to-offscreen-windows-broken Actually,I think it is Osx that changed, but its our problem to solve. I'm able to work around the problem by using Volatile images for offscreen drawing. Existing binaries work with osx before catalina, and fail with catalina recent versions of java are all the same AFAIK.
22-04-2020

As per description, fonts rendered to the Graphics objects create by image.getGraphics() are not rendered clear. Issue is reported with JDK 8u251 running in macOS Catalina and is restricted to macOS. We need additional information including a suitable test case to verify this issue in house. Written back to the submitter requesting same.
22-04-2020