We use AffineTransforms to scale fonts, so that when a user requests "8
point", it has a predictable meaning on all platforms and all screens.
This works on all platforms we've tried this on (Windows, Linux,
assorted UNIXes). But the Mac refuses to play along. This sample
works as expected on my Windows box -- the text on the first button is
SansSerif bold 12 point; the text on the second button is the same,
scaled 2x both vertically and horizontally. On my PowerBook, the first
button works as expected, and the second button is correctly scaled,
but the text isn't visible. Any thoughts?
public class MacFontTest
{
public static void main(String[] p_argv)
{
JFrame frame = new JFrame("test");
frame.getContentPane().setLayout(new FlowLayout());
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
JButton normal = new JButton("Hello, world");
Font f1 = new Font("SansSerif", Font.BOLD, 12);
f1 = f1.deriveFont(AffineTransform.getScaleInstance(1.0, 1.0));
normal.setFont(f1);
JButton scaled = new JButton("Hello, world");
Font f2 = f1.deriveFont(AffineTransform.getScaleInstance(2.0,
2.0));
scaled.setFont(f2);
For what it's worth, my PowerBook is up-to-date with OS X 10.3.8; this
is the Java version:
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141.4)
Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden