FOP 2.2 - loading fonts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FOP 2.2 - loading fonts

Jeno Forizs
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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FOP 2.2 - loading fonts

Stefan Hegny (hydrografix Consulting GmbH)
Hi J,
in newer FOP versions the metrics xml is no longer necessary, you could
try removing the metrics-url from the font entry
BR Stefan

On 05.07.2017 18:30, Jeno Forizs wrote:

> 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.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--

Stefan Hegny, Geschäftsführer/Manager
hydrografix Consulting GmbH       [hidden email]
Tel. +49 - 173-3257674            Fax +49 - 6106-772614
Görlitzer Str. 13
D-63110 Rodgau                    Amtsgericht Offenbach/Main HRB 43974
Geschäftsführer: Roland Junker, Stefan Hegny


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...