Ubuntu – Not all TTF fonts visible from the (Sun) JDK

fontsjavajdk

I wanted to use Monaco.ttf with IntelliJ. Unfortunately it doesn't show up.

I also noticed that the Monaco font doesn't appear in the list of fonts got from awt:

java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()

I installed Monaco.ttf in /usr/share/fonts/truetype/osx

I also tried to copy it in /usr/lib/jvm/java-6-sun/jre/lib/fonts and even tried to manually update the /usr/lib/jvm/java-6-sun/jre/lib/fonts/fonts.dir file

I restarted the jvm at each try, but the fonts is not visible from the sun jdk.

All other applications see that font (even eclipse, which is in java but uses the SWT library)

Does anybody know how to make jdk see additional fonts?

Best Answer

The problem is with the Monaco font itself, it doesn't seem to have appropriate metadata and is a hacky port, so Java doesn't recognize it. Probably you can find some other version of this TTF file which will work better or try to fix it yourself using FontForge.

See also my comment in the IntelliJ IDEA issue tracker.