After updating to FOP 2.6, while trying to use Apache FOP to use custom fonts GT Super Display Light, I am getting below error.
org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".
org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "Arial,normal,700" not found. Substituting with "any,normal,700".
org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "GTSuperDisplayLight,normal,700" not found. Substituting with "any,normal,700".
Configuration file:
<fonts>
<!-- automatically detect operating system installed fonts -->
<auto-detect/>
<!-- embedded fonts -->
<!--
This information must exactly match the font specified
in the fo file. Otherwise it will use a default font.
For example,
<fo:inline font-family="Arial" font-weight="bold" font-style="normal">
Arial-normal-normal font
</fo:inline>
for the font triplet specified by:
<font-triplet name="Arial" style="normal" weight="bold"/>
If you do not want to embed the font in the pdf document
then do not include the "embed-url" attribute.
The font will be needed where the document is viewed
for it to be displayed properly.
possible styles: normal | italic | oblique | backslant
possible weights: normal | bold | 100 | 200 | 300 | 400
| 500 | 600 | 700 | 800 | 900
(normal = 400, bold = 700)
-->
<font kerning="yes" embed-url="GTSuperDisplayLight.ttf" embedding-mode="subset">
<font-triplet name="GTSuperDisplayLight" style="normal" weight="700" />
</font>
</fonts>
Edit : adding Java File Which Calls Configuarion File and picks fonts installed on the user's computer, but custom fonts can be specified. Please refer to Apache FOP official
/*
* Register Apache FOP to use our fonts. By default we set this config file to auto-detect the fonts
*/
File xconf = new File( getConfigFileURI( xslFullName ) );
FopConfParser parser = new FopConfParser( xconf ); //parsing configuration
FopFactoryBuilder builder = parser.getFopFactoryBuilder(); //building the factory with the user options
fopFactory = builder.build();
fopFactory = FopFactory.newInstance( new File( "." ).toURI() );
foUserAgent = fopFactory.newFOUserAgent();
bufferedOutputStream = new FileOutputStream( pdfFilename );
bufferedOutputStream = new BufferedOutputStream(
bufferedOutputStream );
private String getConfigFileURI( String xslFilePath )
{
File f = new File( xslFilePath );
String configFileURI = f.getParent() + "/userconfig.xml";
return configFileURI;
}
This Issue got resolved with JDK 11