summaryrefslogtreecommitdiff
path: root/otfl-font-otb.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2009-12-31 16:32:37 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2009-12-31 16:32:37 +0200
commit21f69a1cb547fc10a4927171de7dddaec5c09b35 (patch)
tree827694fa5be47bd9ba09e48d47915fe4b39de9fc /otfl-font-otb.lua
parent0823f27801c9f0d84a67c27a9b629949d1296f8b (diff)
downloadluaotfload-21f69a1cb547fc10a4927171de7dddaec5c09b35.tar.gz
Updating to latest ConTeXt beta (2009.12.30)
Diffstat (limited to 'otfl-font-otb.lua')
-rw-r--r--otfl-font-otb.lua82
1 files changed, 66 insertions, 16 deletions
diff --git a/otfl-font-otb.lua b/otfl-font-otb.lua
index 675c124..a684580 100644
--- a/otfl-font-otb.lua
+++ b/otfl-font-otb.lua
@@ -279,6 +279,47 @@ function prepare_base_substitutions(tfmdata,kind,value) -- we can share some cod
end
end
+--~ local function prepare_base_kerns(tfmdata,kind,value) -- todo what kind of kerns, currently all
+--~ if value then
+--~ local otfdata = tfmdata.shared.otfdata
+--~ local validlookups, lookuplist = collect_lookups(otfdata,kind,tfmdata.script,tfmdata.language)
+--~ if validlookups then
+--~ local unicodes = tfmdata.unicodes -- names to unicodes
+--~ local indices = tfmdata.indices
+--~ local characters = tfmdata.characters
+--~ local descriptions = tfmdata.descriptions
+--~ for u, chr in next, characters do
+--~ local d = descriptions[u]
+--~ if d then
+--~ local dk = d.mykerns
+--~ if dk then
+--~ local t, done = chr.kerns or { }, false
+--~ for l=1,#lookuplist do
+--~ local lookup = lookuplist[l]
+--~ local kerns = dk[lookup]
+--~ if kerns then
+--~ for k, v in next, kerns do
+--~ if v ~= 0 and not t[k] then -- maybe no 0 test here
+--~ t[k], done = v, true
+--~ if trace_baseinit and trace_kerns then
+--~ logs.report("define otf","%s: base kern %s + %s => %s",cref(kind,lookup),gref(descriptions,u),gref(descriptions,k),v)
+--~ end
+--~ end
+--~ end
+--~ end
+--~ end
+--~ if done then
+--~ chr.kerns = t -- no empty assignments
+--~ end
+--~ -- elseif d.kerns then
+--~ -- logs.report("define otf","%s: invalid mykerns for %s",cref(kind),gref(descriptions,u))
+--~ end
+--~ end
+--~ end
+--~ end
+--~ end
+--~ end
+
local function prepare_base_kerns(tfmdata,kind,value) -- todo what kind of kerns, currently all
if value then
local otfdata = tfmdata.shared.otfdata
@@ -288,31 +329,40 @@ local function prepare_base_kerns(tfmdata,kind,value) -- todo what kind of kerns
local indices = tfmdata.indices
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
+ local sharedkerns = { }
for u, chr in next, characters do
local d = descriptions[u]
if d then
- local dk = d.mykerns
+ local dk = d.mykerns -- shared
if dk then
- local t, done = chr.kerns or { }, false
- for l=1,#lookuplist do
- local lookup = lookuplist[l]
- local kerns = dk[lookup]
- if kerns then
- for k, v in next, kerns do
- if v ~= 0 and not t[k] then -- maybe no 0 test here
- t[k], done = v, true
- if trace_baseinit and trace_kerns then
- logs.report("define otf","%s: base kern %s + %s => %s",cref(kind,lookup),gref(descriptions,u),gref(descriptions,k),v)
+ local s = sharedkerns[dk]
+ if s == false then
+ -- skip
+ elseif s then
+ chr.kerns = s
+ else
+ local t, done = chr.kerns or { }, false
+ for l=1,#lookuplist do
+ local lookup = lookuplist[l]
+ local kerns = dk[lookup]
+ if kerns then
+ for k, v in next, kerns do
+ if v ~= 0 and not t[k] then -- maybe no 0 test here
+ t[k], done = v, true
+ if trace_baseinit and trace_kerns then
+ logs.report("define otf","%s: base kern %s + %s => %s",cref(kind,lookup),gref(descriptions,u),gref(descriptions,k),v)
+ end
end
end
end
end
+ if done then
+ sharedkerns[dk] = t
+ chr.kerns = t -- no empty assignments
+ else
+ sharedkerns[dk] = false
+ end
end
- if done then
- chr.kerns = t -- no empty assignments
- end
- -- elseif d.kerns then
- -- logs.report("define otf","%s: invalid mykerns for %s",cref(kind),gref(descriptions,u))
end
end
end