private void checkFontStatus ( final FontParams fontParams ) { // Try to load system fonts final List < String > fonts = Font . getFontNames ( transformFontName ( fontParams . name ( ) . name ( ) ) ) ; Font font = null ; String fontName = null ; if ( fonts . isEmpty ( ) ) { final List < String > fontPaths = fontParams instanceof RealFont && ( ( RealFont ) fontParams ) . skipFontsFolder ( ) ? Collections . singletonList ( "" ) : ResourceParameters . FONT_FOLDER . get ( ) ; for ( int i = 0 ; i < fontPaths . size ( ) && font == null ; i ++ ) { String fontPath = fontPaths . get ( i ) ; if ( ! fontPath . isEmpty ( ) ) { fontPath += Resources . PATH_SEP ; // NOSONAR } // This variable will hold the 2 alternative font names fontName = fontPath + transformFontName ( fontParams . name ( ) . name ( ) ) + "." + fontParams . extension ( ) ; LOGGER . trace ( "Try to load Transformed Font {}" , fontName ) ; font = Font . loadFont ( Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( fontName ) , fontParams . size ( ) ) ; // The font name contains '_' in its file name to replace ' ' if ( font == null ) { fontName = fontPath + fontParams . name ( ) . name ( ) + "." + fontParams . extension ( ) ; LOGGER . trace ( "Try to load Raw Font {}" , fontName ) ; font = Font . loadFont ( Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( fontName ) , fontParams . size ( ) ) ; if ( font != null ) { // Raw font has been loaded LOGGER . info ( "{} Raw Font loaded" , fontName ) ; } } else { // Transformed font has been loaded LOGGER . info ( "{} Transformed Font loaded" , fontName ) ; } } if ( font == null ) { // Neither transformed nor raw font has been loaded (with or without '_') LOGGER . error ( "Font : {} not found into base folder: {}" , fontParams . name ( ) . name ( ) + "." + fontParams . extension ( ) , ResourceParameters . FONT_FOLDER . get ( ) ) ; } } }
Load the font file .