From 9bd28a3039a458b054459fe1ef80161b107b798f Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 29 Nov 2018 20:53:37 +0100 Subject: 2018-11-29 19:54:00 --- tex/context/base/mkiv/typo-fln.lua | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'tex/context/base/mkiv/typo-fln.lua') diff --git a/tex/context/base/mkiv/typo-fln.lua b/tex/context/base/mkiv/typo-fln.lua index e105b5a11..b67086fbe 100644 --- a/tex/context/base/mkiv/typo-fln.lua +++ b/tex/context/base/mkiv/typo-fln.lua @@ -204,7 +204,7 @@ actions[v_line] = function(head,setting) while start do local id = getid(start) if id == glyph_code then - n = n + 1 + -- go on elseif id == disc_code then -- this could be an option n = n + 1 @@ -216,7 +216,8 @@ actions[v_line] = function(head,setting) end elseif id == kern_code then -- todo: fontkern -- this could be an option - elseif n > 0 then + elseif id == glue_code then + n = n + 1 if try() then break end @@ -253,7 +254,6 @@ actions[v_line] = function(head,setting) local id = getid(start) local ok = false if id == glyph_code then - n = n + 1 update(start) elseif id == disc_code then n = n + 1 @@ -297,18 +297,26 @@ actions[v_line] = function(head,setting) setdisc(disc,pre,post,replace) flush_node(disc) elseif id == glue_code then - head = insert_node_before(head,start,newpenalty(10000)) -- nobreak + n = n + 1 + if linebreak ~= n then + head = insert_node_before(head,start,newpenalty(10000)) -- nobreak + end end + local next = getnext(start) if linebreak == n then - if trace_firstlines then - head, start = insert_node_after(head,start,newpenalty(10000)) -- nobreak - head, start = insert_node_after(head,start,newkern(-65536)) - head, start = insert_node_after(head,start,tracerrule(65536,4*65536,2*65536,"darkblue")) + if start ~= head then + local where = id == glue_code and getprev(start) or start + if trace_firstlines then + head, where = insert_node_after(head,where,newpenalty(10000)) -- nobreak + head, where = insert_node_after(head,where,newkern(-65536)) + head, where = insert_node_after(head,where,tracerrule(65536,4*65536,2*65536,"darkblue")) + end + head, where = insert_node_after(head,where,newpenalty(-10000)) -- break end - head, start = insert_node_after(head,start,newpenalty(-10000)) -- break + start = next break end - start = getnext(start) + start = next end end -- cgit v1.2.3