2

I am very new to DITA OT. Downloaded the DITA-OT1.5.4_full_easy_install_bin and playing around with it. I'm trying to print few characters in Simplified Chinese (zh-CN) into a PDF. I see that the characters are printed correctly in XHTML but in PDF they are printed as "#".

In the command line I see this - "Warning: Glyph "?" (0x611f) not available in font "Helvetica".

Here are the things I have tried so far:

In demo\fo\fop\conf\fop.xconf :

<fonts>
     <font kerning="yes" 
         embed-url="file:///C:/Windows/Fonts/simsun.ttc" 
         embedding-mode="subset" encoding-mode="cid">
             <font-triplet name="SimSun" style="normal" weight="normal"/>
     </font>
     <auto-detect/>
     <directory recursive="true">C:\Windows\Fonts</directory>
</fonts>

In demo\fo\cfg\fo\attrs\custom.xsl :

<xsl:attribute-set name="__fo__root">
     <xsl:attribute name="font-family">SimSun</xsl:attribute>
</xsl:attribute-set>

In demo\fo\cfg\fo\font-mapping.xml added this block for Sans, Serif & Monospaced logical fonts:

<physical-font char-set="Simplified Chinese">
     <font-face>SimSun</font-face>
</physical-font>

In samples\concepts\garageconceptsoverview.xml :

<shortdesc xml:lang="zh_CN">職業道德感.</shortdesc>
And this is the command I am using to generate the PDF:
ant -Dargs.input=samples\hierarchy.ditamap -Dtranstype=pdf

Any help would be appreciated. Thanks.

[EDIT] I see that the topic.fo file which gets generated in temp folder, does contain the Chinese characters correctly. Like this:

<fo:block font-size="10pt" keep-with-next.within-page="5" start-indent="25pt">職業道德感.</fo:block>

But I do not see the font related information anywhere in this document.

3 Answers3

2

First of all you should set the "xml:lang='zh_CN'" attribute on the root elements for all DITA topics and maps. This will help the DITA OT publishing decide the language to use for static texts like "Table X" and also to decide on the charset to use for the font mappings. Then you should run the publishing by setting the parameter "clean.temp" parameter to "no". After the publishing you can look in the temporary files folder for a file called "topic.fo" and look inside it to see what font families are used. Because even if you set a font on the root element, there are other places in the XSL-FO file where you have font families set explicitly. So instead of setting a font on the XSL-FO root element you should edit the font mappings XML file and for each of the logical fonts "Sans" and "Serif" you should configure the actual font family to use for the Chinese charset, something like:

<logical-font name="Sans">
.........
  <physical-font char-set="Simplified Chinese">
    <font-face>SimSun</font-face>
  </physical-font>
  ......
</logical-font>

More about how the font mappings work:

https://www.oxygenxml.com/doc/versions/17.0/ug-editor/#topics/DITA-map-set-font-Apache-FOP.html

Update: If you insist of having that XSLT customization which sets the "SimSun" font as a font family on the root element, then in the font-mappings.xml you need to define a new mapping for your alias:

<aliases>
  <alias name="SimSun">SimSun</alias>
</aliases>

and then map the logical font to a physical one in the same font-mappings.xml:

<logical-font name="SimSun">
  <physical-font char-set="Simplified Chinese">
    <font-face>SimSun</font-face>
  </physical-font>
</logical-font>
Radu Coravu
  • 1,754
  • 1
  • 9
  • 8
  • 1. I am using a Simplified Chinese in only one place, not everywhere. All other places have English text. 2. I have edited the font mapping XML file (demo\fo\cfg\fo\font-mapping.xml) and added the physical font to all of the logical fonts like - Sans, Serif and Monospaced - I have mentioned this in the question above. Is there any other font mapping file that I have missed? I will try setting clean.temp to "no". Thanks. – Pooja Dabade Dec 11 '15 at 07:21
  • I see that the topic.fo file which gets generated in temp folder, does contain the Chinese characters correctly. But it contains no font related information. I even tried changing the default font to Chinese in build.xml file. No use :-/ – Pooja Dabade Dec 14 '15 at 05:45
  • 1
    At some point I updated my original reply to contain an "Update:" section. Did you perform the advice I gave you there? – Radu Coravu Dec 14 '15 at 11:49
  • It worked when I changed the default language to zh-cn. (the first line in your answer helped) Thanks for all the help :) – Pooja Dabade Jan 04 '16 at 08:23
  • No problem, I'm glad this helped. – Radu Coravu Jan 05 '16 at 07:47
1

0x611f , this character is a chinese character (感), helvetica is an europe font , so no this character in the "helvetica" font. You can search this "helvetica" font loaction, in this position your content(ditamap/dita) should use chinese font, not europe font. You must find that arritbute that include the [font-famliy=helvetical], modify in your own plugin [SimSun, Helvetical].

0

Sorry, I cannot answer your question, but you should definetely try a newer DITA-OT from http://dita-ot.github.io/. Your DITA-OT is not supported anymore. Maybe your problem fades away using the latest release.

Stefan Jung
  • 1,209
  • 11
  • 20