-
Bug
-
Resolution: Fixed
-
P3
-
5.0
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [ Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
I wrote some simple code to request a Font's LineMetrics getUnderlineThickness. This has been working great for years on many releases, but returns strange numbers on Java 5 Windows. I've provided source code and expected/actual results below.
While you're at it, please add kern pair lookup methods to Font! Or even a simple method to get at TrueType table data, like "public byte[] getTrueTypeTable(String aTableName)". :-)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
prompt> java LMTest
Uline of 1: 0.083333336
Uline of 10: 0.8333333
Uline of 100: 8.333333
Uline of 1000: 83.333336
ACTUAL -
prompt> java LMTest
Uline of 1: -1.386
Uline of 10: 0.916
Uline of 100: 3.21
Uline of 1000: 5.52
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.image.*;
/** This class shows weird Font LineMetrics UnderlineThicknesses on Java 5 Windows. */
public class LMTest {
public static void main(String args[])
{
// Set headless
System.setProperty("java.awt.headless", "true");
// Get graphics objects
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
// Get Arial 12 and print uline thicknesses for derived point sizes 1, 10, 100, 1000
Font font = new Font("Arial", 0, 12);
System.out.println("Uline of 1: " +
font.deriveFont(1f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
System.out.println("Uline of 10: " +
font.deriveFont(10f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
System.out.println("Uline of 100: " +
font.deriveFont(100f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
System.out.println("Uline of 1000: " +
font.deriveFont(1000f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2_04
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-1-11 09:02:25 GMT
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [ Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
I wrote some simple code to request a Font's LineMetrics getUnderlineThickness. This has been working great for years on many releases, but returns strange numbers on Java 5 Windows. I've provided source code and expected/actual results below.
While you're at it, please add kern pair lookup methods to Font! Or even a simple method to get at TrueType table data, like "public byte[] getTrueTypeTable(String aTableName)". :-)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
prompt> java LMTest
Uline of 1: 0.083333336
Uline of 10: 0.8333333
Uline of 100: 8.333333
Uline of 1000: 83.333336
ACTUAL -
prompt> java LMTest
Uline of 1: -1.386
Uline of 10: 0.916
Uline of 100: 3.21
Uline of 1000: 5.52
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.image.*;
/** This class shows weird Font LineMetrics UnderlineThicknesses on Java 5 Windows. */
public class LMTest {
public static void main(String args[])
{
// Set headless
System.setProperty("java.awt.headless", "true");
// Get graphics objects
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
// Get Arial 12 and print uline thicknesses for derived point sizes 1, 10, 100, 1000
Font font = new Font("Arial", 0, 12);
System.out.println("Uline of 1: " +
font.deriveFont(1f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
System.out.println("Uline of 10: " +
font.deriveFont(10f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
System.out.println("Uline of 100: " +
font.deriveFont(100f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
System.out.println("Uline of 1000: " +
font.deriveFont(1000f).getLineMetrics("X", graphics.getFontRenderContext()).getUnderlineThickness());
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2_04
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-1-11 09:02:25 GMT