filepath and codeph are not using monospaced font like they should

Post here questions and problems related to editing and publishing DITA content.
surangamas
Posts: 47
Joined: Tue Feb 21, 2012 10:17 pm

filepath and codeph are not using monospaced font like they should

Post by surangamas »

Hi,
I am sure this question might've been asked a few times before here, but I just couldn't find answers after searching through this forum.

My problem is, after generating a few PDF files, I've noticed that <filepath> and <codeph> are not output as monospaced font as they should. I looked into pr-domain-attr.xsl and sw-domain-attr.xsl files respectively, and I've also looked into font-mappings.xml, monospaced font is mapped to Courier New and Courier. Yes I've changed the default font to Calibri under "sans" and "serif", and initially I thought that might've been the problem, but when I changed them back to default fonts, the problem was still not resolved, I think it was just set up that way.

Anyway are there any ways that <filepath> and <codeph> can be output as monospaced font? I am using Apache FOP to generate my PDF files, thanks.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: filepath and codeph are not using monospaced font like they should

Post by Radu »

Hi,

So from what I tested the default PDF output does output monspaced fonts for both these elements, right?
So indeed this might be a problem in your customization:

1) Either some problem in the font-mappings.xml, you could test this by reverting the font-mappings.xml to the original one, see if this fixes the problem.
2) Or in your customization XSLTs one of your templates matches topic/ph:

Code: Select all

<xsl:template match="*[contains(@class, ' topic/ph ')]">
....
The XSLT templates in the custom XSLTs have high priority.
For example the <filepath> element has the DITA @class attribute + topic/ph sw-d/filepath so a template matching any phrase will also start matching <filepath> and change its default rendering.
Usually in such cases you need to make your custom XSLT template match more exactly the elements that you want to match like:

Code: Select all

<xsl:template match="*[@class =' topic/ph ']">
....
I discussed about this problem in an older forum thread:

post28139.html?hilit=dita%20bold%20italic#p28139

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
surangamas
Posts: 47
Joined: Tue Feb 21, 2012 10:17 pm

Re: filepath and codeph are not using monospaced font like they should

Post by surangamas »

Hi Radu:
I just happened to remember that I've integrated a specialization plugin before this problem started to happen; one or two of the specialized elements happen to inherit their attributes from <ph>, and you helped me a few days ago on this particular specialization.

If I want to take this specialization out of my DITA-OT plugin completely, what do I have to do? Thanks again!
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: filepath and codeph are not using monospaced font like they should

Post by Radu »

Hi,

If your question is about uninstalling a DITA OT plugin, you need to remove the plugin from the DITA OT plugins folder and then run the integrator again on the DITA OT.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
surangamas
Posts: 47
Joined: Tue Feb 21, 2012 10:17 pm

Re: filepath and codeph are not using monospaced font like they should

Post by surangamas »

Hi Radu:

I will try that again, and will keep you posted, thanks man!
surangamas
Posts: 47
Joined: Tue Feb 21, 2012 10:17 pm

Re: filepath and codeph are not using monospaced font like they should

Post by surangamas »

Hi Radu:
I traced my steps and I found what the problem is; the problem is NOT related to specialization, but to the custom.xsl (cfg/fo/attr) stylesheet that I customized. In that stylesheet, I imported "commons.xsl" without doing any customizations to it (in other words, I just xsl:imported it for the sake of importing), then I removed <xsl:import href="commons.xsl" />, the monospaced font came back (filepath, varname, codeph, etc.), although I didn't understand why, but that did solve my problem as I tried to import it and un-import it a few times, and it confirmed my solution.

Do you know why this happened? Thanks.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: filepath and codeph are not using monospaced font like they should

Post by Radu »

Hi,

Your case is exactly the case I described here:

post28139.html#p28139

I also gave there a suggestion about how to customize the PDF in general:
So whenever you make a customization (like your modified version of "commons.xsl"), please try to only overwrite certain templates, do not make an entire copy of an XSLT stylesheet's contents in your customization.
So you should go through all XSLs imported from the custom.xsl and remove/comment in them the templates which have no changes relative to the base implementation.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
surangamas
Posts: 47
Joined: Tue Feb 21, 2012 10:17 pm

Re: filepath and codeph are not using monospaced font like they should

Post by surangamas »

Hi Radu:

Thanks, that was exactly what happened, thanks again!
Post Reply