<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I see you noticed the problem with it not necessarily being an AAT
    font.<br>
    It seems this method is a copy/paste of the method added in JDK 9.<br>
    So this will work but looking at it, I think in JDK 9 I should have
    made this more efficient.<br>
    Probably it was a detail in the larger work, that I never came back
    to.<br>
    On MacOS where it calls through the PhysicalFont interface, since
    CFont is not a TrueTypeFont,<br>
    it will be retrieving all the data in the table from native to Java
    on every call to layout. That will be expensive.<br>
    <br>
    You can mitigate this in your case by reversing the order here <br>
    <pre><span class="new">+        if (isAAT(font) && (typo_flags & 0x80000000) != 0) {</span></pre>
    <br>
    to<br>
    <pre><span class="new">+        if (((</span><span class="new"><span class="new">typo_flags & 0x80000000) != 0)</span> && isAAT(font)) {</span></pre>
    <br>
    So it will only take the hit for RTL text which will save a lot of
    cases  ...<br>
    I have filed <a class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-8210384">https://bugs.openjdk.java.net/browse/JDK-8210384</a> which
    I will fix for 12.<br>
    <br>
    Up to you whether you also want to wait for that fix, or just update
    as I have suggested<br>
    and maybe take a follow-on fix later.<br>
    <br>
    Note that whilst your fix will at least make sure text reads in the
    correct direction, it<br>
    means it will be using default built-in shaping rules of ICU and so
    may miss at least<br>
    some features provided by the font.<br>
    <br>
    -phil.<br>
    <br>
    <div class="moz-cite-prefix">On 09/03/2018 05:54 AM, Dmitry Markov
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:AE90AAD2-2DDA-4572-996F-073A64CC15DD@oracle.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal; font-family: Arial;" class="">Hi Prasanta,</div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal; font-family: Arial; min-height: 14px;" class=""><br
          class="">
      </div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal; font-family: Arial;" class="">Thank you for the
        feedback. I missed the usage of OSX specific class in shared
        code for some reasons. Please find the updated webrev here: <a
href="http://cr.openjdk.java.net/%7Edmarkov/8201801/jdk8u/webrev.01/"
          class="" moz-do-not-send="true">http://cr.openjdk.java.net/~dmarkov/8201801/jdk8u/webrev.01/</a></div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal; font-family: Arial;" class="">I replaced the usage of
        CFont with a new private method which tests either a font is AAT
        or not.</div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal; font-family: Arial; min-height: 14px;" class=""><br
          class="">
      </div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal; font-family: Arial;" class="">The issue is jdk8u (ICU)
        specific. It does not take place on jdk12 because starting from
        jdk9 we use <span style="font-stretch: normal; line-height:
          normal; font-family: Helvetica; -webkit-font-kerning: none;"
          class="">Harfbuzz as default layout engine.</span></div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal; min-height: 14px;" class=""><span style="font-kerning:
          none" class=""></span><br class="">
      </div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal;" class=""><span style="font-kerning: none" class="">Thanks,</span></div>
      <div style="margin: 0px; font-stretch: normal; line-height:
        normal;" class=""><span style="font-kerning: none" class="">Dmitry</span><span
          style="font-stretch: normal; line-height: normal; font-family:
          Arial;" class=""> </span></div>
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On 3 Sep 2018, at 11:33, Prasanta Sadhukhan <<a
              href="mailto:prasanta.sadhukhan@oracle.com" class=""
              moz-do-not-send="true">prasanta.sadhukhan@oracle.com</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=utf-8" class="">
            <div text="#000000" bgcolor="#FFFFFF" class="">
              <p class="">Hi Dmitry,<br class="">
              </p>
              Not going into technicalities of the fix, but it seems it
              will break non-macos build as you are checking for CFont
              in a shared class?<br class="">
              Also, if it's the issue still exists, then why you are
              fixing only in 8u and not in jdk12?<br class="">
              <br class="">
              Regards<br class="">
              Prasanta<br class="">
              <div class="moz-cite-prefix">On 9/3/2018 3:20 PM, Dmitry
                Markov wrote:<br class="">
              </div>
              <blockquote type="cite"
                cite="mid:D32A2961-B9E3-48E7-95A8-8FF6CE1F8D5F@oracle.com"
                class="">
                <meta http-equiv="Content-Type" content="text/html;
                  charset=utf-8" class="">
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">Hello,</div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial; min-height:
                  14px;" class=""><br class="">
                </div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">Could
                  you review a fix for jdk8u, please?</div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial; min-height:
                  14px;" class=""><br class="">
                </div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>bug:
                  <a
                    href="https://bugs.openjdk.java.net/browse/JDK-8201801"
                    class="" moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-8201801</a></div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>webrev:
                  <a
                    href="http://cr.openjdk.java.net/%7Edmarkov/8201801/jdk8u/webrev.00/"
                    class="" moz-do-not-send="true">http://cr.openjdk.java.net/~dmarkov/8201801/jdk8u/webrev.00/</a></div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial; min-height:
                  14px;" class=""><br class="">
                </div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">Problem
                  description:</div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">The
                  fix for 7162125 [1] enabled font tables processing on
                  OSX. However there is a lack of support for RTL
                  languages in ICU layout engine. Quote from ICU guide:
                  “…The AAT processing in the LayoutEngine is relatively
                  basic as it only applies the default features in
                  left-to-right text. This processing has been tested
                  for Devanagari text. Since AAT processing is not
                  script-specific, it might not work for other
                  scripts…”, more details at <a
                    href="http://userguide.icu-project.org/layoutengine"
                    class="" moz-do-not-send="true">http://userguide.icu-project.org/layoutengine</a></div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">As
                  a result all RTL languages on OSX are incorrectly laid
                  out, (i.e. the letters are reversely presented).</div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial; min-height:
                  14px;" class=""><br class="">
                </div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">Fix:</div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">Skip
                  font tables for RTL languages on OSX platform.  </div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial; min-height:
                  14px;" class=""><br class="">
                </div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">Thanks,</div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">Dmitry</div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial; min-height:
                  14px;" class=""><br class="">
                </div>
                <div style="margin: 0px; font-stretch: normal;
                  line-height: normal; font-family: Arial;" class="">[1]
                  - <a
                    href="https://bugs.openjdk.java.net/browse/JDK-7162125"
                    class="" moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-7162125</a></div>
              </blockquote>
              <br class="">
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
    </blockquote>
    <br>
  </body>
</html>