Embedding font in pdf

Here should go questions about transforming XML with XSLT and FOP.
iwudh8u
Posts: 1
Joined: Sat Apr 25, 2009 9:52 pm

Embedding font in pdf

Post by iwudh8u »

Hi,

I'm trying to change the default font used to create a PDF from a DITAMap using Idiom FO Plugin (with Apache FOP processor). I've scanned and read all previous posts regarding this issue and none of them help.

As much as I enjoy using Oxygen, I bemoan the lack of proper documentation for this issue. In fact, the instructions contained in the http://www.oxygenxml.com/doc/articles/A ... tToFOP.pdf document do not work! I am using Mac OS X 10.5 with Oxygen 10.2. The following line
export CMD=java -cp "$LIB/fop.jar:$LIB/avalon-framework-4.2.0.jar:$LIB/xe is only partially rendered and hence I've had to fill in the rest of the blanks. It then throws an 'illegal option -cp' error on the command line!.

After, figuring this out I managed to create a XML font metrics file in my OXYGEN_INSTALLATION_DIRECTORY. I then created a fopConfiguration.xml file as per the instructions. I then added the font name as parameters to the transformation scenario.

However I still keep getting the following error and there is no change to the font.

[fop] 1044 WARN [ main ] org.apache.fop.fonts.FontInfo - Font 'GentiumBookBasic,normal,400' not found. Substituting with 'any,normal,400'.

My configuration file looks like this:

<fop version="1.0">
<base>file:/Applications/oxygen/</base>
<source-resolution>72</source-resolution>
<target-resolution>72</target-resolution>
<default-page-settings height="11in" width="8.26in"/>
<renderers>
<renderer mime="application/pdf">
<filterList>
<value>flate</value>
</filterList>
<fonts>
<font metrics-url="GentiumBookBasic.xml" kerning="yes"
embed-url="file:/Users/jay/Library/Fonts/GenBkBasR.ttf">
<font-triplet name="GentiumBookBasic" style="normal"
weight="normal"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>

Any help will be greatly appreciated ... :)

Thanks,
Jay
Radu
Posts: 9507
Joined: Fri Jul 09, 2004 5:18 pm

Re: Embedding font in pdf

Post by Radu »

Hi Jay,

Indeed, the sample ttfCOnverter.sh does not work on MAC and the script sample indeed appears truncated and cannot be copied from the PDF file on the MAC, we'll fix this.
In the meantime you can run the equivalent operation from the command line for the equivalent font file you want to add:

Code: Select all


java -cp "lib/fop.jar:lib/avalon-framework-4.2.0.jar:lib/xercesImpl.jar" org.apache.fop.fonts.apps.TTFReader "/Library/Fonts/Arialuni.ttf" "/Library/Fonts/Arialuni.xml"
Then, you have to make sure that your configuration file is used by the Apache FOP.
For example, if you set an invalid path to the embed-url, does the transformation fails and complain about the problem?
If not, then the configuration file is not used. As you are using Oxygen 10.2 the configuration file should be OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/fop/conf/fop.xconf so you have to do the modifications there.

Then, edit the OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/cfg/fo/font-mappings.xml file and in the

Code: Select all

<logical-font name="Serif">
section replace the specified font-face value for the default charset with the name of the font as specified in the configuration file.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply