summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/typo-fln.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/typo-fln.lua')
-rw-r--r--tex/context/base/mkiv/typo-fln.lua54
1 files changed, 20 insertions, 34 deletions
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