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

Hiragana/Katakana characters are not rendered equaly spaced out using getJustifiedLayout()

    XMLWordPrintable

Details

    • 2d
    • generic
    • generic

    Backports

      Description

        When We ran the testcase src/GS/font-render/2d/two/TextLayoutTest.java on Rehdhat_amd64-
        5.ja_JP.UTF-8 config. Words are not be rendered equaly spaced out on line 3. The JAVA_HOME
        is 5u15b01,the GlobalSuite is gs15UR-b03.tar. TextLayoutTest-Line3.JPG is the screen shot
        in attachements. This issue is produced in Windows/Linux/Solaris for 5u15b01 and 6u5b10.

        This issue can be produced using TextLayoutTest.java in in attachements.TextLayouTest.png is the screen shot of TextLayoutTest.java in attachements.
        The issue is produced That We ran TextLayoutTest.java program on JDK1.6.0_03-b05.
        Below is the source code of TextLayoutTest.java:

        -------------------- Source Begin -----------------------------
        /**
         * @author Zhaoxiong.zhang
         */
        import java.awt.*;
        import java.awt.event.*;
        import java.awt.font.*;

        public class TextLayoutTest extends Frame {
             public static void main(String[] args) {
                TextLayoutTest frame=new TextLayoutTest();
                frame.setTitle("Text Layou Test");
            }
            
            public TextLayoutTest() {

                _TextLayoutTest test = new _TextLayoutTest();
                add("Center", test);
                setSize(400, 200);
                setVisible(true);
                addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent e){
                        System.exit(0);
                    }
                });
            }

            class _TextLayoutTest extends Canvas {
                private TextLayout tl1,tl2,copytl1,copytl2;
                private Font smallFont;
                private String ftName;
                //Any CJK Unified caracter, unicode range is 4E00-9FBF. Words are be rendered equaly
        spaced out.
                String str1 = "\u8fd9\u679a\u91d1\u724c\u5c06\u4e0d\u662f\u5f52\u4e8e\u662f";
                // Any hiragana(3040-309F) or katagana(30A0-30F) character. Words are not be
        rendered equaly spaced out
                String str2 = "\u3042\u3044\u3046\u3048\u304a\u30ac\u30ae\u30b0\u30b2\u30b4";
                
                public _TextLayoutTest() {
                    ftName = "Dialog";
                    smallFont = new Font(ftName, Font.ITALIC, 24);
                    tl1 = new TextLayout(str1, smallFont,new FontRenderContext(null, false, false));
                    tl2 = new TextLayout(str2, smallFont,new FontRenderContext(null, false, false));
                }

                public void paint(Graphics g) {
                    Graphics2D g2d = (Graphics2D)g;
                    int w = getSize().width;

                    // getJustifiedLayout()
                    TextLayout copytl1 = tl1.getJustifiedLayout(w);
                    TextLayout copytl2 = tl2.getJustifiedLayout(w);
                    copytl1.draw(g2d, 0.0f, 40);
                    copytl2.draw(g2d, 0.0f, 100);
                }
            }
        }

        --------------------- END -------------------------------------

        Attachments

          Issue Links

            Activity

              People

                srl Steven Loomis
                duke J. Duke
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: