Missing font in output using built-in FOP

Here should go questions about transforming XML with XSLT and FOP.
dagoss
Posts: 24
Joined: Fri Apr 05, 2013 11:01 pm

Missing font in output using built-in FOP

Post by dagoss »

I'm getting square blocks instead of text in my PDF output.

I'm using docbook to PDF using the built-in FOP. I have my fonts specified in my stylesheet customization like so:

<xsl:param name="title.font.family">Myriad Pro</xsl:param>
<xsl:param name="body.font.family">Minion Pro Med</xsl:param>

Those fonts are installed, and those are the names that are used in Character Map for them.

I looked in the fop-config file and it has auto-detect already set. The fonts are in C:\Windows\Fonts, so I would think that auto-detect would find them.

I created a custom fop-config (that was just a copy of the one in the oXygen install directory) and added:
<directory>C:\Windows\Fonts</directory>
I selected it by setting the XML / XSLT-FO-XQuery / FO Processors / Configuration File option in oXygen's Preferences. (There's a checkbox "enable output to the built-in FOP" that is not checked... not sure what it does)

The results are still the same. Not sure what I'm doing wrong.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Missing font in output using built-in FOP

Post by sorin_ristache »

Hello,

The option Enable output to the built-in FOP is used for displaying the output messages (info, warning, error) of Apache FOP in an Oxygen view. You should enable it and try again the Docbook PDF transformation to see any errors from Apache FOP. Are error displayed in the Apache FOP view?

You should try also to register the fonts in the fop-config.xml file from the Configuration File option using the font metrics files generated for the two fonts as in this procedure. If the Myriad Pro and Mynion Pro Med are not included in the PDF output please let us know if there are errors in the Apache FOP view.


Regards,
Sorin
dagoss
Posts: 24
Joined: Fri Apr 05, 2013 11:01 pm

Re: Missing font in output using built-in FOP

Post by dagoss »

I've seen that before. I have followed the simple procedure for that (adding auto-detect to the fop-config.xml, though it was already there by default...). Since my fonts are in C:\Windows\Fonts, that *should* be working. I'll have to see if I can get our sysaids to do the more advanced procedure for me (if that's what I need to do) as I don't have permissions to do some of those things on my system.

This is what I'm seeing in my output after enabling that option:

Code: Select all

Started: "c:\program files\oxygen xml editor 14\jre\bin\java" -Xmx250m "-Dcom.oxygenxml.editor.home.url=file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/" -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser "-Dlog4j.configuration=file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014//tools/config/log4j.xml" "-Dxml.catalog.files=file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/dita/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/dita/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/docbook/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/docbook/5.0/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/ead/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/fo/xsd/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/kml/schema/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/mathml/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/ncx/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/svg/dtd/svgcatalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/stratml/part1/xsd/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/stratml/part2/xsd/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/tei/custom/schema/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/tei/schema/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/teip4/custom/schema/dtd/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/teip4/schema/dtd/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/teip4/stylesheet/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/tei/custom/schema/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/tei/schema/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/tei/xml/tei/stylesheet/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/xhtml/dtd/xhtmlcatalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/xhtml/relaxng/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/xhtml/nvdl/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/xhtml11/dtd/xhtmlcatalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/xhtml11/schema/xhtmlcatalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/xmlschema/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks/xmlspec/catalog.xml;file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/frameworks//catalog.xml" -cp "C:\Program Files\Oxygen XML Editor 14/classes/;C:\Program Files\Oxygen XML Editor 14/lib/oxygen.jar;C:\Program Files\Oxygen XML Editor 14/lib/oxygenAuthor.jar;C:\Program Files\Oxygen XML Editor 14/lib/oxygenDeveloper.jar;C:\Program Files\Oxygen XML Editor 14/lib/oxygenEclipse.jar;C:\Program Files\Oxygen XML Editor 14/lib/oxygenAuthorEclipse.jar;C:\Program Files\Oxygen XML Editor 14/lib/oxygenDeveloperEclipse.jar;C:\Program Files\Oxygen XML Editor 14/lib/org.eclipse.wst.xml.xpath2.processor_1.2.0.jar;C:\Program Files\Oxygen XML Editor 14/lib/icu4j.jar;C:\Program Files\Oxygen XML Editor 14/lib/xml-apis.jar;C:\Program Files\Oxygen XML Editor 14/lib/xercesImpl.jar;C:\Program Files\Oxygen XML Editor 14/lib/resolver.jar;C:\Program Files\Oxygen XML Editor 14/lib/log4j.jar;C:\Program Files\Oxygen XML Editor 14/lib/fop.jar;C:\Program Files\Oxygen XML Editor 14/lib/avalon-framework-4.2.0.jar;C:\Program Files\Oxygen XML Editor 14/lib/batik-all-1.7.jar;C:\Program Files\Oxygen XML Editor 14/lib/commons-io-1.3.1.jar;C:\Program Files\Oxygen XML Editor 14/lib/xmlgraphics-commons-1.5.jar;C:\Program Files\Oxygen XML Editor 14/lib/commons-logging-1.1.1.jar;C:\Program Files\Oxygen XML Editor 14/lib/saxon9ee.jar;C:\Program Files\Oxygen XML Editor 14/lib/serializer.jar;C:\Program Files\Oxygen XML Editor 14/lib/xml-apis-ext.jar;C:\Program Files\Oxygen XML Editor 14/lib/jeuclid-core.jar;C:\Program Files\Oxygen XML Editor 14/lib/jeuclid-fop.jar" org.apache.fop.cli.Main -c "X:\Lab_Division_Docs\manual\8.0\xsl\fop-config.xml" -fo X:\Lab_Division_Docs\manual\8.0\ldms-manual.xml_xslt -pdf X:\Lab_Division_Docs\manual\8.0\out\pdf\ldms-manual.pdf
ERROR - Couldn't find hyphenation pattern for lang="en".
Process ended with exit code: 0
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Missing font in output using built-in FOP

Post by sorin_ristache »

Hello,

There are no errors in the Apache FOP output view but also there are no fonts mentioned that were detected by the auto-detect element. I recommend the longer version of the procedure, that is generating the font metrics files for the Myriad Pro and Minion Pro Med fonts and including references to the font metrics files in the FOP config file.
dagoss wrote:I'll have to see if I can get our sysaids to do the more advanced procedure for me (if that's what I need to do) as I don't have permissions to do some of those things on my system.
I think you do not need special permissions for that. Just create a script file in any directory and run it from command line as any standard user logged on the machine. The FOP config file can be located in any directory, just make sure to set the correct location of this file in the option Configuration file.


Regards,
Sorin
dagoss
Posts: 24
Joined: Fri Apr 05, 2013 11:01 pm

Re: Missing font in output using built-in FOP

Post by dagoss »

Thanks for your help. As I was walking through that procedure, I noticed that it was referring to TTF fonts. Minion Pro and Myriad are OTF fonts. I set my fonts to Liberation Sans and Gentium Book Basic (both ttf fonts) and they appeared in the PDF as expected.

Will the procedure for font metrics work for oft fonts? I'll still have to get someone to run the script for me (as I don't have permission to run batch scripts!), so I don't want to call someone down to do that if it isn't going to be effective.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Missing font in output using built-in FOP

Post by sorin_ristache »

Sorry, no, the procedure works only with TrueType fonts. I seem to recall that an OTF font cannot be embedded in a PDF document regardless of the tool that creates the PDF document. Anyway the TTFREader class from Apache FOP invoked from the script can read (and create the font metrics file for) only a TrueType font.


Regards,
Sorin
Post Reply