FOP 2.2 - loading fonts

Jeno Forizs <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
Hi guys,

I got problems with loading fonts. fop.xml config got this definition of a font:
	<font metrics-url="arial.xml"
         	kerning="yes"
                 embed-url="arial.ttf">
                 <font-triplet name="Arial" style="normal" weight="normal"/>
         </font>

When the PDF is rendered, there's an error message:
"2017-07-05 18:13:10.508 ERROR 3120 --- [nio-6200-exec-1] org.apache.fop.pdf.PDFFactory            : Failed to embed 
font [org.apache.fop.fonts.LazyFont@2402f627{Arial 
Bold}{metrics-url=arialbd.xml,embed-url=arialbd.ttf,kerning=true,advanced=true}] Arial-BoldMT

java.io.IOException: 'loca' table not found, happens when the font file doesn't contain TrueType outlines (trying to 
read an OpenType CFF font maybe?)
         at org.apache.fop.fonts.truetype.TTFFile.readIndexToLocation(TTFFile.java:180)
         at org.apache.fop.fonts.truetype.TTFSubSetFile.readFont(TTFSubSetFile.java:479)
         at org.apache.fop.pdf.PDFFactory.getFontSubsetBytes(PDFFactory.java:1368)
         at org.apache.fop.pdf.PDFFactory.makeFontFile(PDFFactory.java:1299)
         at org.apache.fop.pdf.PDFFactory.makeFontDescriptor(PDFFactory.java:1223)
         at org.apache.fop.pdf.PDFFactory.makeFont(PDFFactory.java:944)
         at org.apache.fop.pdf.PDFResources.addFonts(PDFResources.java:137)"

When I configure FOP to autodetect the installed fonts of the operating system, then of course all installed fonts are 
discovered and they are available for using them in the PDFs - included this arial.ttf which loading is broken with the 
error above. (anyway, this setup of this font has been working with FOP 0.95)

Why do I want to specify and load fonts via fop.xml? Because the application is a spring-boot app and it's going to run 
in a docker image where noone knows what kinda fonts will be installed and if they would be accessible to FOP.

Any ideas how could I configure the font loading properly?

Thanks,
J.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.