[XeTeX] Diacritics in color (was Re: XETEX cannot access OpenType features in PUA?)

Khaled Hosny khaledhosny at eglug.org
Tue Nov 29 07:42:08 CET 2011

On Tue, Nov 29, 2011 at 07:57:13AM +1100, Ross Moore wrote:
> Hi Aleks,
>
> On 29/11/2011, at 6:18 AM, Aleksandr Andreev wrote:
>
> > Jonathan Kew writes:
> >
> >>> Making this work in xetex would require a different approach to implementing color.
> >
> > I have been able to get it to work (the base glyph in black and the
> > "diacritic" in red) in LuaTeX using the luacolor package.
> >
> > Here's a minimal example:
> >
> > \documentclass{minimal}
> > \usepackage{fontspec}
> > \usepackage{xcolor}
> > \usepackage{luacolor}
> >
> > \newfontface\moo{MezenetsUnicode}
> >
> > \begin{document}
> > \moo
> > \textcolor{red}{}
> > \end{document}
>
> Would you be so kind as to post the PDF from this?

I don't think the PDF result would significantly different whether
luacolor is used or not (apart from the different mark glyph position).
The problem with mark positioning is because the whatsit \special nodes
that get inserted for color, they interfere with the OpenType layout
engine (I guess XeTeX breaks the stream in some way at the special so
the layout engine sees the base character and the mark in separate runs
so no OpenType mark positioning is done). In LuaTeX when luacolor as
loaded (it is the default behaviour in ConTeXt as well), no \special is
inserted in the input stream, instead the text is annotated using
luatex's attributes and at later stage, after all OpenType layout is
done, the attributes are read and whatsit nodes get inserted.

Regards,
Khaled