summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/font-oti.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-oti.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/font-oti.lua91
1 files changed, 63 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-oti.lua b/Master/texmf-dist/tex/context/base/font-oti.lua
index 4cb27062623..d6853db31f3 100644
--- a/Master/texmf-dist/tex/context/base/font-oti.lua
+++ b/Master/texmf-dist/tex/context/base/font-oti.lua
@@ -6,52 +6,87 @@ if not modules then modules = { } end modules ['font-oti'] = {
license = "see context related readme files"
}
--- i need to check features=yes|no also in relation to hashing
-
local lower = string.lower
-local otf = fonts.otf
+local allocate = utilities.storage.allocate
+
+local fonts = fonts
+local otf = { }
+fonts.handlers.otf = otf
+
+local otffeatures = fonts.constructors.newfeatures("otf")
+local registerotffeature = otffeatures.register
+
+registerotffeature {
+ name = "features",
+ description = "initialization of feature handler",
+ default = true,
+}
-otf.default_language = 'latn'
-otf.default_script = 'dflt'
+-- these are later hooked into node and base initializaters
-local languages = otf.tables.languages
-local scripts = otf.tables.scripts
+local otftables = otf.tables -- not always defined
-function otf.features.language(tfmdata,value)
+local function setmode(tfmdata,value)
if value then
- value = lower(value)
- if languages[value] then
- tfmdata.language = value
- end
+ tfmdata.properties.mode = lower(value)
end
end
-function otf.features.script(tfmdata,value)
+local function setlanguage(tfmdata,value)
if value then
- value = lower(value)
- if scripts[value] then
- tfmdata.script = value
+ local cleanvalue = lower(value)
+ local languages = otftables and otftables.languages
+ local properties = tfmdata.properties
+ if not languages then
+ properties.language = cleanvalue
+ elseif languages[value] then
+ properties.language = cleanvalue
+ else
+ properties.language = "dflt"
end
end
end
-function otf.features.mode(tfmdata,value)
+local function setscript(tfmdata,value)
if value then
- tfmdata.mode = lower(value)
+ local cleanvalue = lower(value)
+ local scripts = otftables and otftables.scripts
+ local properties = tfmdata.properties
+ if not scripts then
+ properties.script = cleanvalue
+ elseif scripts[value] then
+ properties.script = cleanvalue
+ else
+ properties.script = "dflt"
+ end
end
end
-fonts.initializers.base.otf.language = otf.features.language
-fonts.initializers.base.otf.script = otf.features.script
-fonts.initializers.base.otf.mode = otf.features.mode
-fonts.initializers.base.otf.method = otf.features.mode
+registerotffeature {
+ name = "mode",
+ description = "mode",
+ initializers = {
+ base = setmode,
+ node = setmode,
+ }
+}
-fonts.initializers.node.otf.language = otf.features.language
-fonts.initializers.node.otf.script = otf.features.script
-fonts.initializers.node.otf.mode = otf.features.mode
-fonts.initializers.node.otf.method = otf.features.mode
+registerotffeature {
+ name = "language",
+ description = "language",
+ initializers = {
+ base = setlanguage,
+ node = setlanguage,
+ }
+}
-otf.features.register("features",true) -- we always do features
-table.insert(fonts.processors,"features") -- we need a proper function for doing this
+registerotffeature {
+ name = "script",
+ description = "script",
+ initializers = {
+ base = setscript,
+ node = setscript,
+ }
+}