How to change the font used in the TOC

Oxygen general issues.
BogdanM777
Posts: 68
Joined: Tue Jun 09, 2015 6:26 pm
Location: Canada

How to change the font used in the TOC

Post by BogdanM777 »

Hi everybody,

I am new around here, and I am using the Oxygen XML Editor trial, for the time being.
I was trying to change several things on the outlook of the PDF generated with the DITA OT, and I managed to bring the generated PDF very close to what I used to have when I was using RoboHelp as authoring tool.
The only thing that I did not find yet is the how to change the font used inside the TOC. I managed to have the title of the TOC have the font and colour I wish, however the lines of the TOC are still showing in a font different than the rest of the document.
Does anybody have any idea about that?
Thank you.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to change the font used in the TOC

Post by Radu »

Hi,

In the XSLT stylesheet:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\cfg\fo\attrs\toc-attr.xsl

there is an attribute set called __toc__link on which you can set new attributes like for example:

Code: Select all

<xsl:attribute name="font-family">monospace</xsl:attribute>
But that font-family specified there is an alias for a font defined in the font mappings file:

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

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

Of course, changes should not be made directly to the stylesheets, for example you can create a PDF customization folder for that:

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

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
BogdanM777
Posts: 68
Joined: Tue Jun 09, 2015 6:26 pm
Location: Canada

Re: How to change the font used in the TOC

Post by BogdanM777 »

Hi Radu,
Thank you very much for your reply.
I am using the family-font Verdana, and I already declared it successfully in the font mapping file.
I use it everywhere in my project, the only place I did not know what to change was the lines of the TOC.
Otherwise I have the text inside the topics, the chapter titles, and the TOC title all in Verdana.
I will let you know how it goes.
Thank you again
BogdanM777
Posts: 68
Joined: Tue Jun 09, 2015 6:26 pm
Location: Canada

Re: How to change the font used in the TOC

Post by BogdanM777 »

Thank you so much Radu. It worked!
As I was saying in my initial post, I am new to DITA, so would you please be so kind and suggest me some reference books I could acquire in order to get better in using DITA?
Thank you very much.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to change the font used in the TOC

Post by Radu »

Hi Bogdan,

There is a book called "DITA For Print" which covers a lot of aspects of PDF customization:

http://xmlpress.net/publications/dita/dita-for-print/

In order to find the XSLT stylesheet where the font could be changed for the TOC in your case I used some brute force approach like:

1) Edit the transformation scenario and set the parameter clean.temp to no

2) After publishing I looked in the transformation temporary files folder and opened the topic.fo file from it.
In the XSL-FO I located the TOC part.

3) I searched in the PDF plugin XSLT code (Find Replace in Files) to find the template which generates the TOC structure and looked at the attribute sets used on various elements.

For styling a certain DITA element I usually take its @class attribute value and search in all the DITA OT stylesheets for the last part of its attribute value to find the template which produces it.

If you want a more elegant approach we have a topic about how you could use the Oxygen XSLT debugger to debug DITA OT PDF transformations:

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

Our XSLT debugger has a backmapping feature in which you click in the produced XSL-FO output and the debugger shows you the XSLT template which produced it.

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