Fonts

What are the best practices for fonts and Graphics.drawString() ? What is the minimum set of things to do to get consistent rendering results across different systems?

Java has some in built mappings for virtual serif and sans-serif. (Serif, Sans-serif, Monospaced, Dialog, and DialogInput.) These map in an implementation specific way, but work cross platform. If you request an actual physical font by name, the system may not have it.

Serif tend to map to Times Roman generally. Sams-serif maps to a Helvetica style font (Arial on Windows)

[quote]Java has some in built mappings for virtual serif and sans-serif. (Serif, Sans-serif, Monospaced, Dialog, and DialogInput.) These map in an implementation specific way, but work cross platform. If you request an actual physical font by name, the system may not have it.

Serif tend to map to Times Roman generally. Sams-serif maps to a Helvetica style font (Arial on Windows)
[/quote]
But what about the effects of different DPI settings and OS’s in terms of size and positioning?

Yes different OS’s will have different font sizes.

[quote]Yes different OS’s will have different font sizes.
[/quote]
So, we’re stuck with bitmap fonts?

Not really, the differences aren’t huge anyway. I played my game on a Mac and even though the font was a tiny bit bigger than on Windows, nothing was broken at all. You just have to give yourself some breathing space.

I only have access to a Vector-06C. I’m not sure how much “breathing space” to leave.

So, we’re stuck with bitmap fonts?
[/quote]
You can always use FontMetrics to get the pixel size and either derive a font to get the pixel size you are after or scale appropriately before drawing.

If you have sufficient bytes, FontMetrics is the way to go. It lets you align to left, right or centre, and it lets you get line spacing correct. I used it for Gravitational Fourks because that had quite a lot of text.

If you don’t then allowing for a variation of 15% either way is ample. If you’re feeling bold you could assume that Sun chose suitably consistent default fonts and that other organisations haven’t messed them up too much and reduce that to 5%. OTOH I know that Flash games often break badly for me because of bad assumptions about text layout or font sizes, so I’m inclined to caution.