Page 1 of 1

Modifying base-font in Apache FOP PDf transform

Posted: Mon Aug 25, 2014 11:39 pm
by H_Too_Oh
A few years back I made the following note to myself in the DITA-OT file commons.attr.xsl, as a reminder about how I had changed the PDF output base font to sans-serif:

Code: Select all

<!-- added font-family attribute to change the base font to sans serif -->

<xsl:attribute-set name="base-font">
<xsl:attribute name="font-size"><xsl:value-of select="$default-font-size"/></xsl:attribute><xsl:attribute name="font-family">sans-serif</xsl:attribute>
</xsl:attribute-set>
(I added the line containing "sans-serif")

This file used to be in the demo folder, so now I understand that it's at this location instead:

Code: Select all

C:\Developer\SVN\trunk\DITA-OT\plugins\org.dita.pdf2\cfg\fo\attrs\commons.attr.xsl
However now when I add the line with sans-serif to the file in that new location, it doesn't seem to change anything.

I remember that I was using XEP back then also, and now I'm using Apache FOP (since XEP doesn't seem to be included in this Oxygen installation that I'm using), is that the difference?

I tried adding the above to ....cfg\fo\attrs\custom.xsl also, but no change that way either.

Anyone know how to do this or why my previous method doesn't work? It did work back then, that I remember.

Thanks,

Re: Modifying base-font in Apache FOP PDf transform

Posted: Tue Aug 26, 2014 8:20 am
by Radu
Hi,

To test this behavior I opened the XSLT:

DITA-OT\plugins\org.dita.pdf2\cfg\fo\attrs\commons-attr.xsl

and made the modification to the "base-font" attribute set to use monospace (just to see more clearly the affected text):

Code: Select all

  <xsl:attribute-set name="base-font">
<xsl:attribute name="font-size"><xsl:value-of select="$default-font-size"/></xsl:attribute>
<xsl:attribute name="font-family">monospace</xsl:attribute>
</xsl:attribute-set>
and it worked for me (should work with any FO Processor no matter if its Apache FOP or XEP), the paragraph text was rendered with Monospaced.
Could you try the same thing?
If it does not work, maybe you are using another DITA OT installation for publishing.
If it works, you should look in the file:

DITA-OT/plugins/org.dita.pdf2/cfg/fo/font-mappings.xml

and see that the alias "sans-serif" is mapped to a logical font called "Sans" which in turn is mapped to a sequence of physical fonts. Maybe you need to make changes to that sequence.

http://www.oxygenxml.com/doc/ug-oxygen/ ... tails.html

Regards,
Radu

Re: Modifying base-font in Apache FOP PDf transform

Posted: Tue Aug 26, 2014 4:31 pm
by H_Too_Oh
Thanks, that was a good idea to test using monospace. It didn't change anything either, so I investigated and finally discovered that I was pointing to a DITA-OT in a slightly different location.

We have a small complication in that we can't modify anything in the Program Files directories, so I had to make a copy of the Oxygen-included DITA-OT and put it in a place where I have permissions to modify it. Someone had already done that however and put a copy one level below, and that was the one I was pointing Oxygen to, not the one I was modifying.

I have sans-serif now, thanks.