From 59e7679528d75e5d523acddf69dabdce42d53734 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 14 Aug 2019 12:32:10 +0200 Subject: 2019-08-14 11:34:00 --- tex/context/base/mkiv/typo-fln.lua | 54 ++++++++++++++------------------------ 1 file changed, 20 insertions(+), 34 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 7ed70296f..3124e80c7 100644 --- a/tex/context/base/mkiv/typo-fln.lua +++ b/tex/context/base/mkiv/typo-fln.lua @@ -48,12 +48,15 @@ local setdisc = nuts.setdisc local setlink = nuts.setlink local setfont = nuts.setfont local setglyphdata = nuts.setglyphdata +local getprop = nuts.getprop +local setprop = nuts.setprop local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph local disc_code = nodecodes.disc local kern_code = nodecodes.kern local glue_code = nodecodes.glue +local localpar_code = nodecodes.localpar local spaceskip_code = nodes.gluecodes.spaceskip @@ -84,26 +87,21 @@ local a_colormodel = attributes.private('colormodel') local texget = tex.get -local texsetattribute = tex.setattribute -local unsetvalue = attributes.unsetvalue - local variables = interfaces.variables local v_default = variables.default local v_line = variables.line local v_word = variables.word ------ is_letter = characters.is_letter ------ categories = characters.categories - -local settings = nil - -function firstlines.set(specification) - settings = specification or { } +local function set(par,specification) enableaction("processors","typesetters.firstlines.handler") if trace_firstlines then report_firstlines("enabling firstlines") end - texsetattribute(a_firstline,1) + setprop(par,a_firstline,specification) +end + +function firstlines.set(specification) + nuts.setparproperty(set,specification) end implement { @@ -123,7 +121,6 @@ implement { } actions[v_line] = function(head,setting) - -- local attribute = fonts.specifiers.contextnumber(setting.feature) -- was experimental local dynamic = setting.dynamic local font = setting.font local noflines = setting.n or 1 @@ -372,29 +369,18 @@ end actions[v_default] = actions[v_line] function firstlines.handler(head) - local start = head - local attr = nil - while start do - attr = getattr(start,a_firstline) - if attr then - break - elseif getid(start) == glyph_code then - break - else - start = getnext(start) - end - end - if attr then - -- here as we can process nested boxes first so we need to keep state - disableaction("processors","typesetters.firstlines.handler") - -- texsetattribute(attribute,unsetvalue) - local alternative = settings.alternative or v_default - local action = actions[alternative] or actions[v_default] - if action then - if trace_firstlines then - report_firstlines("processing firstlines, alternative %a",alternative) + if getid(head) == localpar_code then + local settings = getprop(head,a_firstline) + if settings then + disableaction("processors","typesetters.firstlines.handler") + local alternative = settings.alternative or v_default + local action = actions[alternative] or actions[v_default] + if action then + if trace_firstlines then + report_firstlines("processing firstlines, alternative %a",alternative) + end + return action(head,settings) end - return action(head,settings) end end return head -- cgit v1.2.3