Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6725387

Myanmar Unicode 5.1 OpenType fonts don't render correctly

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • CPU:
      generic, x86
    • OS:
      generic, linux

      Description

      A DESCRIPTION OF THE REQUEST :
      There are now several OpenType Myanmar fonts using features such as clig,liga,kern,mark,mkmk however Java does not process these correctly. Even if kerning and ligatures are explictly enabled, java does not use them because of a typoFlags bug in native/sun/font/layout/OpenTypeLayoutEngine.cpp - see separate bug report (TextAttributes for Ligatures and Kerning don't work with complex text).

      The workaround listed below is also dependent on the patch attached to the other bug report.
      For the correct Myanmar Unicode 5.1 character attributes jdk/make/tools/UnicodeData/UnicodeData.txt must be updated to the data from Unicode 5.1.
      If this is not done the patch can be tweaked so that the eflags are set based on just the script, not the character type.

      For more info see discussion on 2D-Dev list.

      JUSTIFICATION :
      Myanmar Unicode text cannot be used in Java 2D.

      Kerning and Ligatures should be enabled by default for Myanmar since most Myanmar words will be unreadable without them. Users should not have to set the TextAttributes for this. Currently, even if they do the text is still unreadable because OpenTypeLayoutEngine ignores typoFlags > 3, not 0x4 | 0x3 == 7.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Correct rendering of Burmese/Myanmar for fonts using generic OpenType features such as liga,clig,kern,mark,mkmk.

      e.g. ¿¿¿¿¿¿¿¿¿¿¿¿ should render correctly e.g with Padauk font http://scripts.sil.org/Padauk e.g. the wrap around the first consonant should be before the first consonant. The 3rd from last code point should be stacked underneath the previous consonant.
      ACTUAL -
      No ligatures and kerning occur, text is unreadable.

      ---------- BEGIN SOURCE ----------
      // Cut and paste this into createEditor method in Notepad.java in OpenJDK examples and
      // set font=Padauk in Notepad.properties

      /**
           * Create an editor to represent the given document.
           */
          protected JTextComponent createEditor() {
              JTextComponent c = new JTextArea();
              c.setDragEnabled(true);
              Font f = new Font("monospaced", Font.PLAIN, 12);
              if (resources.containsKey("font"))
                  f = new Font(resources.getString("font"), Font.PLAIN, 18);
              Map<AttributedCharacterIterator.Attribute, Object> attributes = new HashMap<AttributedCharacterIterator.Attribute, Object>();
              attributes.put(TextAttribute.FONT, f);
              attributes.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
              attributes.put(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON);
              c.setFont(Font.getFont(attributes));
              return c;
          }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      --- jdk/src/share/classes/sun/font/GlyphLayout.java.orig 2008-05-29 21:01:33.000000000 +0700
      +++ jdk/src/share/classes/sun/font/GlyphLayout.java 2008-06-26 02:33:51.000000000 +0700
      @@ -647,8 +647,12 @@
                       if (gc == NON_SPACING_MARK ||
                           gc == ENCLOSING_MARK ||
                           gc == COMBINING_SPACING_MARK) { // could do range test also
      + if (script == 28) { // Myanmar - see LEScripts.h
      + this.eflags = 0x7;// 1=kerning, 2=ligatures - 7 only works if OpenTypeLayoutEngine.cpp is patched, otherwise 3 is sufficient for MM
      + break;
      + }
       
      - this.eflags = 0x4;
      + this.eflags = 0x4; // 4 = canonical processing
                           break;
                       }
                   }
      --- jdk/src/share/classes/sun/font/FontManager.java.orig 2008-05-28 18:46:03.000000000 +0700
      +++ jdk/src/share/classes/sun/font/FontManager.java 2008-05-30 03:33:31.000000000 +0700
      @@ -3594,6 +3594,12 @@
                   // 0E00 - 0E7F if Thai, assume shaping for vowel, tone marks
                   return true;
               }
      + else if (code < 0x1000) {
      + return false;
      + }
      + else if (code < 0x10A0) { // 1000-109F Myanmar
      + return true;
      + }
               else if (code < 0x1780) {
                   return false;
               }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              srl Steven Loomis
              Reporter:
              igor Igor Nekrestyanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Imported:
                Indexed: