[Dev-luatex] Looking for hyphens with Lua

Wlodek Bzyl matwb at univ.gda.pl
Thu May 22 14:28:56 CEST 2008


    Hi

    running the following file
---
\lefthyphenmin=1 \righthyphenmin=1
\hyphenation{a-b}
\showhyphens{ab}
---
    displays on the terminal all hyphens that plain LuaTeX finds in 'ab'.

    Unfortunately, the following

    1. build the 'ab' node list
    2. call lang.hyphenate to insert discretionary hyphens
    3. print the hyphenated node list

    does not print the hyphenated 'ab' list
    -- it prints 'b' instead (see the code below).
---
\lefthyphenmin=1 \righthyphenmin=1
\hyphenation{a-b}
\directlua 0 {
   function traverse_glyphs(head)
     for t in node.traverse_id(33, head) do   % 33 -> glyph node
         texio.write_nl('char = ' .. t.char)
     end
   end

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

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

   traverse_glyphs(head)
   lang.hyphenate(head)
   traverse_glyphs(head)
}
\end
---

    Is it possible to rewind the head pointer below on
    the begining of the list and to print the hyphenated
    list?

  --Wlodek Bzyl



More information about the dev-luatex mailing list