-
Bug
-
Resolution: Not an Issue
-
P1
-
None
-
1.2.0
-
sparc
-
solaris_2.6
Incorrect line is rendered when we paint japanese characters as Shape object
produced from getOutline() of GlyphVector class using draw() method of Graphics2D class. For example, in following sample program Font2.java, a character rendered correctly by drawString() method is not rendered correctly by draw() and moving line which is not a part of the character is rendered. In following program, four same japanese characters which mean 'a rice field' in English is displayed.
---------------------------- Font2.java ------------------------------------
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.font.*;
public class Font2 extends Canvas {
public Font2() {
setBackground(Color.white);
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.black);
// Describe the font to use and instance it
// String text = new String("Ĺ²¬ ¿Ê");
String text = new String("ÅÄ ÅÄ ÅÄ ÅÄ");
Font theFont = new Font("Dialog", Font.PLAIN, 50);
g2d.setFont(theFont);
g2d.drawString(text, (float)0, (float)50);
FontRenderContext frc = g2d.getFontRenderContext();
Shape shape = theFont.createGlyphVector(frc, text).getOutline();
g2d.translate(0, 100);
g2d.draw(shape);
}
public static void main(String s[]) {
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0); }
public void windowClosed(WindowEvent e) {System.exit(0); }
};
Frame f = new Frame ("2D text demo");
f.addWindowListener(l);
f.add("Center", new Font2());
f.pack();
f.setSize(new Dimension(500,500));
f.show();
}
}
The word displayed by draw method must be following,
when it is expanded.
+-------------+
| +---+ +---+ |
| | | | | |
| +---+ +---+ |
| +---+ +---+ |
| | | | | |
| +---+ +---+ |
+-------------+
But,the rendering by sample program (Font2.java) includes
strange three line. The three line seems to be shaping triangle.
Please investigate again!
produced from getOutline() of GlyphVector class using draw() method of Graphics2D class. For example, in following sample program Font2.java, a character rendered correctly by drawString() method is not rendered correctly by draw() and moving line which is not a part of the character is rendered. In following program, four same japanese characters which mean 'a rice field' in English is displayed.
---------------------------- Font2.java ------------------------------------
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.font.*;
public class Font2 extends Canvas {
public Font2() {
setBackground(Color.white);
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.black);
// Describe the font to use and instance it
// String text = new String("Ĺ²¬ ¿Ê");
String text = new String("ÅÄ ÅÄ ÅÄ ÅÄ");
Font theFont = new Font("Dialog", Font.PLAIN, 50);
g2d.setFont(theFont);
g2d.drawString(text, (float)0, (float)50);
FontRenderContext frc = g2d.getFontRenderContext();
Shape shape = theFont.createGlyphVector(frc, text).getOutline();
g2d.translate(0, 100);
g2d.draw(shape);
}
public static void main(String s[]) {
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0); }
public void windowClosed(WindowEvent e) {System.exit(0); }
};
Frame f = new Frame ("2D text demo");
f.addWindowListener(l);
f.add("Center", new Font2());
f.pack();
f.setSize(new Dimension(500,500));
f.show();
}
}
The word displayed by draw method must be following,
when it is expanded.
+-------------+
| +---+ +---+ |
| | | | | |
| +---+ +---+ |
| +---+ +---+ |
| | | | | |
| +---+ +---+ |
+-------------+
But,the rendering by sample program (Font2.java) includes
strange three line. The three line seems to be shaping triangle.
Please investigate again!