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

antialiased drawstring (t2k) fails to rasterize Chinese character correctly on W

XMLWordPrintable

    • 2d
    • beta
    • generic, x86
    • windows_98, windows_nt

      t2k fails to rasterize Chinese character correctly on WinNT_tw, on
      WinNT_tw, the default Chinese ttf/ttc fonts use composite glyph
      date, seems like these composite glyph date do not use _SCALE_
      flags to scale the component glyph date but the instructions, and
      unfortunately, looks like our t2k never uses these glyph
      instructions.

      The attached sample showes the problem on WinNT_tw


      import java.awt.*;
      import java.awt.font.*;
      import java.awt.geom.*;

      public class Draw {

        TestCanvas tc;
        public Draw(String text){
          Frame frame = new Frame("Test");
          frame.setLayout(new BorderLayout());
          tc = new TestCanvas();
          tc.setText(text);
          frame.add("Center", tc);
          frame.pack();
          frame.setVisible(true);
        }

        public static void main( String[] args ) {
          int size;
          String text;

          text = new String("\u7d30"); //\u660e\u9ad4");
          //text = new String("ABCD");

          Draw draw = new Draw(text);
        }

        class TestCanvas extends Canvas {
          String text = null;
          Font font72 = null;

          int w = 400;
          int h = 600;

          void setText(String ss){
            text = ss;
          }
          void initFont(){
            font72 =new Font("MingLiu", Font.PLAIN, 144);
          }
          public TestCanvas() {
            super();
            initFont();
            setSize(w, h);
            setBackground(Color.white);
          }

          public void paint(Graphics g) {
            Graphics2D g2 = (Graphics2D)g;
            g2.setColor(Color.red);
            g2.setFont(font72);
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2.drawString(text, 100, 300);
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
            g2.drawString(text, 100, 500);
          }
        }
      }



      Name: krT82822 Date: 08/17/99


      I use sun provides the print example - printbutton;
      I change

        Font f = new Font("serif", Font.PLAIN, 24);
      to
        Font f = new Font("??????", Font.PLAIN, 24);
      and change
        MyButton b = new MyButton("test");
      to
        MyButton b = new MyButton("????");

      then send job to the HP 5S printer.
      The printed result shows the chinese font shape incorrectly.

      Please help me to solve the Chinese font printint problem.

      Thanks
      (Review ID: 93757)
      ======================================================================

            pkejriwasunw Parry Kejriwal (Inactive)
            sherman Xueming Shen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: