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?
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.
You need to run the
mkfontscale
andmkfontdir
utilities in this order, in order to update the fonts.dir file.Enter the
/usr/lib/jvm/java-6-sun/jre/lib/fonts
directory from your terminal and runmkfontscale
creates the fonts.scale file whichmkfontdir
can use to createfonts.dir
.Update your font cache
Have you tried calling:
It seems that the Java font system is kinda messed up:
http://www.sabi.co.uk/Notes/linuxFonts.html#fontSwJava
You may have to work around issues with finding the fonts. But if eclipse can see the font, then there is no reason why your application can not. You can even choose to look at the eclipse code to see how they've done it.
http://java.sun.com/products/java-media/2D/reference/faqs/#Font_and_Text_questions