public static FontData [ ] getAllFonts ( ) { if ( fonts == null ) { fonts = new ArrayList ( ) ; String os = System . getProperty ( "os.name" ) ; File [ ] locs = new File [ 0 ] ; if ( os . startsWith ( "Windows" ) ) { locs = win32 ; } if ( os . startsWith ( "Linux" ) ) { locs = linux ; } if ( os . startsWith ( "Mac OS" ) ) { locs = macos ; } for ( int i = 0 ; i < locs . length ; i ++ ) { File loc = locs [ i ] ; processFontDirectory ( loc , fonts ) ; } if ( os . startsWith ( "Linux" ) ) { locateLinuxFonts ( new File ( "/etc/fonts/fonts.conf" ) ) ; } } return ( FontData [ ] ) fonts . toArray ( new FontData [ 0 ] ) ; }
Get all the fonts available