Shouldn't they look exactly the same? Or does Java not have its own fonts? Does it just map font names to OS fonts?

link|improve this question

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. – Aviator Feb 23 '10 at 9:16
2  
Could you post screenshots to show the difference? That way everyone knows what we're talking about :-) – Ivo Flipse Feb 23 '10 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. – Mikey Feb 23 '10 at 12:24
feedback

1 Answer

up vote 6 down vote accepted

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.