[Dev-luatex] Looking for hyphens with Lua

Taco Hoekwater taco at elvenkind.com
Thu May 22 15:19:43 CEST 2008

Hi Wlodek,

Wlodek Bzyl wrote:
>     Is it possible to rewind the head pointer below on
>     the begining of the list and to print the hyphenated
>     list?

That it doesnt work is a combination of two (maybe three)

First, there is a bug in the executable so that you need to
specify the tail explicitly (I have fixed that in the trunk,
just moments ago)

Second, you have to create characters (subtype 1) instead of
glyphs (subtype 0). This is badly documented, but I do not
yet know where to insert the relevant text.

Third, if you traverse_id, you will never ever see the hyphens,
because they are of type discretionary (id 7), not glyph (33).

The code below should run even on the unpatched executable:

\directlua 0 {
    function traverse_glyphs(head)
      for t in node.traverse(head) do
          if t.id == 33 then
            texio.write_nl('char = ' .. t.char)
            texio.write_nl('id = ' .. t.id)

    head = node.new(33,1)
    head.font = font.current()
    head.char = 97 % ascii a
    head.lang = 0
    tail = node.new(33,1)
    tail.font = font.current()
    tail.char = 98 % ascii b
    tail.lang = 0

% build 'ab' list
    head.next = tail
    tail.next = nil

    lang.hyphenate(head, tail)

Best wishes,

More information about the dev-luatex mailing list