# [XeTeX] color some Hebrew vowels

Sat Sep 19 09:45:57 CEST 2009

On 19 Sep 2009, at 07:53, Lorenz Haas wrote:

> Hi Tilman,
>
> I've tried your suggestion in all possible variations, but the dont
> have any
> effects. Unfortunately.
>
> As soon i use any kind of a command (e.g \textit{#1}) inside my "hem"
> definition the vowels get shifted.

Yes; this is a limitation of how xetex interacts with opentype fonts.
When you insert \special{}s to change the color, or anything else that
breaks up the "run" of consecutive characters being typeset from the
same font, opentype features such as diacritic positioning will not
apply across that boundary. The same thing would apply if you tried to
color the "i" of an "fi" ligature: the presence of the color-changing
command would prevent the ligature forming.

One solution would be to use luatex, which should allow you to color
the vowels independently and still apply the proper positioning rules;
however, you might have to do some fairly technical setup in order to
get there.

A possible workaround in xetex would be to typeset the complete word
(including vowels) in red, and then overlay this with a vowel-less
copy typeset in black. (Use boxes, \llap, or whatever to overprint the
second version.) Writing a handy macro to encapsulate this is left as
an exercise....

JK

> That the coloring works fine (only for the
> enclosed vowels/letters) I currently use:
>
> \usepackage{bidi}
> \newfontface\HebFont[Mapping=tex-text,Script=Hebrew]{SBL Hebrew}
> %\newfontface\HebFont[Mapping=tex-text,Script=Hebrew]{Ezra SIL} %
> both fonts
> dont work
> \definecolor{hebcol}{rgb}{1,.1,.1}
> \newcommand{\he}[1]{{\RL\HebFont #1}}
> \newcommand{\hem}[1]{\LR{\textcolor{hebcol}{#1}}}
>
> \he{ל\hem{וֹ}מ\hem{ֵ}ד} % this is "lomed" with וֹ and ֵ
> colored.
>
>
>
> Thanks,
> Lorenz
>