Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get font folder path in Mac OS X?

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 ?

like image 847
Brad Avatar asked May 07 '11 22:05

Brad


1 Answers

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.

like image 144
Nathan Ryan Avatar answered Sep 20 '22 14:09

Nathan Ryan