FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
If you derive a font from a font with a transform, the transform is lost. This is a regression from 1.5.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a font with a transform.
2) Derive a new font from it
3) Displaying text with this font will not have the transform applied.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The transform should have still existed for the derived font.
ACTUAL -
The transform is not preserved.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Font;
import java.awt.font.TextAttribute;
import java.awt.font.TransformAttribute;
import java.awt.geom.AffineTransform;
public class FontTest {
public static void main(String[] args) {
System.out.println("Java Version:\t" + System.getProperty("java.vm.version"));
runTest();
}
private static void runTest() {
Font originalFont = new Font("Arial", Font.PLAIN, 18);
AffineTransform transform = originalFont.getTransform();
System.out.println("Original font transform: " + transform);
AffineTransform scaleTransform = new AffineTransform();
scaleTransform.scale(2, 2);
Font scaledFont = originalFont.deriveFont(scaleTransform);
transform = scaledFont.getTransform();
System.out.println("Scaled font transform: " + transform);
Font boldScaledFont = scaledFont.deriveFont(Font.BOLD);
transform = boldScaledFont.getTransform();
System.out.println("Bold scaled font (separate derives) transform: " + transform);
Font boldScaledFont2 = originalFont.deriveFont(Font.BOLD, transform);
transform = boldScaledFont2.getTransform();
System.out.println("Bold scaled font (combination derive) transform: " + transform);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I have not yet found a workaround that will work on both 1.5 and 1.6.