diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-02-16 10:59:14 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-02-16 10:59:14 +0100 |
commit | 8e11d447440b44990432ac838953a8cde4ef914f (patch) | |
tree | f30b2ff2d8a10f1aff50e1522d968618a97f067c /tex/context/base/mkiv/font-ctx.lua | |
parent | 43fc66771a0c9d27cc0b7fe7a69392ea313bd0ca (diff) | |
download | context-8e11d447440b44990432ac838953a8cde4ef914f.tar.gz |
2020-02-11 16:39:00
Diffstat (limited to 'tex/context/base/mkiv/font-ctx.lua')
-rw-r--r-- | tex/context/base/mkiv/font-ctx.lua | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index cbb81cdb7..bf14dd309 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -887,23 +887,6 @@ specifiers.definecontext = definecontext -- we extend the hasher: --- constructors.hashmethods.virtual = function(list) --- local s = { } --- local n = 0 --- for k, v in next, list do --- n = n + 1 --- s[n] = k -- no checking on k --- end --- if n > 0 then --- sort(s) --- for i=1,n do --- local k = s[i] --- s[i] = k .. '=' .. tostring(list[k]) --- end --- return concat(s,"+") --- end --- end - constructors.hashmethods.virtual = function(list) local s = { } local n = 0 @@ -924,6 +907,54 @@ constructors.hashmethods.virtual = function(list) end end +if not JITSUPPORTED then + + constructors.hashmethods.normal = function(list) + local s = { } + local n = 0 + for k, v in next, list do + if not k then + -- no need to add to hash + elseif k == "number" or k == "features" then + -- no need to add to hash (maybe we need a skip list) + else + n = n + 1 + if type(v) == "table" then + -- table.sequenced + local t = { } + local m = 0 + for k, v in next, v do + m = m + 1 + t[m] = format("%q=%q",k,v) + end + sort(t) + s[n] = format("%q={%s}",k,concat(t,",")) + else + s[n] = format("%q=%q",k,v) + end + end + end + if n > 0 then + sort(s) + return concat(s,"+") + end + end + + constructors.hashmethods.virtual = function(list) + local s = { } + local n = 0 + for k, v in next, list do + n = n + 1 + s[n] = format("%q=%q",k,v) + end + if n > 0 then + sort(s) + return concat(s,"+") + end + end + +end + -- end of redefine -- local withcache = { } -- concat might be less efficient than nested tables |