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

Chinese characters not drawn correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3
    • client-libs



      Name: joT67522 Date: 12/01/97


      1. Steps to reproduce the problem:
         * Compile the following applet called "bug"
         * Run it with appletviewer (bug.html also attached)
         * All the Chinese strings are the two characters string
           "four" followed by "up". Notice that while
           button, choice and Graphics.drawString draw
           the second character correctly and miss the first
           character, text area draws the first character
           correctly and misses the second character.

      2, source code
      ==== file bug.java ====
      import java.awt.*;
      import java.applet.*;

      public class bug extends Applet {
         // a two-character Chinese string, "four" and "up", in Unicode
        String ChineseString = "\u00a5|\u4e0a";

        public void init() {
          setLayout(null);

          setBackground(Color.lightGray);
          Choice choice = new Choice();
          choice.setBounds(0,0,100,20);
          choice.addItem(ChineseString);
          add(choice);

          Button button = new Button(ChineseString);
          button.setBounds(0,21,100,20);
          add(button);

          TextArea textArea = new TextArea();
          textArea.setText(ChineseString);
          textArea.setBounds(0,41, 200,40);
          add(textArea);

          MyComponent myComponent = new MyComponent();
          myComponent.setBounds(101,0, 100,40);
          add(myComponent);
        }

        // MyComponent is a light-weight component whose only purpose is to
        // exercise Graphics.drawString
        class MyComponent extends Component {
          public void paint(Graphics g) {
            g.drawString(ChineseString, 20,20);
          }
        }
      }
      ==== file bug.html ====
      <head><title>bug</title></head>
      <body><applet code="bug.class" width = 200 height=80></applet>/body>

      3. there were no error messages
      4. there were no trace infomation
      5. I'm using US English NT 4.0 with Chinese fonts
         installed from the Microsoft NT CD's langpak
         directory. My fonts.properties is a copy
         of font.properties.zh_TW as per instructions
         of the JDK doc. My NT has service pack 3 installed
         complete with the latest Microsoft "hot fix"
         for service pack 3.



      (Review ID: 20135)
      ======================================================================

            ssenthilsunw Shanmugam Senthil (Inactive)
            johsunw Joon Oh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: