xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umberto Rustichelli aka Ubi <ope...@gt50.org>
Subject fop 1.1 servlet ignores my custom TTF font
Date Tue, 05 Dec 2017 14:18:12 GMT

Respectable, I've been trying many ways to solve this, following online 
manuals, reading forum posts etc., but I miserably failed. I'm no Java 

Environment is Linux, Java is 1.6.07, fop is version 1.1
To make sure I'm not stuck with some cache, everytime I have stopped 
Tomcat, remover webapps/fop* and put the new fop.war into webapps/, then 
re-run tomcat.

I have some fonts that I must use in the PDF renderer (FO to PDF 
transformation), let's say I just have one that is 

After trying some recipes found on the web, like retouching fop.xconf 
before compiling or where I just put the fop configuration file 
somewhere... nada.
Currently I have modified 
src/java/org/apache/fop/servlet/FopServlet.java this way:

     public void init() throws ServletException {

             this.uriResolver = new 
             this.transFactory = TransformerFactory.newInstance();

             // Ubi: here or in position POS-ALPHA,
             // the effect seems to be the same (fonts not found!)
                 File userConfigFile = new 
             catch (Exception exc)
                  // I don't see the point in catching this one, should I?

             this.fopFactory = FopFactory.newInstance();

             // POS-ALPHA


and /opt/fopTest/Ubi.fop-config.xml just contains

     <?xml version="1.0"?>
     <fop version="1.0">
         <renderer mime="application/pdf">
             <!-- Ubi: try this one... -->
             <!-- Ubi: (the previous was apprently insufficient for the 
                     ....try this one, too. See 
https://xmlgraphics.apache.org/fop/1.1/fonts.html#register -->
                             <font-triplet name="OCRB" style="normal"

weight="normal" />

By running tomcat with strace, I see that file 
/opt/fopTest/Ubi.fop-config.xml is actually read, but the font OCRB is 
not found when invoked (logs/catalina.out):

     WARNING: Font "OCRB,normal,400" not found. Substituting with 

On the command line, this one works, instead :

java -cp build/fop.jar:lib/xmlgraphics-commons-1.5.jar:<the usual 
lib/*.jar files> \
         org.apache.fop.tools.fontlist.FontListMain \
         -c /etc/PeS/var/FOP/Ubi.fop-config.xml \

and the OCRB font appears in the PDF.

So, what am I doing wrong with the servlet???
Is there a bullet-proof way to exploit fonts, possibly with the standard 
fop servlet (without writing code)?
Otherwise, how can I quickly debug/inspect the issue?

Thanks a lot


View raw message