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

Malayalam glyph substitution is failing for Malayalam with Windows Kartika font.

    XMLWordPrintable

Details

    • 2d
    • b14
    • x86
    • windows_xp

    Backports

      Description

        FULL PRODUCT VERSION :
        java version "1.6.0_13"
        Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
        Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)

        We are trying to render characters from the Indic Malayalam language

        I have coded the example as both an .html and .java file. The example attempts to render two lines of Malayalam characters. The two lines differ only in the last character,

        \u0D2C\u0D3E\u0D32\u0D28\u0D4D
        and
        \u0D2C\u0D3E\u0D32\u0D28\u0D4D\u200D

        The last character, \u200D, (a "zero width joiner") should
        trigger a ligature to be formed.

        The .html example is rendered correctly using Internet Explorer.
        The .java example does not render the second line correctly.
        Both the java.awt.font.TextLayout and Font.layoutGlyphVector
        fail to render correctly.

        The bug has attachments two PNG files
        jdk_kartika.png : JDK rendering via the Java program below
        ie_kartika.ong : IE rendering of the HTML

        Java :-
        -------
        import java.awt.*;
        import java.awt.font.*;
        import java.util.*;
        import javax.swing.*;


        public class MalayalamTest extends JFrame
        {
            private static String[] TEXT =
            {
                "Testing glyph substitution for Malayalam language.",
                "\u0D2C\u0D3E\u0D32\u0D28\u0D4D",
                "0D2C 0D3E 0D32 0D28 0D4D",
                "\u0D2C\u0D3E\u0D32\u0D28\u0D4D\u200D",
                "0D2C 0D3E 0D32 0D28 0D4D 200D"
            };
           
           
            private static Font font;
           

            public static void main(String[] args)
              throws Exception
            {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
               
                // set the language to Malayalam
                Locale.setDefault(new Locale("ml"));

                // create the rendering font
                HashMap attrs = new HashMap();
                attrs.put(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON);
                attrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
                font = new Font("Kartika", Font.PLAIN, 24).deriveFont(attrs);
                System.out.println("using " + font);

                // display the test JFrame
                MalayalamTest f = new MalayalamTest();
                f.setTitle("Malayalam Test");
                f.setSize(600, 300);
                f.setForeground(Color.black);
                f.show();
            }
           
           
            public void paint(Graphics g)
            {
                Graphics2D g2 = (Graphics2D) g;
                g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                                   RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
                FontRenderContext frc = g2.getFontRenderContext();

                for (int i = 0; i < TEXT.length; i++)
                {
                    String text = TEXT[i];
                    int x = 10;
                    int y = 60 + 40*i + 20*((i+1)/2);
                   
                    // render using TextLayout
                    TextLayout layout = new TextLayout(text, font, frc);
                    layout.draw(g2, x, y);


                }
            }
        }

        ---

        HTML :-

        <html>
            <head>
                <title>Malayalam Test</title>
            </head>
           
            <body>
                <h3>Testing glyph substitution for Malayalam language</h3>
                <br>
               
                <font size="32" face="Kartika">&#x0D2C;&#x0D3E;&#x0D32;&#x0D28;&#x0D4D;</font>
                <code>0D2C 0D3E 0D32 0D28 0D4D</code>
                <br><br><br>

                <font size="32" face="Kartika">&#x0D2C;&#x0D3E;&#x0D32;&#x0D28;&#x0D4D;&#x200D;</font>
                <code>0D2C 0D3E 0D32 0D28 0D4D 200D</code>
                <br>
                The last three unicode characters form a ligature (glyph substitution)
            </body>
        </html>

        Attachments

          Issue Links

            Activity

              People

                prr Philip Race
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: