-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
None
-
Affects Version/s: 6
-
Component/s: client-libs
-
x86
-
windows_2000
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
If you create a font with the TextAttribute FOREGROUND and the color white, then you get TextLayout.getPixelBounds reporting zero width and height.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a font using a map with text attributes and set TextAttribute.FOREGROUND to Color.WHITE. Then create a TextLayout and call getPixelBounds on for example the string "a", and you will get wrong bounds.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
r1=java.awt.Rectangle[x=1,y=-7,width=6,height=7]
r2=java.awt.Rectangle[x=1,y=-7,width=6,height=7]
ACTUAL -
r1=java.awt.Rectangle[x=10,y=4,width=0,height=0]
r2=java.awt.Rectangle[x=1,y=-7,width=6,height=7]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
FontRenderContext frc = new FontRenderContext(new AffineTransform(), false, false);
Map<TextAttribute, Object> fontAttributes = new HashMap<TextAttribute, Object>();
fontAttributes.put(TextAttribute.FAMILY, "Lucida Sans");
fontAttributes.put(TextAttribute.SIZE, 12);
fontAttributes.put(TextAttribute.FOREGROUND, Color.WHITE);
Font font1 = new Font(fontAttributes);
fontAttributes.put(TextAttribute.FOREGROUND, Color.BLACK);
Font font2 = new Font(fontAttributes);
TextLayout tl1 = new TextLayout("a", font1, frc);
TextLayout tl2 = new TextLayout("a", font2, frc);
Rectangle r1 = tl1.getPixelBounds(frc, 0, 0);
Rectangle r2 = tl2.getPixelBounds(frc, 0, 0);
System.out.println("r1="+r1); // Wrong pxiel bounds
System.out.println("r2="+r2);
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't specify the FOREGROUND attribute or use a color different from WHITE.
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
If you create a font with the TextAttribute FOREGROUND and the color white, then you get TextLayout.getPixelBounds reporting zero width and height.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a font using a map with text attributes and set TextAttribute.FOREGROUND to Color.WHITE. Then create a TextLayout and call getPixelBounds on for example the string "a", and you will get wrong bounds.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
r1=java.awt.Rectangle[x=1,y=-7,width=6,height=7]
r2=java.awt.Rectangle[x=1,y=-7,width=6,height=7]
ACTUAL -
r1=java.awt.Rectangle[x=10,y=4,width=0,height=0]
r2=java.awt.Rectangle[x=1,y=-7,width=6,height=7]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
FontRenderContext frc = new FontRenderContext(new AffineTransform(), false, false);
Map<TextAttribute, Object> fontAttributes = new HashMap<TextAttribute, Object>();
fontAttributes.put(TextAttribute.FAMILY, "Lucida Sans");
fontAttributes.put(TextAttribute.SIZE, 12);
fontAttributes.put(TextAttribute.FOREGROUND, Color.WHITE);
Font font1 = new Font(fontAttributes);
fontAttributes.put(TextAttribute.FOREGROUND, Color.BLACK);
Font font2 = new Font(fontAttributes);
TextLayout tl1 = new TextLayout("a", font1, frc);
TextLayout tl2 = new TextLayout("a", font2, frc);
Rectangle r1 = tl1.getPixelBounds(frc, 0, 0);
Rectangle r2 = tl2.getPixelBounds(frc, 0, 0);
System.out.println("r1="+r1); // Wrong pxiel bounds
System.out.println("r2="+r2);
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't specify the FOREGROUND attribute or use a color different from WHITE.
- links to
-
Review(master)
openjdk/jdk/28809