Sunday, July 30, 2006

Java + TrueType fonts on Linux

Install and configure Unicode TrueType fonts in Linux

The above was the simplest tutorial I could find on how to get True Type fonts working with Java on Linux. I used it as a rough guide, and made the following two tweaks:

  1. I didn't have mkfontscale available, so I used ttmkfdir to generate fonts.scale.
  2. The file name has changed in the JDK from to However, the value to add: appendedfontpath=... is still correct.

The cool part is that it appears as though I can just drop all the TrueType fonts from my windows box into a directory, follow the steps above, and *poof*, Java will find and use these fonts when I say:

  Font f = new Font("Alba Super", Font.PLAIN, 22);

I wish this worked without me having to spend 2+ hours looking around on the web for the right steps to follow. But hey, I'm just glad it works.

No comments:

Post a Comment