summaryrefslogtreecommitdiff
path: root/otfl-node-inj.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-11-03 03:45:20 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-11-03 03:52:31 +0200
commit430e36b5a723b307678070fd5b8597ab7c57a935 (patch)
tree486f1ad2035cea6698c0c550790e87bcd5d3ff13 /otfl-node-inj.lua
parentf089d7c2866791b5b48c07fe6a6c001727ca50c1 (diff)
downloadluaotfload-430e36b5a723b307678070fd5b8597ab7c57a935.tar.gz
Sync with context 2010.11.01
Not tested, yet.
Diffstat (limited to 'otfl-node-inj.lua')
-rw-r--r--otfl-node-inj.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/otfl-node-inj.lua b/otfl-node-inj.lua
index f576c7e..e4380a4 100644
--- a/otfl-node-inj.lua
+++ b/otfl-node-inj.lua
@@ -188,12 +188,13 @@ function injections.handler(head,where,keep)
trace(head)
end
-- in the future variant we will not copy items but refs to tables
- local done, ky, rl, valid, cx, wx, mk = false, { }, { }, { }, { }, { }, { }
+ local done, ky, rl, valid, cx, wx, mk, nofvalid = false, { }, { }, { }, { }, { }, { }, 0
if has_kerns then -- move outside loop
local nf, tm = nil, nil
for n in traverse_id(glyph_code,head) do
if n.subtype < 256 then
- valid[#valid+1] = n
+ nofvalid = nofvalid + 1
+ valid[nofvalid] = n
if n.font ~= nf then
nf = n.font
tm = fontdata[nf].marks
@@ -221,7 +222,8 @@ function injections.handler(head,where,keep)
local nf, tm = nil, nil
for n in traverse_id(glyph_code,head) do
if n.subtype < 256 then
- valid[#valid+1] = n
+ nofvalid = nofvalid + 1
+ valid[nofvalid] = n
if n.font ~= nf then
nf = n.font
tm = fontdata[nf].marks
@@ -230,7 +232,7 @@ function injections.handler(head,where,keep)
end
end
end
- if #valid > 0 then
+ if nofvalid > 0 then
-- we can assume done == true because we have cursives and marks
local cx = { }
if has_kerns and next(ky) then
@@ -243,7 +245,7 @@ function injections.handler(head,where,keep)
local p_cursbase, p = nil, nil
-- since we need valid[n+1] we can also use a "while true do"
local t, d, maxt = { }, { }, 0
- for i=1,#valid do -- valid == glyphs
+ for i=1,nofvalid do -- valid == glyphs
local n = valid[i]
if not mk[n] then
local n_cursbase = has_attribute(n,cursbase)
@@ -307,7 +309,7 @@ function injections.handler(head,where,keep)
end
end
if has_marks then
- for i=1,#valid do
+ for i=1,nofvalid do
local p = valid[i]
local p_markbase = has_attribute(p,markbase)
if p_markbase then