Incorrect Hindi text rendered with DITA OT 3.7.1 and FOP 2.6

40 views Asked by At

We're trying to generate Hindi PDFs using DITA OT 3.7.1, FOP 2.6, and Noto Sans Devanagari, and we're are getting incorrect spellings. For example, to display "version" on the title page, we use "संस्करण". This appears correct in our localized source and topic.fo. But in the generated PDF, it looks like this:

enter image description here

We tried the approach of setting script="deva". Here is how we attempted to add this attribute to "version":

<fo:block xsl:use-attribute-sets="__frontmatter__version__text">
   <fo:inline>
      <xsl:attribute name="script">
         <xsl:choose>
            <xsl:when test="substring-before($locale, '_') = 'hi'">deva</xsl:when>
            <xsl:otherwise>auto</xsl:otherwise>
         </xsl:choose>
      </xsl:attribute>
      <xsl:call-template name="getVariable">
         <xsl:with-param name="id" select="'Version'"/>
      </xsl:call-template>
   </fo:inline>

The generated code in topic.fo looks like this:

<fo:inline script="deva" line-height-shift-adjustment="disregard-shifts"><fo:inline line-height="100%" font-family="Noto Sans Devanagari">संस्करण</fo:inline>: </fo:inline>

We also looked at the suggestion for using only English and Devanagari fonts. This won't work for us because we also have fonts for icons we need to use.

Here's how we define the Devanagari font in the cfg\fo\i18n\hi.xml file for our PDF plugin:

<alphabet char-set="Devanagari">
    <character-set>
     <character-range>
       <start include="yes">&#x0900;</start>
       <end include="yes">&#x097F;</end>
      </character-range>
    </character-set>
  </alphabet>

And this is our font definition in fop.xconf:

<font kerning="yes" embed-url="fonts/NotoSansDevanagari-Regular.ttf">
   <font-triplet name="Noto Sans Devanagari" style="normal" weight="normal"/>
</font>
<font kerning="yes" embed-url="fonts/NotoSansDevanagari-Bold.ttf">
   <font-triplet name="Noto Sans Devanagari" style="normal" weight="bold"/>
   <font-triplet name="Noto Sans Devanagari" style="italic" weight="normal"/>
   <font-triplet name="Noto Sans Devanagari" style="italic" weight="bold"/>
</font>

And we specify the font where applicable in font-mappings.xml:

<physical-font char-set="Devanagari">
   <font-face>Noto Sans Devanagari</font-face>
</physical-font>

Your help is greatly appreciated. Thanks!

0

There are 0 answers