summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-features.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/modules/mkiv/s-fonts-features.lua')
-rw-r--r--tex/context/modules/mkiv/s-fonts-features.lua77
1 files changed, 74 insertions, 3 deletions
diff --git a/tex/context/modules/mkiv/s-fonts-features.lua b/tex/context/modules/mkiv/s-fonts-features.lua
index 0a7cf8b13..6f4032948 100644
--- a/tex/context/modules/mkiv/s-fonts-features.lua
+++ b/tex/context/modules/mkiv/s-fonts-features.lua
@@ -13,6 +13,10 @@ moduledata.fonts.features = moduledata.fonts.features or { }
local sortedhash = table.sortedhash
+local v_yes = interfaces.variables.yes
+local v_no = interfaces.variables.no
+local c_name = interfaces.constants.name
+
local NC, NR, bold = context.NC, context.NR, context.bold
function moduledata.fonts.features.showused(specification)
@@ -49,12 +53,12 @@ function moduledata.fonts.features.showused(specification)
elseif rawget(descriptions,feature) then
NC() context(feature)
NC() context("+") -- extra
- NC() context(descriptions[feature])
+ NC() context.escaped(descriptions[feature])
done = true
elseif rawget(features,feature) then
NC() context(feature)
NC() -- otf
- NC() context(features[feature])
+ NC() context.escaped(features[feature])
done = true
else
NC() context(feature)
@@ -83,6 +87,51 @@ local function collectkerns(tfmdata,feature)
local lookuphash = resources.lookuphash
local feature = feature or "kern"
if sequences then
+
+ if true then
+
+ for i=1,#sequences do
+ local sequence = sequences[i]
+ if sequence.features and sequence.features[feature] then
+ local steps = sequence.steps
+ for i=1,#steps do
+ local step = steps[i]
+ local format = step.format
+ for unicode, hash in table.sortedhash(step.coverage) do
+ local kerns = combinations[unicode]
+ if not kerns then
+ kerns = { }
+ combinations[unicode] = kerns
+ end
+ for otherunicode, kern in table.sortedhash(hash) do
+ if format == "pair" then
+ local f = kern[1]
+ local s = kern[2]
+ if f then
+ if s then
+ -- todo
+ else
+ if not kerns[otherunicode] and f[3] ~= 0 then
+ kerns[otherunicode] = f[3]
+ end
+ end
+ elseif s then
+ -- todo
+ end
+ elseif format == "kern" then
+ if not kerns[otherunicode] and kern ~= 0 then
+ kerns[otherunicode] = kern
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ else -- old loader
+
for i=1,#sequences do
local sequence = sequences[i]
if sequence.features and sequence.features[feature] then
@@ -107,7 +156,9 @@ local function collectkerns(tfmdata,feature)
end
end
end
+
end
+
return combinations
end
@@ -142,6 +193,7 @@ function moduledata.fonts.features.showallkerns(specification)
local tfmdata = fonts.hashes.identifiers[id]
local allkerns = collectkerns(tfmdata)
local characters = tfmdata.characters
+ local hfactor = tfmdata.parameters.hfactor
if next(allkerns) then
for first, pairs in sortedhash(allkerns) do
context.par()
@@ -150,7 +202,7 @@ function moduledata.fonts.features.showallkerns(specification)
-- if not kerns and pairs[second] then
-- -- weird
-- end
- showkernpair(first,kern,second,0)
+ showkernpair(first,kern*hfactor,second)
end
context.par()
end
@@ -159,3 +211,22 @@ function moduledata.fonts.features.showallkerns(specification)
context.par()
end
end
+
+function moduledata.fonts.features.showfeatureset(specification)
+ specification = interfaces.checkedspecification(specification)
+ local name = specification[c_name]
+ if name then
+ local s = fonts.specifiers.contextsetups[name]
+ if s then
+ local t = table.copy(s)
+ t.number = nil
+ if t and next(t) then
+ context.starttabulate { "|T|T|" }
+ for k, v in sortedhash(t) do
+ NC() context(k) NC() context(v == true and v_yes or v == false and v_no or tostring(v)) NC() NR()
+ end
+ context.stoptabulate()
+ end
+ end
+ end
+end