private static Map < String , String > getSystemFonts ( ) { synchronized ( SYSTEM_FONTS_BY_NAME ) { for ( String fontDir : FONT_DIRS ) { File dir = new File ( fontDir ) ; if ( ! dir . exists ( ) ) continue ; File [ ] files = dir . listFiles ( ) ; if ( files == null ) continue ; for ( File file : files ) { String filePath = file . getAbsolutePath ( ) ; if ( ! SYSTEM_FONTS_BY_PATH . containsKey ( filePath ) ) { String fontName = TTFAnalyzer . getFontName ( file . getAbsolutePath ( ) ) ; if ( fontName == null ) { fontName = getFileName ( filePath ) ; } SYSTEM_FONTS_BY_PATH . put ( filePath , fontName ) ; SYSTEM_FONTS_BY_NAME . put ( fontName , filePath ) ; } } } return SYSTEM_FONTS_BY_NAME ; } }
Retrieve the fonts from the system folders .