In Windows O.S i can get the fonts folder path using this java code :
System.out.println( FontManager.getFontPath( true ) ); // C:\WINDOWS\Fonts
But in Mac OS X this code returns nothing. Is there an alternative code for this in Mac ?
There are two paths for fonts on Mac OS X (that I know of), /Library/Fonts
and /System/Library/Fonts
.
If you're just looking for a list of fonts, you can use:
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()
A bit heavy handed, since it creates a GraphicsEnvironment
object, but it will return an array of java.awt.Font
containing an object that represents each font available on the system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With