[OpenJDK 2D-Dev] FontMetrics differ between OracleJDK 8 and OpenJDK 11

Philip Race philip.race at oracle.com
Wed Jan 2 18:38:00 UTC 2019


I am on vacation for (another) week but it is possible that what
you are describing is a bug whereby a transformation that is in effect
was not inverted before returning metrics to the application.
https://bugs.openjdk.java.net/browse/JDK-8139178

This notably affected rotations but could be in play here too although
I haven't tested this. It was fixed very recently so you will need to try a
JDK 12 EA build here : https://jdk.java.net/12/

-phil.

On 1/2/19, 8:44 AM, Tredinnick, Jacob wrote:
>
> Philip,
>
> Default scaling options are "Medium - 125%" on Windows 7.  You are 
> correct this does affect things but read on...
>
> Basically, we are using these FontMetrics values to determine a scale 
> transformation to apply to a size 12 font.  HDPI might be playing in 
> somewhere here, but the problem we know about is with our use of 
> FontMetrics.
>
> I wrote some code to demonstrate our problem (source at the end of 
> this message).  The application shows:
>
> ·An example string drawn using 
> java.awt.Graphics#drawString(java.lang.String, int, int) with a 
> "normal" font object: Calibri plain, size 12
>
> ·The same string drawn based on a Font that is "scaled" (nothing to do 
> with HDPI) using a simplified version of what our application does 
> with the FontMetrics object (we also have zoom levels and users may 
> specify their font sizes in various ways)
>
> ·2 rectangles with sizes hard-coded to wrap these texts when run on my 
> system with OracleJDK 8 (what our applications currently use), for use 
> when comparing the screenshots
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/2d-dev/attachments/20190102/15be0446/attachment.html>


More information about the 2d-dev mailing list