diff options
Diffstat (limited to 'tex/context/base/font-otd.lua')
-rw-r--r-- | tex/context/base/font-otd.lua | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/tex/context/base/font-otd.lua b/tex/context/base/font-otd.lua index ebd487959..0bc8225de 100644 --- a/tex/context/base/font-otd.lua +++ b/tex/context/base/font-otd.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['font-otd'] = { license = "see context related readme files" } +local type = type local match = string.match local sequenced = table.sequenced @@ -115,16 +116,11 @@ end -- we reimplement the dataset resolver -local special_attributes = { - init = 1, - medi = 2, - fina = 3, - isol = 4 -} +local constants = fonts.analyzers.constants -local resolved = { } -- we only resolve a font,script,language,attribute pair once -local wildcard = "*" -local default = "dflt" +local resolved = { } -- we only resolve a font,script,language,attribute pair once +local wildcard = "*" +local default = "dflt" local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr,dynamic) local features = sequence.features @@ -151,7 +147,7 @@ local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr what = wildcard end if valid then - local attribute = special_attributes[kind] or false + local attribute = constants[kind] or false if a_e and dynamic < 0 then valid = false end @@ -180,7 +176,7 @@ end -- return v -- end) -function otf.dataset(tfmdata,sequences,font,attr) -- attr only when explicit (as in special parbuilder) +function otf.dataset(tfmdata,font,attr) -- attr only when explicit (as in special parbuilder) local script, language, s_enabled, a_enabled, dynamic @@ -220,12 +216,17 @@ function otf.dataset(tfmdata,sequences,font,attr) -- attr only when explicit (as end local ra = rl[attr] if ra == nil then -- attr can be false - ra = { } + ra = { + -- indexed but we can also add specific data by key in: + } rl[attr] = ra + local sequences = tfmdata.resources.sequences setmetatableindex(ra, function(t,k) - local v = initialize(sequences[k],script,language,s_enabled,a_enabled,font,attr,dynamic) - t[k] = v or false - return v + if type(k) == "number" then + local v = initialize(sequences[k],script,language,s_enabled,a_enabled,font,attr,dynamic) + t[k] = v or false + return v + end end) end |