Font mapping problems :(

146 views
Skip to first unread message

mrob

unread,
Apr 12, 2018, 3:06:11 AM4/12/18
to DITA-OT Users
Using DITA-OT 2.4.6, I can't get font mappings to work as expected. Actually, I can't get them to work at all.

My installation uses FOP 2.1 (which I gather is bundled with DITA-OT 2.4.6 -- I haven't installed it separately).

I'm following the instructions in DITA for Print, Second Edition (p. 89), "Use a custom font family with font mapping". I'm using logical font mappings because DITA for Print says (p. 82):

"Unfortunately, FOP still doesn’t support per-character font selection, so if you’re using FOP, you might still need font mapping when your fonts don’t contain all the necessary glyphs. For example, if you’re using FOP and you need to display a word in Korean in the middle of a paragraph of English, and the font used by that paragraph doesn’t include any Korean glyphs, you’ll probably have to use font mapping."


That is pretty much the situation with my content: there are words in Chinese characters embedded in paragraphs of English.

So, I've added a new logical font definition to font-mappings.xml, like this:

    <logical-font name="Tagline">
      <physical-font char-set="default">
        <font-face>AvenirLT-Light</font-face>
      </physical-font>
    </logical-font>

I want to use it on the title page, so I added the following line to /cfg/fo/attrs/front-matter-attr.xsl:

    <xsl:attribute name="font-family">Tagline</xsl:attribute>

Also added the appropriate import statement to /cfg/fo/attrs/custom.xsl, e.g.:

    <xsl:import href="front-matter-attr.xsl"/>


And an import statement to /cfg/fo/xsl/custom.xsl, e.g.:

    <xsl:import href="front-matter.xsl"/>

Since I'm not modifying any stylesheet behavior, the file /cfg/fo/xsl/front-matter.xsl is empty, e.g.:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
        version="2.0">
    </xsl:stylesheet>

I have an ANT build script, and when I try to create the PDF, the font mapping fails.

The log file contains the following:

[fop] WARNING: Font "Tagline,normal,700" not found. Substituting with "any,normal,700".

Any suggestions?

Michael Morrison

unread,
Apr 12, 2018, 5:12:10 PM4/12/18
to DITA-OT Users
mrob - 

Check is that the physical font file is installed wherever your OS wants fonts (for example, C:\Windows\Fonts).  And that the font name that you used (AvenirLT-Light) is the name that matches the font file (for example, AvenirLT-Light.ttc). Do you have other programs that can use the font name to display characters from that font? And, of course, is the font available from wherever your running your DOT build?

Assuming that's all Ok, recheck your updates to your plugin files.  For example, do you have an <xsl:import> statement in the custom.xsl file (attrs) for front-matter-attr.xsl?  Is the <xsl:attribute name="font-family">Tagline</xsl:attribute> within the __frontmatter__title attribute set?

If that doesn't work, try with a different font file (change the <font-face>AvenirLT-Light</font-face> to use some other font face that you have), and see if that works.

If that still makes no change, remove your empty /cfg/fo/xsl/front-matter.xsl ... I think that when it's empty, you're overriding the base PDF2 plugin behaviour for front matter processing with no processing.  Try removing the file (and its reference in custom.xsl). 

If still no luck, post here again with more detail about your plugin, and the changes you've made.

Good luck,
Michael

mrob

unread,
Apr 14, 2018, 2:13:52 AM4/14/18
to DITA-OT Users
Hi Michael,

Thanks for your suggestions. Some comments, below...


On Friday, April 13, 2018 at 6:12:10 AM UTC+9, Michael Morrison wrote:
mrob - 

Check is that the physical font file is installed wherever your OS wants fonts (for example, C:\Windows\Fonts). And that the font name that you used (AvenirLT-Light) is the name that matches the font file (for example, AvenirLT-Light.ttc). Do you have other programs that can use the font name to display characters from that font? And, of course, is the font available from wherever your running your DOT build?

Yes, it is installed as "Avenir LT 35 Light". FWIW, <font-face>AvenirLT-Light</font-face> works with my previous plug-in, built with DITA-OT 1.8. Is the physical font face name expected to match to the file name, or to the font name as reported by the Windows Fonts Control Panel? I tried both "Avenir LT 35 Light" and "Avenir-LT-35-Light" for the font-face attribute but I still get the same error.

Assuming that's all Ok, recheck your updates to your plugin files.  For example, do you have an <xsl:import> statement in the custom.xsl file (attrs) for front-matter-attr.xsl?  Is the <xsl:attribute name="font-family">Tagline</xsl:attribute> within the __frontmatter__title attribute set?

Yes and yes.

If that doesn't work, try with a different font file (change the <font-face>AvenirLT-Light</font-face> to use some other font face that you have), and see if that works.

Tried Helvetica. Same error.

If that still makes no change, remove your empty /cfg/fo/xsl/front-matter.xsl ... I think that when it's empty, you're overriding the base PDF2 plugin behaviour for front matter processing with no processing.  Try removing the file (and its reference in custom.xsl).

Tried that. The error persists.

If still no luck, post here again with more detail about your plugin, and the changes you've made.

What details can I tell you? No other changes.

Background: I have been using DITA-OT 1.8 for some years, but must now upgrade to a newer version of DITA-OT.  I have had problems with this, so I just literally started over from scratch, using the Second Edition of DITA for Print as a guide.

I have literally just started to customize my new plugin. Adding my own font mappings and trying to use them was the first customization.

Thanks again,

mrob

mrob

unread,
Apr 17, 2018, 8:59:14 PM4/17/18
to DITA-OT Users
I am completely stuck on this. I have tried fiddling with a number of different things but I keep getting the same error:

      [fop] WARNING: Font "tagline,normal,700" not found. Substituting with "any,normal,700".

Also, later in the log file, I see a zillion errors like this:

      [fop] WARNING: Substituted specified hyphenation character (0x25ba) with 0x2d because the font doesn't have the specified hyphenation character: monospace,normal,400

Any suggestions would be greatly appreciated.
Reply all
Reply to author
Forward
0 new messages