diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/otfl-node-inj.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/otfl-node-inj.lua | 105 |
1 files changed, 38 insertions, 67 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-node-inj.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-node-inj.lua index 9c4612a2299..5b55c8c2e85 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-node-inj.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-node-inj.lua @@ -27,6 +27,7 @@ local glyph = node.id('glyph') local kern = node.id('kern') local traverse_id = node.traverse_id +local unset_attribute = node.unset_attribute local has_attribute = node.has_attribute local set_attribute = node.set_attribute local insert_node_before = node.insert_before @@ -88,8 +89,10 @@ function nodes.set_kern(current,factor,rlmode,x,tfmchr) local bound = #kerns + 1 set_attribute(current,kernpair,bound) kerns[bound] = { rlmode, dx } + return dx, bound + else + return 0, 0 end - return dx, bound end function nodes.set_mark(start,base,factor,rlmode,ba,ma,index) --ba=baseanchor, ma=markanchor @@ -171,6 +174,7 @@ function nodes.trace_injection(head) end -- todo: reuse tables (i.e. no collection), but will be extra fields anyway +-- todo: check for attribute function nodes.inject_kerns(head,where,keep) local has_marks, has_cursives, has_kerns = next(marks), next(cursives), next(kerns) @@ -193,6 +197,7 @@ function nodes.inject_kerns(head,where,keep) mk[n] = tm[n.char] local k = has_attribute(n,kernpair) if k then +--~ unset_attribute(k,kernpair) local kk = kerns[k] if kk then local x, y, w, h = kk[2] or 0, kk[3] or 0, kk[4] or 0, kk[5] or 0 @@ -342,39 +347,21 @@ function nodes.inject_kerns(head,where,keep) -- only w can be nil, can be sped up when w == nil local rl, x, w, r2l = k[1], k[2] or 0, k[4] or 0, k[6] local wx = w - x ---~ if rl < 0 then ---~ if r2l then ---~ if wx ~= 0 then ---~ insert_node_before(head,n,newkern(wx)) ---~ end ---~ if x ~= 0 then ---~ insert_node_after (head,n,newkern(x)) ---~ end ---~ else ---~ if x ~= 0 then ---~ insert_node_before(head,n,newkern(x)) ---~ end ---~ if wx ~= 0 then ---~ insert_node_after(head,n,newkern(wx)) ---~ end ---~ end ---~ else - if r2l then - if wx ~= 0 then - insert_node_before(head,n,newkern(wx)) - end - if x ~= 0 then - insert_node_after (head,n,newkern(x)) - end - else - if x ~= 0 then - insert_node_before(head,n,newkern(x)) - end - if wx ~= 0 then - insert_node_after(head,n,newkern(wx)) - end + if r2l then + if wx ~= 0 then + insert_node_before(head,n,newkern(wx)) + end + if x ~= 0 then + insert_node_after (head,n,newkern(x)) + end + else + if x ~= 0 then + insert_node_before(head,n,newkern(x)) end ---~ end + if wx ~= 0 then + insert_node_after(head,n,newkern(wx)) + end + end end end if next(cx) then @@ -401,35 +388,19 @@ function nodes.inject_kerns(head,where,keep) nodes.trace_injection(head) end for n in traverse_id(glyph,head) do - local k = has_attribute(n,kernpair) - if k then - local kk = kerns[k] - if kk then - local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4] - if y and y ~= 0 then - n.yoffset = y -- todo: h ? - end - if w then - -- copied from above - local r2l = kk[6] - local wx = w - x ---~ if rl < 0 then ---~ if r2l then ---~ if x ~= 0 then ---~ insert_node_before(head,n,newkern(x)) ---~ end ---~ if wx ~= 0 then ---~ insert_node_after(head,n,newkern(wx)) ---~ end ---~ else ---~ if wx ~= 0 then ---~ insert_node_before(head,n,newkern(wx)) ---~ end ---~ if x ~= 0 then ---~ insert_node_after (head,n,newkern(x)) ---~ end ---~ end ---~ else + if n.subtype < 256 then + local k = has_attribute(n,kernpair) + if k then + local kk = kerns[k] + if kk then + local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4] + if y and y ~= 0 then + n.yoffset = y -- todo: h ? + end + if w then + -- copied from above + local r2l = kk[6] + local wx = w - x if r2l then if wx ~= 0 then insert_node_before(head,n,newkern(wx)) @@ -445,11 +416,11 @@ function nodes.inject_kerns(head,where,keep) insert_node_after(head,n,newkern(wx)) end end ---~ end - else - -- simple (e.g. kernclass kerns) - if x ~= 0 then - insert_node_before(head,n,newkern(x)) + else + -- simple (e.g. kernclass kerns) + if x ~= 0 then + insert_node_before(head,n,newkern(x)) + end end end end |