[XeTeX] Diacritics in color

Khaled Hosny khaledhosny at eglug.org
Wed Nov 30 22:01:41 CET 2011

On Wed, Nov 30, 2011 at 02:17:07PM -0500, Aleksandr Andreev wrote:
> Khaled Hosny writes:
> > use/build an OpenType font with proper combining
> > mark positioning and apply the colors to individual glyphs à la what
> > FireFox/LuaTeX and may be many other does.
> What I get out of this comment and the post by Heiko Oberdiek is that
> this should be possible to accomplish in XeTeX.
> My next question is this: is this then an issue with XeTeX, dvipdfmx,
> ICU or Ghostscript?
> I am just trying to understand here the workflow whereby a TeX source
> document becomes PDF in XeTeX and which component breaks the proper
> positioning.

My understanding is that XeTeX reads input, converts characters into a
special "native word" node which is then processed by the layout engine
and converted into and array of positioned glyphs. Color is inserted
using \special{} command, when XeTeX encounters any non character
command is stops collecting characters at that positions, so the input
A\special{pdf:color stuff}^^^^0308 is split into two "native word" nodes
by the \special{} command, each processed by the layout engine
separately i.e. it sees an A on its own and an ^^^^0308 on its own,
which means no OpenType interaction would take place (mark positioning,
ligaturing, whatever).

A solution might involve e.g. not splitting characters at specials
instead, the special and its position in the text stream would be saved
somehow, and then inserted back in the glyph array somehow after being
processed by the layout engine, which would require keeping account of
character to glyph mapping (which is doable, all text editing GUI's have
to do it).

How easy/hard is that is beyond me.


More information about the XeTeX mailing list