Shouldn't they look exactly the same? Or does Java not have its own fonts? Does it just map font names to OS fonts?
-
Java does not have its own fonts AFAIK. It uses set of fonts from OS. Like you said, its taking from OS if nothing is specified.– vpram86Commented Feb 23, 2010 at 9:16
-
3Could you post screenshots to show the difference? That way everyone knows what we're talking about :-)– Ivo FlipseCommented Feb 23, 2010 at 10:37
-
couldn't figure out how to post directly with superuser, so here's a link: img246.imageshack.us/img246/9348/41814352.png top left "EUR/USD" is MAC, other 2 are XP to show the difference... notice the 7s and 8s look different. Plus the characters kinda feel a bit wider in OS X screenshot. And the "EUR/USD" looks wider or bolder than the XP GBP/JPY text.– MikeyCommented Feb 23, 2010 at 12:24
2 Answers
Java normally uses system fonts, just like other programs. According to the spec: "All implementations of the Java 2 platform must support TrueType fonts; support for other font technologies is implementation dependent." (Javadocs of java.awt.font).
There's one twist: Since a Java program cannot know in advance what fonts will be available on the target platform, there are "logical font names" ("serif", "monospaced" etc.). These are always available in Java; the Java runtime will map these pseudo-fontnames to an approriate font on the system.
This mapping is configurable. See http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html.
I suspect that the Java app in question uses these logical font names, which are simply mapped to different fonts on Windows and on Mac OS.
Lately you can see "Warning: the font "Times" is not available, so "Lucida Bright" has been substituted, but may have unexpected appearance or behavor. Re-enable the "Times" font to remove this warning." So may you can set a different one due this change