[XeTeX] Devanagari glyph shaping and several colours
Jonathan Kew
jonathan at jfkew.plus.com
Sat Jan 10 10:57:54 CET 2009
On 9 Jan 2009, at 16:36, Thomas Köppe wrote:
> Hello,
>
> I am wondering if and how it is possible to apply a different colour
> in the middle of a string of Devanagari characters, like so:
>
> \setmainfont[Script=Devanagari]{Chandas}
> \begin{document}
> [Letter 'ka']\addfontfeatures{Color=00AA99}[Letter 'vowel sign o']
> \end{document}
>
> The aim here is to get the vowel sign in a different colour; in
> practice the two characters appear separate and the proper joining
> does not happen.
>
Sorry, that can't work because the command you're inserting (or any
other approach you try, like \special{...}) is breaking up the
character sequence into separate runs, and each substring gets
processed separately by the OpenType layout code. You'll only get the
proper Devanagari processing if each complete word (or at least
"cluster") is an uninterrupted string of characters.
I suppose in this particular case, at least, you could get the visual
result you're after by finding the glyph IDs and using \XeTeXglyph to
print the exact glyphs you want, without relying on any OpenType
processing. But that's extremely non-portable, and in cases where
additional glyph positioning is needed (such as to place an "u" vowel
appropriately below the letter, perhaps) you'd have to handle that
manually as well.... not really recommended.
JK
More information about the XeTeX
mailing list