Should be pretty easy to do what I wanted, right?
It took me a while, but after working through an awful lot of instructions that didn’t work I figured it out. Wasting a lot of time was hard. But then when I finally got it, it turned out to be simpler than I expected.
First of all, I just totally failed to change fonts with Open Toolkit 1.5.x. It seems that some changes were made for OT 1.6 that allowed a mere mortal like me to change fonts within a plugin. That is, with OT 1.6 you don’t need to make any changes to
fop.xconf, which is where I spent a lot of my wasted time on the path to failure with OT 1.5.x.
The first decision you need to make is which fonts you want to use. Maybe this is common knowledge but it tripped me up: Apache FOP only supports TrueType fonts so you won’t be able to use just any font you have on Windows. Look for
C:\Windows\Fonts\*.ttf. You’ll need to use a command-line interface because Windows Explorer won’t show the file extension. Myriad (which DITA for Publishers by Eliot Kimber unfortunately uses as an example) is out; Calibri and Trebuchet are in. You’ll also want a font that contains regular, bold, and italic variants. I had to use Consolas as the fixed-width font instead of Lucida Console as I wanted because my first choice lacks bold and italic styles.
I’m going to use the example of configuring titles to output with Calibri.
cfg/fo/ in your plugin directory. In this file you have to create a mapping between a logical name and physical name. In the
font-mappings/font-table element, create a
logical-font element like this:
<logical-font name="Calibri"> <physical-font char-set="default"> <font-face>Calibri</font-face> </physical-font> </logical-font>
If you want to have different defaults for logical fonts Sans, Serif, or Monspaced, you can set those in
font-mappings.xml also. In some cases the physical font name might be different from the logical font name. For example, the name for Trebuchet to specify inside
font-face is “Trebuchet MS”. Again, you can find the correct name by looking in
Next, register the font mappings file with your plugin. Add this line to
<uri name="cfg:fo/font-mappings.xml" uri="fo/font-mappings.xml" />
Finally, configure paragraph styles to use the font. In
cfg/fo/attrs/custom.xsl, set this attribute in the
common.title attribute set:
That’s it. On your next PDF build you should have Calibri for titles.