Share this page 

Use TrueType fontTag(s): AWT

The names of the most common fonts supported by Java are TimesRoman, Courier, and Helvetica. To add fonts, simply edit the properties.font file located in the lib of your JDK installation.

On a Windows system, to check what are the fonts available, go in the Font applet in the Parameters folder. Choose a font and doubleclick on it. Check the name of the font. For example, on my system, I have a font called Kaufmann, the real name is "Kaufmann BT". To be able to use this font, I add the following line in the properties.font file in the section called # for backword compatibility.

Kaufmann.0=Kaufmann BT, ANSI_CHARSET
To use it, in a java program :
setFont(new Font("Kaufmann", Font.BOLD, 20));
NOTE: The three common fonts are the only ones guaranteed to be supported across all systems. To be able to use other fonts, you must modify the properties.font file and these new fonts are not cross-plateform compatibles.