Forum How do I...?

Underlining portion of Arabic text

jenniferflint
I have an author who wants to underline only a portion of a full word in Arabic text. The difficulty is that the full word is composed of multiple glyphs which are composed in different ways when they are used together versus when they are standalone. The full word should appear as below:

نماز

With the underlined portion being the final three unicode characters of which it is composed (reverting to LTR presentation), as shown in the XML snippet below:

&#1606;<underline>&#1605;&#1575;&#1586;</underline>

It is critical that &#1606; (Arabic letter noon) still retain the form that it assumes when it is part of the whole word (as shown above, top) and does not revert to its standalone form - ن. While MS Word and Mozilla Firefox seem to have no difficulty composing the full word and then setting the underline properly, the PDFs I generate from Prince cause this character to revert to ن after the underline (see attached). How can this be overcome or is this is shortcoming in Prince? I am using Jameel Noori Nastaleeq font, but this happens even when I switch to the default Times New Roman.

See attached PDF.
  1. arabic-underline-test.pdf98.4 kB
mikeday
At the moment Prince will not join Arabic across span boundaries. You could solve this by placing &zwj; before and after the start tag to ensure correct joining behaviour:
&#1606;&zwj;<underline>&zwj;&#1605;&#1575;&#1586;</underline>
jenniferflint
But in this case, such a workaround doesn't lead to proper joining behavior. Instead, we get a truncated, disconnected version of the end glyph (see attached).
  1. arabic-underline-test-zwj.pdf98.7 kB
    zero width joiner before and after <u>
mikeday
Ah that's unfortunate, presumably the Nastaleeq font relies on cursive connection which will be inhibited by the span boundary and not fixed by the zero-width joiner. Does this fix Times New Roman though, which I don't think relies on cursive connection?
jenniferflint
It actually does work with Times New Roman, but the author has been insistent thus far that the representation of characters in Times New Roman is not suitable. So our choice is fully underline words with his preferred font or use Times New Roman with the partial underlines. I will explain it to the author and see if he can be convinced. Thanks for your help.
mikeday
The only other option at the moment would be to add the underline manually, but that could get very tedious if there are thousands of these words. Hopefully we can address this issue in the future.