[XeTeX] Color Hebrew Vowel Points

Jonathan Kew jonathan_kew at sil.org
Wed Jul 25 09:20:56 CEST 2007


On 24 Jul 2007, at 9:41 pm, Joshua Grauman wrote:

> I would like to try your last suggestion about overprinting.  
> However, I
> don't have any idea how to "overprint" either in XeTeX or  
> OpenOffice or
> whatever. Frankly, I would like to use OpenOffice to create the  
> charts.
> For making a critical edition XeTeX is great, for a simple chart...
> Anyway, I was wondering if any of you ps/pdf experts knew how to  
> overlay
> two ps files like Jonathan is suggesting... Thanks.

I see you've got a solution, so this may not be relevant, but perhaps  
someone will find a use for it in the future... anyhow, if you were  
prepared to tackle it in XeTeX it would be pretty easy. Here's a  
possible approach:

   \TeXXeTstate=1
   \font\redfont="Ezra SIL:script=hebr;color=FF0000" at 24pt
   \font\blkfont="Ezra SIL:script=hebr" at 24pt

   \def\redandblack#1x#2{\blkfont
     % print text #1 in red, then overlay #2 in black
     \setbox0=\hbox{\redfont\beginR #1\endR}%
     \setbox2=\hbox{\blkfont\beginR #2\endR}%
     \ifdim\wd0=\wd2 \else
       \message{WARNING: width mismatch: #1 and #2}\fi
     \leavevmode \hbox{\beginL\box0
       \kern-\wd2 \box2\endL}}

   \noindent\beginR
     \redandblack{בְּרֵאשִׁית}x{בּראשית}
     \redandblack{בָּרָא}x{בּרא}
     \redandblack{אֱלֹהִים}x{אלהים}
     % etc

   \end

Note that the third word here is an example where the dot on lamed  
*does* modify the spacing, and therefore the results will not be as  
desired. The SBL Hebrew font would be another option; there, the dot  
causes only a very small change to spacing, so the result might be  
acceptable. If you want the dagesh colored as well, SBL Hebrew  
definitely works better.

This could of course be used within table cells, or whatever, just as  
well as in a normal paragraph. The same technique could be used to  
print Arabic with colored vowels, etc.

For advanced TeX macro programmers: in principle, it should be  
possible to set up macros to automatically do this to running text,  
rather than add macros throughout. Anyone up for a challenge? :-)

JK



More information about the XeTeX mailing list