drawing multiple lines of text using LineBreakMeasurer- weird font

I want to draw a text spanning multiple lines using the Java2D API. I (seemingly) succeeded in drawing the text, but it is in a weird font.

So I guessed I made some mistake and looked at this tutorial in the documentation:

http://java.sun.com/docs/books/tutorial/2d/textandfonts/linebreakmeasure.html

I copied the source code from the tutorial into a blank file on my computer, and, to my surprise, the result is the same: instead of drawing the string about van Gogh in proper english letters, I see that weird font in the applet viewer! It looks like this:

http://img285.imageshack.us/img285/1278/java0qy.jpg

[642 byte] By [IronCrowna] at [2007-10-2 0:48:19]
# 1
I just discovered that the font is a fantasy font I have installed on my system and that happens to be the first font in alphabetical order (angerthas.ttf). So the program simply uses the first font it finds. How can I change that?
IronCrowna at 2007-7-15 17:58:24 > top of Java-index,Java Essentials,New To Java...
# 2

The TextAttribute class has a FAMILY and a FONT field. You could try something like:

private static final Hashtable map = new Hashtable();

static {

map.put(TextAttribute.FONT, new Font("lucida sans typewriter", Font.PLAIN, 24));

map.put(TextAttribute.SIZE, new Float(18.0));

}

74philipa at 2007-7-15 17:58:24 > top of Java-index,Java Essentials,New To Java...
# 3
Thank you, that worked :-)I wonder why it's not in the tutorial though...
IronCrowna at 2007-7-15 17:58:24 > top of Java-index,Java Essentials,New To Java...