summaryrefslogtreecommitdiff
path: root/tex/context/base/font-otb.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-otb.lua')
-rw-r--r--tex/context/base/font-otb.lua38
1 files changed, 22 insertions, 16 deletions
diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua
index 946d552e4..2e98d3ecb 100644
--- a/tex/context/base/font-otb.lua
+++ b/tex/context/base/font-otb.lua
@@ -47,13 +47,14 @@ local function gref(descriptions,n)
return f_unicode(n)
end
elseif n then
- local num, nam = { }, { }
- for i=2,#n do
+ local num, nam, j = { }, { }, 0
+ for i=1,#n do
local ni = n[i]
if tonumber(ni) then -- first is likely a key
+ j = j + 1
local di = descriptions[ni]
- num[i] = f_unicode(ni)
- nam[i] = di and di.name or "-"
+ num[j] = f_unicode(ni)
+ nam[j] = di and di.name or "-"
end
end
return f_unilist(num,nam)
@@ -169,7 +170,8 @@ end
-- pseudo names like hyphen_hyphen to endash so in practice we end
-- up with a bit too many definitions but the overhead is neglectable.
--
--- Todo: if changed[first] or changed[second] then ... end
+-- We can have changed[first] or changed[second] but it quickly becomes
+-- messy if we need to take that into account.
local trace = false
@@ -188,8 +190,8 @@ local function finalize_ligatures(tfmdata,ligatures)
local ligature = ligatures[i]
if ligature then
local unicode, lookupdata = ligature[1], ligature[2]
- if trace then
- trace_ligatures_detail("building % a into %a",lookupdata,unicode)
+ if trace_ligatures_detail then
+ report_prepare("building % a into %a",lookupdata,unicode)
end
local size = #lookupdata
local firstcode = lookupdata[1] -- [2]
@@ -201,8 +203,8 @@ local function finalize_ligatures(tfmdata,ligatures)
local firstdata = characters[firstcode]
if not firstdata then
firstcode = private
- if trace then
- trace_ligatures_detail("defining %a as %a",firstname,firstcode)
+ if trace_ligatures_detail then
+ report_prepare("defining %a as %a",firstname,firstcode)
end
unicodes[firstname] = firstcode
firstdata = { intermediate = true, ligatures = { } }
@@ -225,8 +227,8 @@ local function finalize_ligatures(tfmdata,ligatures)
break
end
end
- if trace then
- trace_ligatures_detail("codes (%a,%a) + (%a,%a) -> %a",firstname,firstcode,secondname,secondcode,target)
+ if trace_ligatures_detail then
+ report_prepare("codes (%a,%a) + (%a,%a) -> %a",firstname,firstcode,secondname,secondcode,target)
end
local firstligs = firstdata.ligatures
if firstligs then
@@ -237,6 +239,8 @@ local function finalize_ligatures(tfmdata,ligatures)
firstcode = target
firstname = secondname
end
+ elseif trace_ligatures_detail then
+ report_prepare("no glyph (%a,%a) for building %a",firstname,firstcode,target)
end
if okay then
ligatures[i] = false
@@ -246,12 +250,14 @@ local function finalize_ligatures(tfmdata,ligatures)
end
alldone = done == 0
end
- if trace then
- for k, v in next, characters do
- if v.ligatures then table.print(v,k) end
+ if trace_ligatures_detail then
+ for k, v in table.sortedhash(characters) do
+ if v.ligatures then
+ table.print(v,k)
+ end
end
end
- tfmdata.resources.private = private
+ resources.private = private
end
end
@@ -487,7 +493,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
end
changed[unicode] = data
elseif lookuptype == "alternate" then
- local replacement = data[alternate]
+ local replacement = data[alternate]
if replacement then
changed[unicode] = replacement
if trace_alternatives then