[luatex] inserting

Khaled Hosny khaledhosny at eglug.org
Sun Jun 26 07:01:18 CEST 2011


On Sat, Jun 25, 2011 at 09:20:39PM +0200, Arno Trautmann wrote:
> Hi all,
> 
> I'm becoming desparate and I guess it's only a small error I'm making. I
> try to (please don't ask why …) to colorize all letters in a document. I
> do so by registering the following function in the post_linebreak_filter:
> 
> local color_push = node.new(WHAT,COL)
> local color_pop = node.new(WHAT,COL)
> color_push.cmd = 1
> color_pop.cmd = 2
> 
> uppercasecolor = function (head)
>   for line in node.traverse_id(HLIST,head) do
>     for letter in node.traverse_id(GLYPH,line.head) do
>         color_push.data = math.random().." .5 .5 rg"
>         node.insert_before(line.head,letter,node.copy(color_push))
>         node.insert_after(line.head,letter,node.copy(color_pop))
>     end
>   end
>   return head
> end
> 
> This works fine /except/ for the first letter of every line except the
> first line. So the first line is fine, but for every following line in a
> paragraph, the first letter is not colored. I also get warnings

Try:
  head = node.insert_...

See the thread started by me few days ago.

Regards,
 Khaled

-- 
 Khaled Hosny
 Egyptian
 Arab


More information about the luatex mailing list