font not rendering properly

Post here questions and problems related to editing and publishing DITA content.
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

font not rendering properly

Post by shudson310 »

Hello, I've scoured the forums and tried to follow Radu's excellent directions, but I am still not able to get the proper fonts to render on my cover page. I'm trying to use Arial Rounded MT Bold. Here are the additions I have made:

font-mappings.xml:
<logical-font name="Sans">
<physical-font char-set="default">
<font-face>Arial Unicode MS, Arial, Arial Rounded MT Bold, Helvetica</font-face>
</physical-font>

fop.xconf:
<fonts>
<auto-detect />

<directory>/Library/Fonts/</directory>

<font metrics-url="/Library/Fonts/arial_rounded_bold.xml" kerning="yes" embed-url="/Library/Fonts/ArialRoundedBold.ttf">
<font-triplet name="ArialRoundedMTBold" style="normal" weight="normal"/>
<font-triplet name="ArialRoundedMTBold" style="bold" weight="bold"/>
<font-triplet name="ArialRoundedMTBold" style="italic" weight="bold"/>
<font-triplet name="ArialRoundedMTBold" style="normal" weight="400"/>
<font-triplet name="ArialRoundedMTBold" style="normal" weight="700"/>
<font-triplet name="Arial Rounded MT Bold" style="normal" weight="normal"/>
<font-triplet name="Arial Rounded MT Bold" style="bold" weight="bold"/>
<font-triplet name="Arial Rounded MT Bold" style="italic" weight="bold"/>
<font-triplet name="Arial Rounded MT Bold" style="normal" weight="400"/>
<font-triplet name="Arial Rounded MT Bold" style="normal" weight="700"/>
</font>

<font metrics-url="/Library/Fonts/arial_unicode.xml" kerning="yes" embed-url="/Library/Fonts/ArialUnicode.ttf">
<font-triplet name="ArialUnicodeMS" style="normal" weight="normal"/>
<font-triplet name="ArialUnicodeMS" style="bold" weight="bold"/>
<font-triplet name="ArialUnicodeMS" style="italic" weight="bold"/>
<font-triplet name="ArialUnicodeMS" style="normal" weight="400"/>
<font-triplet name="ArialUnicodeMS" style="normal" weight="700"/>
<font-triplet name="Arial Unicode MS" style="normal" weight="normal"/>
<font-triplet name="Arial Unicode MS" style="bold" weight="bold"/>
<font-triplet name="Arial Unicode MS" style="italic" weight="bold"/>
<font-triplet name="Arial Unicode MS" style="normal" weight="400"/>
<font-triplet name="Arial Unicode MS" style="normal" weight="700"/>
</font>

</fonts>

custom.xsl:
<xsl:template name="createFrontMatter">
<fo:page-sequence master-reference="front-matter" xsl:use-attribute-sets="__force__page__count">
<xsl:call-template name="insertFrontMatterStaticContents"/>
<fo:flow flow-name="xsl-region-body">
<fo:block text-align="left" font-family="Arial Rounded MT Bold" font-weight="bold">
<!-- set the product series -->
<fo:block-container text-align="left" font-family="Arial Rounded MT Bold" font-size="28pt" font-weight="bold">
<fo:block font-family="Arial Rounded MT Bold" font-size="28pt" font-weight="bold">
<xsl:value-of select="$map//*[contains(@class,' topic/series ')]"/>
</fo:block>
</fo:block-container>

In the output messages, I see:
[xslt] Loading stylesheet /Applications/oxygen/frameworks/dita/DITA-OT/demo/fo/xsl/fo/i18n-postprocess.xsl
[xslt] [PDFX008W][WARN]: Font definition not found for the logical name or alias 'Arial Rounded MT Bold'.

I've tried font names without spaces, and with. I've created font metrics files successfully, but still can't get the fonts to render on the cover PDF. The font is also NOT being included in the PDF when I view the file properties in Acrobat.

Any ideas what is still incorrect in my setup?

Thanks,

--Scott
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: font not rendering properly

Post by Radu »

Hi Scott,

As far as I know, for flexibility reasons, the stylesheets which produce the XSL-FO (like your "custom.xsl") should not reference a font using its real family name but using its alias.
Then at a certain stage the DITA OT tries to map this alias to a real font by looking in the font-mappings.xml.

So this is the reason of the received error:
[xslt] [PDFX008W][WARN]: Font definition not found for the logical name or alias 'Arial Rounded MT Bold'.
So your XSLT customization code should probably be something like this:

Code: Select all

.....
<fo:block-container text-align="left" font-family="arialRoundedMT" font-size="28pt" font-weight="bold">
.....
and then the font-mappings.xml should contain an additional mapping for this extra "arialRoundedMT" notation.
So you should probably add in it another alias like:

Code: Select all

<aliases>
<alias name="arialRoundedMT">ArialRoundedMT</alias>
</aliases>
and another logical font mapping:

Code: Select all

<logical-font name="ArialRoundedMT">
<physical-font char-set="default">
<font-face>Arial Rounded MT Bold</font-face>
</physical-font>
</logical-font>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: font not rendering properly

Post by shudson310 »

Hi Radu,

that was EXACTLY what I needed!

Thank you so much for your fast and helpful response!

--Scott
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
nharrison
Posts: 10
Joined: Fri May 03, 2013 7:53 pm

Re: font not rendering properly

Post by nharrison »

Hi Radu,

I am getting the same messages that Scott was:

Code: Select all


  [xslt] [PDFX008W][WARN]: Font definition not found for the logical name or alias 'AvenirLTStdR'. 
[xslt] [PDFX008W][WARN]: Font definition not found for the logical name or alias 'Georgia'.
So I did a search to see if anyone had had this problem before, and saw Scott's mail.

So I tried following your suggestions, though I'm using AntennaHouse for generating my PDF rather than FOP, since they clearly worked for Scott, but they don't seem to work for me; I'm still getting the same messages, and the fonts aren't showing up in my PDF.

The content I added to font-mappings.xml was:
=======================================================

Code: Select all


    <aliases>
<alias name="AvenirLTStdB">AvenirSTStdB</alias>
</aliases>
<aliases>
<alias name="Georgia">Georgia</alias>
</aliases>

<logical-font name="AvenirLTStdR">
<physical-font char-set="default">
<font-face>Avenir LT Std 45</font-face>
</physical-font>
</logical-font>
<logical-font name="AvenirLTStdH">
<physical-font char-set="default">
<font-face>Avenir LT Std 85</font-face>
</physical-font>
</logical-font>
<logical-font name="AvenirLTStdB">
<physical-font char-set="default">
<font-face>Avenir LT Std 95</font-face>
</physical-font>
</logical-font>
<logical-font name="Georgia">
<physical-font char-set="default">
<font-face>Georgia</font-face>
</physical-font>
</logical-font>
===========================================

But an interesting data point is that if I open the stage3.fo file directly from the AH Formatter UI, the fonts are found, and it generates the PDF as expected.

Any thoughts on what I'm missing here, or what I'm doing wrong?

Thanks,
Nancy
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: font not rendering properly

Post by Radu »

Hi Nancy,

Those errors you receive are not thrown by the PDF processor (Antenna House in your case) but by the XSLT processsing which builds the XSL-FO file.
They mean that one of the XML elements in the XSL-FO file refers using the font-family attribute to a font alias name which is not defined in the font-mappings.xml.
The place where the error is given is this XSLT stylesheet:

USED-DITA-OT-DIR/plugins/org.dita.pdf2/xsl/fo/i18n-postprocess.xsl

in the XSLT template called:

Code: Select all

 <xsl:template match="*[@font-family][not(@font-family='inherit')]" priority="+1">

............
So you could add extra xsl:messages there if you want.

For this warning:

Code: Select all

  [xslt] [PDFX008W][WARN]: Font definition not found for the logical name or alias 'AvenirLTStdR'. 
you should probably also have this definition in the font-mappings.xml:

Code: Select all

<aliases>
<alias name="AvenirLTStdR">AvenirLTStdR</alias>
</aliases>
For the second warning:

Code: Select all

  [xslt] [PDFX008W][WARN]: Font definition not found for the logical name or alias 'Georgia'. 
You already seem to have a mapping in your font-mappings.xml for it, maybe your font-mappings.xml is not used at all by the transformation. Did you define it in a PDF customization folder? Did you edit the catalog.xml file from the PDF customization folder and uncomment the mapping which is made there to the customization font-mappings.xml file?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nharrison
Posts: 10
Joined: Fri May 03, 2013 7:53 pm

Re: font not rendering properly

Post by nharrison »

Hi Radu,

I already have the aliases you suggested (for AvenirLTStdR and AvenirLTStdH as well as AvenirLTStdB and Georgia). I just hadn't included them in the code I sent you.

And I'm using a plugin that calls the standard dita2pdf2 plugin. In my 'plugin_name/cfg/catalog.xml file, I have the following content:

<catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl" />
<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl" />
<uri name="cfg:fo/font-mappings.xml" uri="fo/font-mappings.xml" />
</catalog>


I would think that would be calling my plugin font-mappings.xml file rather than the standard dita2pdf2 one.

When I call the fonts from my plugin style sheets, should I be calling them using the alias names (e.g. 'AvenirLTStdR', which is what I'm doing now) or by their 'real' names, e.g. 'Avenir LT Std 45'?

Thanks,
Nancy
nharrison
Posts: 10
Joined: Fri May 03, 2013 7:53 pm

Re: font not rendering properly

Post by nharrison »

I did a test, by replacing the standard dita2pdf2 font-mappings.xml file with my own, and all my fonts were found. So this means that, as you suggested, my font-mappings.xml file isn't being read by the i18n-postprocess.xsl style sheet. I have it specified in my plugins/plugin_name/catalog.xml file as:

Code: Select all


  <uri name="cfg:fo/font-mappings.xml" uri="fo/font-mappings.xml" />
Presumably, that's either not getting to i18n-preprocess.xsl, or it's being interpreted incorrectly.

Can you suggest a way (and/or a location) that I can specify it so that it will get used?

Thanks,
Nancy
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: font not rendering properly

Post by Radu »

Hi Nancy,

Probably your PDF customization plugin is not properly constructed.
You can use Jarno Elovirta's online PDF plugin generator:

http://dita-generator-hrd.appspot.com/pdf-plugin

to generate a sample plugin and see its structure.

Basically your DITA OT PDF plugin directory plugins/plugin_name should have a folder called cfg with a catalog.xml inside it.
The catalog.xml should contain a mapping for the font-mappings.xml like:

Code: Select all

<uri name="cfg:fo/font-mappings.xml" uri="fo/font-mappings.xml"/>
Then in the cfg/fo folder you should have the font-mappings.xml.
I tested and this worked for me, you can make the custom font-mappings.xml not well formed XML just to see if the transformation uses it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nharrison
Posts: 10
Joined: Fri May 03, 2013 7:53 pm

Re: font not rendering properly

Post by nharrison »

The integration of my plugin simply doesn't seem to be working. The transform is being run from the org.dita.pdf2 folder, but using my {args.xsl} stylesheet as a master stylesheet. So my stylesheets are called, but not the plugin's catalog.xml file (I have one, and it's called just as you suggested, and the font-mappings file is also called exactly as you recommend; I started off with one of Jarno's plugins and modeled mine on his.
The plugin is call pdf5x665, and the transtype is supposed to be dita2pdf5x665, but when the transform runs, it indicates that it's running the PDF transform, not the pdf5x665 transform. If I use the 'advanced' tab on the transform scenario to call; my plugin's build file, the transform fails with the message 'Target "pdf5x665" does not exist in the project "DOST".' Even though, after running a custom integrator (which ran the integration in the 1.8.4 DITA-OT rather than the originally installed DITA-OT), the top-level build.xml file names my plugin transtype 'pdf5x665' as a legal transtype, and includes an import of my plugin's build.xml file.
In any case, this seems to be an integration problem, not really a font problem at all. Let me know if you want me to zip up the plugin and send it to you; it's pretty small (under 120Kb).

thanks,
Nancy
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: font not rendering properly

Post by Radu »

Hi Nancy,

Please follow step (3) from this user manual topic:

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

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nharrison
Posts: 10
Joined: Fri May 03, 2013 7:53 pm

Re: font not rendering properly

Post by nharrison »

As far as I can tell, I've followed all the steps from that page (which I had gone to for guidance):

1. The additional plugin(s) should be copied to the plugins directory from the used DITA Open Toolkit installation (by default OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins.
*** did that, though my DITA-OT directory is ..\frameworks\dita\DITA-OT1.8.4 (I need that version because my client's files have lots of spaces in the filenames, and the standard DITA-OT for my version of Oxygen doesn't work with filenames with spaces.

2. The DITA OT ANT integrator build file needs to be run. In the Transformation Scenarios view there is a predefined transformation scenario called Run DITA OT Integrator which can be used for this.
Important: The folder where the DITA OT is located needs to have full write access permissions set to it.
*** did this, though I had to create a duplicate integration and customize it, in order to integrate the DITA-OT1.8.4; the standard integrator only runs on the standard DITA-OT

3. If the plugin contributed with a new transtype to the publishing stage, the application will not detect it by default. You have to create a new DITA OT transformation scenario with a predefined type which is close to the newly added transtype, then edit the transformation scenario and in the Parameters tab add a parameter called transtype with the value of the newly added transformation type.
*** did this, also, using the transtype 'pdf5x665'. That's the transtype that's not being recognize4d.

Did all the above tasks before my previous mail on the topic. I must have something wrong, but I can't find it.

Regards,
Nancy
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: font not rendering properly

Post by Radu »

Hi Nancy,

So you are using an external DITA OT 1.8.4, right?
This means that you also edited the transformation scenario and in the "Parameters" tab edited the dita.dir parameter to point to the external DITA OT installation, right?

If you still have problem with this please send to our tech support email address support@oxygenxml.com the entire output received in the DITA OT console view from ANT after the transformation fails.
You should open in Oxygen the main ANT build file DITA_OT_1.8.4/build.xml and search in it to see if your transtype is mentioned. If it is not, then the DITA OT Integrator task was not properly run and the plugin was not properly installed.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nharrison
Posts: 10
Joined: Fri May 03, 2013 7:53 pm

Re: font not rendering properly

Post by nharrison »

Hi Radu,

My transtype is definitely mentioned in the main build.xml file under the 1.8.4 DITA-OT. That's why I can't figure out why the build is saying it's not in the DOST project.

I'll send the output file to support, as you suggest.

Thanks,
Nancy
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: font not rendering properly

Post by shudson310 »

I'm now seeing the same problem as Nancy using Antenna House. What is strange, is that the font-mappings don't seem to be honored and the font declarations don't even make it into topic.fo? I can't point the blame at AH, because this seems to be a DITA-OT issue. Were you able to resolve this?
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: font not rendering properly

Post by Radu »

Hi Scott,

If you make the modified "font-mappings.xml" not wellformed XML and you publish, does the DITA OT report this problem? If not, the configuration file is not taken into account.
If it break, then the configuration file is taken into account but it might be possible you are modifying the wrong values in the wrong places.
It depends on what you are trying to do (modify the font for what elements?).
Sorry if this is explained somewhere, it's a long thread so it's kind of hard to follow everything which was posted on it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: font not rendering properly

Post by shudson310 »

It looks like there were a few things to fix:
1. Put the correct font-config.xml file in the right AH install folder.
2. Create a catalog.xml file in the plugin with the following entry:
<uri name="cfg:fo/font-mappings.xml" uri="fo/font-mappings.xml"/>

3. I changed the Normal alias to:
<aliases>
<alias name="FS Albert">Normal</alias>
</aliases>

So the default font would be set to FS Albert.
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Post Reply