-
Bug
-
Resolution: Fixed
-
P4
-
7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2185602 | 6u21 | Philip Race | P3 | Resolved | Fixed | b01 |
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
public class Bds {
public static void main(String args[]) {
String s1 = "a";
String s2 = s1+" ";
String s3 = " "+s1;
Font f = new Font("Dialog", Font.PLAIN, 12);
FontRenderContext frc = new FontRenderContext(null, false, false);
GlyphVector gv1 = f.createGlyphVector(frc, s1);
GlyphVector gv2 = f.createGlyphVector(frc, s2);
GlyphVector gv3 = f.createGlyphVector(frc, s3);
Rectangle2D bds1 = gv1.getVisualBounds();
Rectangle2D bds2 = gv2.getVisualBounds();
Rectangle2D bds3 = gv3.getVisualBounds();
System.out.println(bds1);
System.out.println(bds2);
System.out.println(bds3);
}
}
JDK 1.5 :-
% java Bds
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=5.734375,h=6.5]
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=5.734375,h=6.5]
java.awt.geom.Rectangle2D$Float[x=3.4375,y=-6.359375,w=5.734375,h=6.5]
JDK 1.6 :-
% java Bds
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=5.734375,h=6.5]
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=6.5625,h=6.5]
java.awt.geom.Rectangle2D$Float[x=0.0,y=-6.359375,w=9.171875,h=6.5]
import java.awt.font.*;
import java.awt.geom.*;
public class Bds {
public static void main(String args[]) {
String s1 = "a";
String s2 = s1+" ";
String s3 = " "+s1;
Font f = new Font("Dialog", Font.PLAIN, 12);
FontRenderContext frc = new FontRenderContext(null, false, false);
GlyphVector gv1 = f.createGlyphVector(frc, s1);
GlyphVector gv2 = f.createGlyphVector(frc, s2);
GlyphVector gv3 = f.createGlyphVector(frc, s3);
Rectangle2D bds1 = gv1.getVisualBounds();
Rectangle2D bds2 = gv2.getVisualBounds();
Rectangle2D bds3 = gv3.getVisualBounds();
System.out.println(bds1);
System.out.println(bds2);
System.out.println(bds3);
}
}
JDK 1.5 :-
% java Bds
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=5.734375,h=6.5]
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=5.734375,h=6.5]
java.awt.geom.Rectangle2D$Float[x=3.4375,y=-6.359375,w=5.734375,h=6.5]
JDK 1.6 :-
% java Bds
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=5.734375,h=6.5]
java.awt.geom.Rectangle2D$Float[x=0.4375,y=-6.359375,w=6.5625,h=6.5]
java.awt.geom.Rectangle2D$Float[x=0.0,y=-6.359375,w=9.171875,h=6.5]
- backported by
-
JDK-2185602 GlyphVector.getVisualBounds should not be affected by leading or trailing white space.
-
- Resolved
-