[luatex] How to color unicode combinging characters.

Simo Ojala smsojala at gmail.com
Mon Mar 28 16:09:01 CEST 2011

On Fri, 18 Mar 2011, Khaled Hosny wrote:

> On Fri, Mar 18, 2011 at 03:39:50AM +0200, Khaled Hosny wrote:
>> On Thu, Mar 17, 2011 at 10:25:11PM +0200, Simo Ojala wrote:
>>> Hi,
>>> I am really just taking my first steps in TeX world, so forgive me
>>> my ignorance. However I already have this quite advanced coloring
>>> problem and I have read and been told that LuaTeX might be able to
>>> solve this kind of stuff. So thats why I try to ask this here,
>>> hopefully found the right place to post this kind of problem...
>>> I am trying to create some ancient hebrew inflection charts and the
>>> problem is to be able to paint vowels (and other diacritics) without
>>> changing color of the consonants they are combined with. (The vowels
>>> are unicode combining characters which are positioned according to
>>> and combined with consonants.) I already have got some suggestions
>>> that I could do some thing like this:
>>> \textcolor{red}{a}\textcolor{blue}{b} % where 'a' represents a
>>> consonant and 'b' a vowel
>>> However this leads to situation where the characters are not
>>> actually combined, but just placed separately to the document. That
>>> it turn leads to positioning problems and other bad stuff.
>> You don't provide any sample files, so one can only guess.
>> I think the problem is related to pdfliteral whatsits used to implement
>> color, so using luacolor package (check its documentation) in LaTeX or
>> using ConTeXt would help, either would get rid of whatsits in favour of
>> attributes. But again, without a test file one can only guess.
>> ConTeXt have even more "goodies" to automatically color certain glyphs
>> without manually inserted color commands, but I never used it, though.
> Looks like luacolor is not compatible with luaotfload so opentype
> features (needed for mark positioning) will not work.
> However, ConTeXt test was successful (as far as my non-Hebrew eye can
> tell).
> Regards,
> Khaled
> -- 
> Khaled Hosny
> Egyptian
> Arab


Many thanks to all who contributed in solving this problem, and special 
thanks to Khaled for his solution and the great in-depth explanation in 
tex.stackexchange. I decided to go the ConTeXt way that Khaled proposed as 
it seemed most easiest solution to me.

Little sum up of my findings.

1. As far as I see the ConTeXt solution works and coloring does not lead 
to wandering characters. (And apparently this is exactly what should 
happen as Khaled explained in stackexchange.)

2. However, I managed to stumble upon one special problem case with 
'dagesh' character (Unicode: 05bc, HEBREW POINT DAGESH OR MAPIQ). If I 
use 'SBL Hebrew' or 'Ezra SIL' fonts I am not able to color dagesh 
independently from the consonant it is combined with. However if I use 
'DejaVu Sans' or 'Cardo', there is no problem. I am wondering that maybe 
there is some way to fix this, but could not figure it out yet.
 	I quickly created test case for this if you wanna see what 
happens. (If needed Cardo and Ezra SIL are both open font lincensed and 
downloadable from internet, SBL Hebrew seems to be free to non commercial 


Simo Ojala

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.tex
Type: text/x-tex
Size: 1402 bytes
URL: <http://tug.org/pipermail/luatex/attachments/20110328/5cfe7625/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.pdf
Type: application/pdf
Size: 69711 bytes
URL: <http://tug.org/pipermail/luatex/attachments/20110328/5cfe7625/attachment-0001.pdf>

More information about the luatex mailing list