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

Philip Race philip.race at oracle.com
Sun Dec 30 22:40:46 UTC 2018


This is Windows ? What is your Windows desktop DPI setting ?
If its greater than 100% (aka 96 dpi) you will see a difference in JDK 9+
because of hidpi .. have you tried running on Oracle JDK 9 or JDK 10 ?
If you see similar there then you can rule out t2k->freetype.

-phil.

On 12/30/18, 4:43 AM, Tredinnick, Jacob wrote:
>
> Thank you Philip!
>
> (Someone else in our team had submitted the bug report before going on 
> vacation & I didn't realize that we couldn't search based on the 
> original ID).
>
> Looking at your comment on the bug, you are seeing differences of only 
> a pixel, but in our application we are getting very large differences 
> in the size of text.
>
> For example here is a "diff" that one of our tests generated for the 
> Calibri "text object" in Java 8:
>
> The blue text is from a golden reference generated with Java 8 and the 
> red text is from the test running in Java 11.
>
> The rectangle is just a rectangle graphic which remains unchanged 
> between Java versions.
>
> (I hope that the image in this mail makes it through to the mail list...)
>
> I believe that the calculation of the bounding box for the text is 
> based on the result of FontMetrics.getMaxAscent() and other 
> FontMetrics methods, so the difference that we see is very significant 
> indeed.
>
> Are you saying that we should not be relying on these font metrics for 
> scaling of text in our applications?
>
> Unfortunately I cannot share our application code that results in 
> these large differences, but we will work next week on making an 
> example that we can share here...
>
> Thanks
>
> --
>
> Jake
>
> *From:*Philip Race [mailto:philip.race at oracle.com]
> *Sent:* 29 December 2018 17:56
> *To:* Tredinnick, Jacob <jacob_tredinnick at mentor.com>
> *Cc:* 2d-dev at openjdk.java.net
> *Subject:* Re: [OpenJDK 2D-Dev] FontMetrics differ between OracleJDK 8 
> and OpenJDK 11
>
> You can't find your report since it was mapped into this public report :
> https://bugs.openjdk.java.net/browse/JDK-8215290
>
> You should have received an email to that effect.
>
> -phil.
>
> On 12/29/18, 7:50 AM, Tredinnick, Jacob wrote:
>
>     Hello,
>
>     My team is currently working on migrating some of our (mostly
>     Desktop & Swing-based) applications from OracleJDK 8 to OpenJDK 11
>     and we have discovered that some fonts in our application are
>     getting drawn significantly differently e.g. significantly larger,
>     differences with spaces between characters.
>
>     When debugging, we found that the FontMetrics for the Font
>     obtained as follows:
>
>     FontMetrics metrics =
>     Toolkit.getDefaultToolkit().getFontMetrics(font);
>
>     Returns significantly different values:
>
>     For example a plain, size 12 Calibri font:
>
>     In OracleJDK 8 metrics.getMaxAscent() returns 11, while in
>     OracleJDK 11 it returns 9.
>
>     I understand that the proprietary "T2K" font engine was replaced
>     by "FreeType" in OpenJDK but I'm surprised at the very noticeable
>     differences that we now see in some of our text objects.
>
>     Is it expected that FontMetrics would be so significantly
>     different between OracleJDK 8 and OpenJDK 11?
>
>     Note: I can share the code that generates the font metrics as well
>     as a file describing all the diffs for fonts on my laptop if needed.
>
>     Note also:
>
>     We did attempt to submit a bug for this behaviour via
>     https://bugreport.java.com/bugreport/
>
>     But when we search for our bug ID 9058505 there are no results,
>     presumably meaning that no-one has accepted this as a bug so far.
>
>     I'm not sure if anyone here is able to find out what happened to
>     our report?
>
>     Thanks
>
>     --
>
>     Jake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20181230/b1a35053/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 2517 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20181230/b1a35053/attachment-0001.png>


More information about the 2d-dev mailing list