summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/meta-imp-txt.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/meta-imp-txt.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/meta-imp-txt.mkiv76
1 files changed, 40 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/meta-imp-txt.mkiv b/Master/texmf-dist/tex/context/base/mkiv/meta-imp-txt.mkiv
index d4329cd6ffd..e9660b3a7e2 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/meta-imp-txt.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/meta-imp-txt.mkiv
@@ -202,10 +202,7 @@
\stopMPdefinitions
\startluacode
- local context = context
-
local nodecodes = nodes.nodecodes
- local kerncodes = nodes.kerncodes
local visible_code = {
[nodecodes.glyph] = true,
@@ -215,66 +212,72 @@
[nodecodes.rule] = true,
}
- local kern_code = nodecodes.kern
- local c_userkern = kerncodes.userkern
- local a_fontkern = attributes.private("fontkern")
-
- local copynode = nodes.copy
- local freenode = nodes.free
+ local disc_code = nodecodes.disc
+ local kern_code = nodecodes.kern
- local topoints = number.topoints
- local mpprint = mp.print
+ local c_userkern = nodes.kerncodes.userkern
+ local a_fontkern = attributes.private("fontkern")
local n = nil
local s = 0
function mp.follow_reset()
- for i=1,#n do
- freenode(n[i])
- end
- n = nil
+ r = nil
s = 0
end
function mp.follow_initialize(b)
- if not n then
- local head = tex.takebox(b).list
- if head then
- n = { }
- s = 0
- head = node.flatten_discretionaries(head)
- local current = head
- while current do
- local id = current.id
- if visible_code[id] then
- s = s + 1
- head, current, n[s] = nodes.remove(head,current)
- elseif id == kern_code and current.subtype == c_userkern and not current[a_fontkern] then
+ if not r then
+ local l = tex.takebox(b).list
+ n = { }
+ s = 0
+ while l do
+ local c = l
+ l = l.next
+ local id = c.id
+ if visible_code[id] then
+ s = s + 1
+ n[s] = c
+ c.prev = nil
+ c.next = nil
+ elseif id == kern_code then
+ if c.subtype == c_userkern and not c[a_fontkern] then
s = s + 1
- head, current, n[s] = nodes.remove(head,current)
+ n[s] = c
+ c.prev = nil
else
- current = current.next
+ n[s].next = c
+ c.prev = n[s]
+ end
+ c.next = nil
+ elseif id == disc_code then
+ local r = c.replace
+ while r do
+ s = s + 1
+ n[s] = r
+ r = r.next
+ r.prev = nil
+ r.next = nil
end
end
- nodes.flush_list(head)
end
end
end
function mp.follow_size()
- mpprint(s)
+ mp.print(s)
end
function mp.follow_slot(i)
- mpprint('textext("\\getfollowtoken{' .. i .. '}")')
+ mp.print('textext("\\getfollowtoken{' .. i .. '}")')
end
function mp.follow_text(s)
- context(copynode(n[s]))
+ context(n[s])
end
function mp.follow_width(i)
- mpprint(topoints(n[i].width))
+ mp.print(number.topoints(n[i].width))
end
\stopluacode
@@ -370,8 +373,9 @@
[medium]
\startuniqueMPgraphic{EnglishRule}{height,width,color}
+ height = \MPvar{height} ;
x1 = 0 ; x3 = \MPvar{width} ; x2 = x4 = .5x3 ;
- y1 = y3 = 0 ; y2 = -y4 = \MPvar{height}/2 ;
+ y1 = y3 = 0 ; y2 = -y4 = height/2 ;
fill z1..z2..z3 & z3..z4..z1 & cycle withcolor \MPvar{color} ;
\stopuniqueMPgraphic