Eastern Arabic Numbering

85 views
Skip to first unread message

mkaa...@gmail.com

unread,
Oct 1, 2013, 1:10:09 PM10/1/13
to dita-o...@googlegroups.com
Hello Everyone,

Arabic support has worked great out of the box with DITA-OT but I'm having a bit of difficulty with numbering.

Compounded by own lack of understanding when it comes to Arabic I'm slowly figuring things out.

Specifically, my understanding is that Eastern Arabic Numerals should be used for chapter, page, list numbering. (Sub-lists are also displaying English letters: a,b,c,d,etc.)

xsl:number has a format attribute (0x0623) that looks like it will work:

As a test, I overrode this template:
 <xsl:template match="*[contains(@class, ' topic/ol ')]/*[contains(@class, ' topic/li ')]">

and forced the format for the top level and sub-level lists:
<xsl:when test="parent::*[contains(@class, ' topic/ol ')]/parent::*[contains(@class, ' topic/li ')]/parent::*[contains(@class, ' topic/ol ')]">
<xsl:number format="&#x0623;" />
</xsl:when>
<xsl:otherwise>
<xsl:number  format="&#x0623;"/>
</xsl:otherwise>

I get different glyphs but they don't seem to match what Wikipedia suggests.

I tried installing a font I found called Nazanin-s which has the numbers:

How do I determine the correct font-family name? Nazanin-s seems to fail.

Thanks everyone!
Matt

Jarno Elovirta

unread,
Oct 1, 2013, 1:52:00 PM10/1/13
to mkaa...@gmail.com, dita-o...@googlegroups.com
Are you using the I18N processing? (It's on by default and can be disabled with org.dita.pdf2.i18n.enabled=false). Depending on whether I18N processing is used, the font is defined in a different place.

J

signature.asc

mkaa...@gmail.com

unread,
Oct 1, 2013, 2:12:18 PM10/1/13
to dita-o...@googlegroups.com, mkaa...@gmail.com
Hey Jarno,
I am using I18N enabled currently.

I was trying to use the font with:
<fo:block xsl:use-attribute-sets="ol.li__label__content" font-family="Nazanin-s">

I'd get the following error:
[xslt] [PDFX008W][WARN]: Font definition not found for the logical name or alias 'Nazanin-s'. 

I'm a little lost as to the correct approach. Should I specify my own custom font-mapping? Can I create fo/i18n/ar.xml and use it to enable some of these changes?

I'm trying to get in contact with our Arabic subsidiary so I can gather more feedback on what needs to be done.

Thanks!
Matt

Jarno Elovirta

unread,
Oct 1, 2013, 2:28:31 PM10/1/13
to mkaa...@gmail.com, dita-o...@googlegroups.com
When you use I18N processing, *all* font-family settings you have in your FO file will be rewritten. Basically, the I18N processing maps the font-family value into some other value, based on the font-mapping file. Thus you need to add mapping for Nazanin-s into your font-mapping.

Your other alternative is to disable I18N. I'd advice against using I18N processing unless you really need it. (IIRC, originally it was developed as a workaround to FOP not being able to correctly choose a font based per character.)

J


--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

signature.asc

mkaa...@gmail.com

unread,
Oct 1, 2013, 2:54:05 PM10/1/13
to dita-o...@googlegroups.com, mkaa...@gmail.com
Good info Jarno,

I turned it off and now it's recognizing the font but I'm still not getting the correct glyph for those numbers. I also tried removing my font from the xslfo to see how it rendered and it too was incorrect.

Is there a better approach to this problem?

I found some of the unicode values for these numbers:

Can I do some sort of character swap when xml:lang="ar"? With i18n.enabled=true, <li>Test &#x669;</li> (Eastern Arabic number 9) renders correctly with ArialUnicodeMS as the font.

Jarno Elovirta

unread,
Oct 1, 2013, 3:07:15 PM10/1/13
to mkaa...@gmail.com, dita-o...@googlegroups.com
I18N processi will no allow you to modify the content, it's just for defining which font to use for a given character in a given language.

So is the problem that you don't get the correct character (Unicode code point) in the FO? Maybe it's a Saxon limitation, that it doesn't support numbering using the characters you want. Have you checked Saxon 9.1 documentation?

J

Matt Kaatman

unread,
Oct 1, 2013, 3:22:01 PM10/1/13
to Jarno Elovirta, dita-o...@googlegroups.com
That makes sense about it using the wrong code point.

I haven't looked into Saxon documentation yet, but I will do so now.

mkaa...@gmail.com

unread,
Oct 11, 2013, 12:46:23 PM10/11/13
to dita-o...@googlegroups.com
I wanted to followup with results. It's mostly working now.

It's important to distinguish that (due to strange regulatory requirements) I didn't want every single number in the document changed. For instance, the part number should be standard numbering.

The big break was discovering <xsl:number format="&#x661" /> x661 wasn't listed on Microsoft's xsl:number reference but a user from the Mulberry list clued me in.

From there I needed a variable that would determine Arabic or otherwise.

<xsl:variable name="numberFormat" >
    <xsl:choose>
    <xsl:when test="//@xml:lang='ar'" >&#x661;</xsl:when>
    <xsl:otherwise>1</xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Then I had to find every instance of xsl:number that needed to be changed to <xsl:number format="{$numberFormat}"/>

Also fo:page-sequence:

<!-- Page Numbering -->
<xsl:template name="processTopicChapter">
        <fo:page-sequence master-reference="body-sequence" xsl:use-attribute-sets="__force__page__count" initial-page-number="1" format="{$numberFormat}">
Reply all
Reply to author
Forward
0 new messages