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

Philip Race philip.race at oracle.com
Mon Dec 31 18:23:04 UTC 2018



On 12/31/18, 3:29 AM, Tredinnick, Jacob wrote:
>
> > 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+
>
> This particular test was done on my laptop on Windows 7 with default 
> scaling options and a 1920x1080 (maximum) screen resolution.
>

"default scaling options" can be > 100% so that  is not answering the 
question.

> I don't believe that it is due to HDPI scaling as the rectangle 
> graphic would also have been affected?
>

Perhaps. It depends how you drew it.

>
> > 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.
> We haven't yet tried this test on OracleJDK 9 or 10 but we will look 
> into this.
>
> We will also check the behaviour with OpenJDK 8 vs OracleJDK 8 as I 
> believe we will see the same problem there.
>
> From our debugging it is fairly clear that change in rendering comes 
> from the different font metrics coming from the removal of T2K.
>
> We will work this week on some sample code demonstrating the problem...
>

Ok but different font metrics don't make the glyph images 30% bigger ..
which is how your image looks.
Maybe you are using that somehow to determine the font size to use in
a way that I can't divine.

-phil.
>
> *From:*Philip Race [mailto:philip.race at oracle.com]
> *Sent:* 30 December 2018 22:41
> *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
>
> 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>
>     <mailto:jacob_tredinnick at mentor.com>
>     *Cc:* 2d-dev at openjdk.java.net <mailto: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: <https://mail.openjdk.java.net/pipermail/2d-dev/attachments/20181231/c9ff9791/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 15848 bytes
Desc: not available
URL: <https://mail.openjdk.java.net/pipermail/2d-dev/attachments/20181231/c9ff9791/attachment-0001.jpe>


More information about the 2d-dev mailing list