diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/font-oti.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/font-oti.lua | 108 |
1 files changed, 106 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-oti.lua b/Master/texmf-dist/tex/context/base/mkiv/font-oti.lua index bacd001a5e8..4c6053be073 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-oti.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-oti.lua @@ -11,8 +11,8 @@ local lower = string.lower local fonts = fonts local constructors = fonts.constructors -local otf = constructors.newhandler("otf") -local otffeatures = constructors.newfeatures("otf") +local otf = constructors.handlers.otf +local otffeatures = constructors.features.otf local registerotffeature = otffeatures.register local otftables = otf.tables or { } @@ -34,6 +34,8 @@ local function setmode(tfmdata,value) end end +otf.modeinitializer = setmode + local function setlanguage(tfmdata,value) if value then local cleanvalue = lower(value) @@ -70,6 +72,7 @@ registerotffeature { initializers = { base = setmode, node = setmode, + plug = setmode, } } @@ -79,6 +82,7 @@ registerotffeature { initializers = { base = setlanguage, node = setlanguage, + plug = setlanguage, } } @@ -88,6 +92,7 @@ registerotffeature { initializers = { base = setscript, node = setscript, + plug = setscript, } } @@ -156,3 +161,102 @@ function otffeatures.checkeddefaultlanguage(featuretype,autolanguage,languages) end end +-- the following might become available generic in due time but for now +-- this is some context playground (development code) + +-- if not context then +-- return +-- end + +-- local helpers = otf.readers.helpers +-- local axistofactors = helpers.axistofactors +-- local normalizedaxis = helpers.normalizedaxis +-- local getaxisscale = helpers.getaxisscale +-- local cleanname = containers.cleanname + +-- local function validvariable(tfmdata) +-- if tfmdata.properties.factors then +-- return +-- end +-- local resources = tfmdata.resources +-- local variabledata = resources and resources.variabledata +-- if not variabledata then +-- return +-- end +-- local instances = variabledata.instances +-- local axis = variabledata.axis +-- local segments = variabledata.segments +-- if instances and axis then +-- return instances, axis, segments +-- end +-- end + +-- local function initializeinstance(tfmdata,value) +-- if type(value) == "string" then +-- local instances, axis, segments = validvariable(tfmdata) +-- if instances then +-- local values +-- for i=1,#instances do +-- local instance = instances[i] +-- if cleanname(instance.subfamily) == value then +-- values = instance.values +-- break +-- end +-- end +-- if values then +-- local factors = { } +-- for i=1,#axis do +-- local a = axis[i] +-- factors[i] = getaxisscale(segments,a.minimum,a.default,a.maximum,values[i].value) +-- end +-- tfmdata.properties.instance = { +-- hash = instance, +-- factors = factors, +-- } +-- end +-- else +-- report("incomplete variable data") +-- end +-- end +-- end + +-- local function initializeaxis(tfmdata,value) +-- if type(value) == "string" then +-- local instances, axis, segments = validvariable(tfmdata) +-- if instances then +-- local values = axistofactors(value) +-- if values then +-- local factors = { } +-- for i=1,#axis do +-- local a = axis[i] +-- local d = a.default +-- factors[i] = getaxisscale(segments,a.minimum,d,a.maximum,values[a.name or a.tag] or d) +-- end +-- tfmdata.properties.instance = { +-- hash = cleanname(value), +-- factors = factors, +-- } +-- end +-- else +-- report("incomplete variable data") +-- end +-- end +-- end + +-- registerotffeature { +-- name = "instance", +-- description = "variation instance", +-- initializers = { +-- node = initializeinstance, +-- base = initializeinstance, +-- } +-- } + +-- registerotffeature { +-- name = "axis", +-- description = "variation axis", +-- initializers = { +-- node = initializeaxis, +-- base = initializeaxis, +-- } +-- } |