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

Boxes are displayed instead of RTL chars in 2d test cases

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs
    • 2d
    • generic
    • generic



      Name: jbT81659 Date: 12/28/2001

      Locale: iw_IL, ar_SA, en_US
      OS: Solaris8_Intel(iw_IL), windows XP(en_US)
      Build: jdk1.4.0-b89, jdk1.4.0-b90

      The following testcases found in GlobalSuite under the directory: "test/font-render/2D/One"
      display a box instead of a char at the begining of each bidi sentence after execution.
       CanvasRenderTest1.java, TextLayoutRenderTest1.java, TextLayoutRenderTest10.java,
        TextLayoutRenderTest5.java, TextRotationRenderTest.java, TextScaleRenderTest.java
        TextTransformRenderTest.java

      To reproduce bug:
      Assuming that GlobalSuite is already installed on your machine,
      - Log into GlobalSuite directory
      - Execute the following script:

           sh run_gs.sh -jdk:<jdk home> test/font-render/2d/one/<testcase>.java
      Where <jdk home> is the directory where you installed the jdk
            <testcase.java> is the tested testcase

      - Note that boxes are displayed instead actual glyphs
      - Note that LTR text is displayed corectly

      ----------------Code----------------------------
      The testcase CanvasRenderTest1.java source code is pasted here. The other testcases source code is
      found under ../GlobalSuite/font-render/2d/one/ directory.
      /*
       * @test
       * @summary test "Serif" font rendering on a canvas component
       * @run build DefaultRenderTest
       * @run applet/manual=done CanvasRenderTest1.html
       *
       */

       import java.awt.*;
       import java.awt.event.*;
       import java.applet.*;
       import java.util.*;
       import lib.*;

       public class CanvasRenderTest1 extends DefaultRenderTest
       {
          Font baseFont = new Font("Serif", Font.PLAIN, 10);

          public void init() {

              int[] size = {10, 12, 24, 40};
              int[] styles = { Font.PLAIN, Font.ITALIC, Font.BOLD };
              String[] styleNames = { "Plain", "Italic", "Bold" };
                      String[] target = new DataPool().getStringArray("SimpleWord", "long");
                                      
              Component[][] components = new Component[size.length][styles.length];
                      
                      int k=0;
              for(int i=0; i<size.length; i++) {
                  for(int j=0; j<styles.length; j++) {
                      if(k == target.length) k=0;
                                      
                                      Font font = baseFont.deriveFont(styles[j], (float)size[i]);
                                                      
                      Canvas tcompo = new MyCanvas(target[k++]);
                      tcompo.setFont(font);
                      components[i][j] = tcompo;
                  }
              }

              setComponents(size, styles, components);
          }
              
              class MyCanvas extends Canvas {
                      
                      String text = "";
                      public MyCanvas(String atext) {
                              text = atext;
                      }
                      
                      public void paint(Graphics g) {
                      g.drawString(text, 10,50);
              }
              };
      }
      ---------------------------------------


       
        

      ======================================================================

            dougfelt Doug Felt
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: