-
Bug
-
Resolution: Fixed
-
P3
-
1.4.1
-
rc
-
x86, sparc
-
linux_redhat_7.2, solaris_8
There is a text measurement regression in JDK 1.4.1 on Solaris and Linux
The following program prints "37" as the width of the string
when run on JDK1.4, but "0" on JDK 1.4.1.
The problem appears to have begun around the time that changes were
made to mappings of the legacy font names.
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
public class RotMetricsBug {
public static void main(String[] args) {
BufferedImage bi = new BufferedImage(10,10,BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = (Graphics2D)bi.getGraphics();
g2d.rotate(Math.PI*3/2.0);
Font f= new Font("helvetica", Font. PLAIN, 12);
g2d.setFont(f);
FontMetrics fm = g2d.getFontMetrics();
System.out.println("Str wid = " + fm.stringWidth("abcdef"));
Rectangle2D r2d = fm.getStringBounds("abcdef", g2d);
System.out.println("wid = " + (float)r2d.getWidth());
}
}
This is a particular problem when printing using this font in landscape
mode as landscape mode involves a rotated graphics, and the above APIs are
used in generating postscript.
The following program prints "37" as the width of the string
when run on JDK1.4, but "0" on JDK 1.4.1.
The problem appears to have begun around the time that changes were
made to mappings of the legacy font names.
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
public class RotMetricsBug {
public static void main(String[] args) {
BufferedImage bi = new BufferedImage(10,10,BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = (Graphics2D)bi.getGraphics();
g2d.rotate(Math.PI*3/2.0);
Font f= new Font("helvetica", Font. PLAIN, 12);
g2d.setFont(f);
FontMetrics fm = g2d.getFontMetrics();
System.out.println("Str wid = " + fm.stringWidth("abcdef"));
Rectangle2D r2d = fm.getStringBounds("abcdef", g2d);
System.out.println("wid = " + (float)r2d.getWidth());
}
}
This is a particular problem when printing using this font in landscape
mode as landscape mode involves a rotated graphics, and the above APIs are
used in generating postscript.
- duplicates
-
JDK-4700328 REG:Printing of jpg images with landscape orientation in not happening in Linux
-
- Closed
-