[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] FontMetrics differ between OracleJDK 8 and OpenJDK 11
From:       Philip Race <philip.race () oracle ! com>
Date:       2018-12-31 18:23:04
Message-ID: 5C2A5E88.9000700 () oracle ! com
[Download RAW message or body]

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@oracle.com]
> *Sent:* 30 December 2018 22:41
> *To:* Tredinnick, Jacob <jacob_tredinnick@mentor.com>
> *Cc:* 2d-dev@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@oracle.com]
>     *Sent:* 29 December 2018 17:56
>     *To:* Tredinnick, Jacob <jacob_tredinnick@mentor.com>
>     <mailto:jacob_tredinnick@mentor.com>
>     *Cc:* 2d-dev@openjdk.java.net <mailto:2d-dev@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
>

[Attachment #3 (multipart/related)]

[Attachment #5 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    On 12/31/18, 3:29 AM, Tredinnick, Jacob wrote:
    <blockquote
cite="mid:9b08e40e15314dd58eeeaf3d03f74cc7@SVR-IES-MBX-03.mgc.mentorg.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <!--
[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	color:black;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
tt
	{mso-style-priority:99;
	font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:36.0pt;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	color:black;
	mso-fareast-language:EN-US;}
span.EmailStyle18
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
span.EmailStyle19
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:#1F497D;}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
span.EmailStyle21
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:#1F497D;}
span.EmailStyle22
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
span.EmailStyle23
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:#1F497D;}
span.EmailStyle25
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif][if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">&gt; This is Windows ? What is your Windows
          desktop DPI setting ?<br>
          &gt; If its greater than 100% (aka 96 dpi) you will see a
          difference in JDK 9+<o:p></o:p></p>
        <p class="MsoNormal"><span style="color: rgb(31, 73, 125);">This
            particular test was done on my laptop on Windows 7 with
            default scaling options and a 1920x1080 (maximum) screen
            resolution.</span></p>
      </div>
    </blockquote>
    <br>
    "default scaling options" can be &gt; 100% so that&nbsp; is not answering
    the question.<br>
    <br>
    <blockquote
cite="mid:9b08e40e15314dd58eeeaf3d03f74cc7@SVR-IES-MBX-03.mgc.mentorg.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color: rgb(31, 73, 125);">I
            don&#8217;t believe that it is due to HDPI scaling as the
            rectangle graphic would also have been affected?</span></p>
      </div>
    </blockquote>
    <br>
    Perhaps. It depends how you drew it.<br>
    <br>
    <blockquote
cite="mid:9b08e40e15314dd58eeeaf3d03f74cc7@SVR-IES-MBX-03.mgc.mentorg.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><br>
          &gt; because of hidpi .. have you tried running on Oracle JDK
          9 or JDK 10 ?<br>
          &gt; If you see similar there then you can rule out
          t2k-&gt;freetype.<br>
          <span style="color:#1F497D">We haven&#8217;t yet tried this test on
            OracleJDK 9 or 10 but we will look into this.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">We will also
            check the behaviour with OpenJDK 8 vs OracleJDK 8 as I
            believe we will see the same problem there.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">From our
            debugging it is fairly clear that change in rendering comes
            from the different font metrics coming from the removal of
            T2K.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color: rgb(31, 73, 125);">We
            will work this week on some sample code demonstrating the
            problem&#8230;</span></p>
      </div>
    </blockquote>
    <br>
    Ok but different font metrics don't make the glyph images 30% bigger
    ..<br>
    which is how your image looks.<br>
    Maybe you are using that somehow to determine the font size to use
    in<br>
    a way that I can't divine.<br>
    <br>
    -phil.<br>
    <blockquote
cite="mid:9b08e40e15314dd58eeeaf3d03f74cc7@SVR-IES-MBX-03.mgc.mentorg.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
                  style="color:windowtext;mso-fareast-language:EN-GB"
                  lang="EN-US">From:</span></b><span
                style="color:windowtext;mso-fareast-language:EN-GB"
                lang="EN-US"> Philip Race
                [<a class="moz-txt-link-freetext" \
href="mailto:philip.race@oracle.com">mailto:philip.race@oracle.com</a>]  <br>
                <b>Sent:</b> 30 December 2018 22:41<br>
                <b>To:</b> Tredinnick, Jacob
                <a class="moz-txt-link-rfc2396E" \
                href="mailto:jacob_tredinnick@mentor.com">&lt;jacob_tredinnick@mentor.com&gt;</a><br>
                
                <b>Cc:</b> <a class="moz-txt-link-abbreviated" \
href="mailto:2d-dev@openjdk.java.net">2d-dev@openjdk.java.net</a><br>  \
<b>Subject:</b> Re: [OpenJDK 2D-Dev] FontMetrics differ  between OracleJDK 8 and \
OpenJDK 11<o:p></o:p></span></p>  </div>
        </div>
        <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
        <p class="MsoNormal">This is Windows ? What is your Windows
          desktop DPI setting ?<br>
          If its greater than 100% (aka 96 dpi) you will see a
          difference in JDK 9+<br>
          because of hidpi .. have you tried running on Oracle JDK 9 or
          JDK 10 ?<br>
          If you see similar there then you can rule out
          t2k-&gt;freetype.<br>
          <br>
          -phil.<br>
          <br>
          On 12/30/18, 4:43 AM, Tredinnick, Jacob wrote: <span
            style="font-size:12.0pt;mso-fareast-language:EN-GB">
            <o:p></o:p></span></p>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span style="color:#1F497D">Thank you
              Philip!</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">(Someone else
              in our team had submitted the bug report before going on
              vacation &amp; I didn&#8217;t realize that we couldn&#8217;t search
              based on the original ID).</span><o:p></o:p></p>
          <p class="MsoNormal"><span \
style="color:#1F497D">&nbsp;</span><o:p></o:p></p>  <p class="MsoNormal"><span \
style="color:#1F497D">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.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">For example
              here is a &#8220;diff&#8221; that one of our tests generated for the
              Calibri &#8220;text object&#8221; in Java 8:
            </span><o:p></o:p></p>
          <p class="MsoNormal"><span \
style="color:#1F497D">&nbsp;</span><o:p></o:p></p>  <p class="MsoNormal"><span
              style="color:#1F497D;mso-fareast-language:EN-GB"><img
                id="Picture_x0020_2"
                src="cid:part1.03030705.07050707@oracle.com" width="514"
                height="52"></span><o:p></o:p></p>
          <p class="MsoNormal"><span \
style="color:#1F497D">&nbsp;</span><o:p></o:p></p>  <p class="MsoNormal"><span \
style="color:#1F497D">The blue text  is from a golden reference generated with Java 8 \
                and the
              red text is from the test running in Java 11.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">The rectangle
              is just a rectangle graphic which remains unchanged
              between Java versions.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">(I hope that
              the image in this mail makes it through to the mail \
                list&#8230;)</span><o:p></o:p></p>
          <p class="MsoNormal"><span \
style="color:#1F497D">&nbsp;</span><o:p></o:p></p>  <p class="MsoNormal"><span \
style="color:#1F497D">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.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">Are you
              saying that we should not be relying on these font metrics
              for scaling of text in our applications?</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">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...</span><o:p></o:p></p>
          <p class="MsoNormal"><span \
                style="color:#1F497D">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal"><span \
                style="color:#1F497D">Thanks</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">--</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">Jake</span><o:p></o:p></p>
          <p class="MsoNormal"><span \
style="color:#1F497D">&nbsp;</span><o:p></o:p></p>  <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0cm 0cm 0cm">
              <p class="MsoNormal"><b><span
                    style="color:windowtext;mso-fareast-language:EN-GB"
                    lang="EN-US">From:</span></b><span
                  style="color:windowtext;mso-fareast-language:EN-GB"
                  lang="EN-US"> Philip Race [<a moz-do-not-send="true"
                    href="mailto:philip.race@oracle.com">mailto:philip.race@oracle.com</a>]
  <br>
                  <b>Sent:</b> 29 December 2018 17:56<br>
                  <b>To:</b> Tredinnick, Jacob <a
                    moz-do-not-send="true"
                    href="mailto:jacob_tredinnick@mentor.com">&lt;jacob_tredinnick@mentor.com&gt;</a><br>
  <b>Cc:</b> <a moz-do-not-send="true"
                    href="mailto:2d-dev@openjdk.java.net">2d-dev@openjdk.java.net</a><br>
  <b>Subject:</b> Re: [OpenJDK 2D-Dev] FontMetrics
                  differ between OracleJDK 8 and OpenJDK 11</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          <p class="MsoNormal">You can't find your report since it was
            mapped into this public report :<br>
            <tt><span style="font-size:10.0pt"><a moz-do-not-send="true"
href="https://bugs.openjdk.java.net/browse/JDK-8215290">https://bugs.openjdk.java.net/browse/JDK-8215290</a></span></tt><br>
  <br>
            You should have received an email to that effect.<br>
            <br>
            -phil.<br>
            <br>
            On 12/29/18, 7:50 AM, Tredinnick, Jacob wrote: <o:p></o:p></p>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal">Hello,<o:p></o:p></p>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
            <p class="MsoNormal">My team is currently working on
              migrating some of our (mostly Desktop &amp; 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.<o:p></o:p></p>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
            <p class="MsoNormal">When debugging, we found that the
              FontMetrics for the Font obtained as follows:<o:p></o:p></p>
            <p class="MsoNormal">FontMetrics metrics =
              Toolkit.getDefaultToolkit().getFontMetrics(font);<o:p></o:p></p>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
            <p class="MsoNormal">Returns significantly different \
values:<o:p></o:p></p>  <p class="MsoNormal">For example a plain, size 12 Calibri
              font:<o:p></o:p></p>
            <p class="MsoNormal">In OracleJDK 8 metrics.getMaxAscent()
              returns 11, while in OracleJDK 11 it returns 9.<o:p></o:p></p>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
            <p class="MsoNormal">I understand that the proprietary &#8220;T2K&#8221;
              font engine was replaced by &#8220;FreeType&#8221; in OpenJDK but \
I&#8217;m  surprised at the very noticeable differences that we now
              see in some of our text objects.<o:p></o:p></p>
            <p class="MsoNormal">Is it expected that FontMetrics would
              be so significantly different between OracleJDK 8 and
              OpenJDK 11?<o:p></o:p></p>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
            <p class="MsoNormal">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.<o:p></o:p></p>
            <p class="MsoNormal"><span \
style="color:#1F497D">&nbsp;</span><o:p></o:p></p>  <p class="MsoNormal">Note \
also:<o:p></o:p></p>  <p class="MsoNormal">We did attempt to submit a bug for this
              behaviour via <a moz-do-not-send="true"
                href="https://bugreport.java.com/bugreport/">
                <span \
style="color:windowtext;text-decoration:none">https://bugreport.java.com/bugreport/</span></a><o:p></o:p></p>
  <p class="MsoNormal">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.<o:p></o:p></p>
            <p class="MsoNormal">I&#8217;m not sure if anyone here is able to
              find out what happened to our report?<o:p></o:p></p>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
            <p class="MsoNormal">Thanks<o:p></o:p></p>
            <p class="MsoNormal">--<o:p></o:p></p>
            <p class="MsoNormal">Jake<o:p></o:p></p>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          </blockquote>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>


[Attachment #6 (image/jpeg)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic