diff options
Diffstat (limited to 'macros/luatex/generic/luaotfload/fontloader-font-otr.lua')
-rw-r--r-- | macros/luatex/generic/luaotfload/fontloader-font-otr.lua | 117 |
1 files changed, 53 insertions, 64 deletions
diff --git a/macros/luatex/generic/luaotfload/fontloader-font-otr.lua b/macros/luatex/generic/luaotfload/fontloader-font-otr.lua index e726053202..531f665de7 100644 --- a/macros/luatex/generic/luaotfload/fontloader-font-otr.lua +++ b/macros/luatex/generic/luaotfload/fontloader-font-otr.lua @@ -1,5 +1,6 @@ if not modules then modules = { } end modules ['font-otr'] = { version = 1.001, + optimize = true, comment = "companion to font-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", @@ -2084,8 +2085,6 @@ local function readtable(tag,f,fontdata,specification,...) end end -local variablefonts_supported = (context and true) or (logs and logs.application and true) or false - local function readdata(f,offset,specification) local fontdata, tables = loadtables(f,specification,offset) @@ -2094,12 +2093,6 @@ local function readdata(f,offset,specification) prepareglyps(fontdata) end - if not variablefonts_supported then - specification.instance = nil - specification.variable = nil - specification.factors = nil - end - fontdata.temporary = { } readtable("name",f,fontdata,specification) @@ -2118,71 +2111,66 @@ local function readdata(f,offset,specification) readtable("avar",f,fontdata,specification) readtable("fvar",f,fontdata,specification) - if variablefonts_supported then - - local variabledata = fontdata.variabledata - - if variabledata then - local instances = variabledata.instances - local axis = variabledata.axis - if axis and (not instances or #instances == 0) then - instances = { } - variabledata.instances = instances - local function add(n,subfamily,value) - local values = { } - for i=1,#axis do - local a = axis[i] - values[i] = { - axis = a.tag, - value = i == n and value or a.default, - } - end - instances[#instances+1] = { - subfamily = subfamily, - values = values, - } - end + local variabledata = fontdata.variabledata + + if variabledata then + local instances = variabledata.instances + local axis = variabledata.axis + if axis and (not instances or #instances == 0) then + instances = { } + variabledata.instances = instances + local function add(n,subfamily,value) + local values = { } for i=1,#axis do - local a = axis[i] - local tag = a.tag - add(i,"default"..tag,a.default) - add(i,"minimum"..tag,a.minimum) - add(i,"maximum"..tag,a.maximum) + local a = axis[i] + values[i] = { + axis = a.tag, + value = i == n and value or a.default, + } end - -- report("%i fake instances added",#instances) + instances[#instances+1] = { + subfamily = subfamily, + values = values, + } end - end - - if not specification.factors then - local instance = specification.instance - if type(instance) == "string" then - local factors = helpers.getfactors(fontdata,instance) - if factors then - specification.factors = factors - fontdata.factors = factors - fontdata.instance = instance - report("user instance: %s, factors: % t",instance,factors) - else - report("user instance: %s, bad factors",instance) - end + for i=1,#axis do + local a = axis[i] + local tag = a.tag + add(i,"default"..tag,a.default) + add(i,"minimum"..tag,a.minimum) + add(i,"maximum"..tag,a.maximum) end + -- report("%i fake instances added",#instances) end - - if not fontdata.factors then - if fontdata.variabledata then - local factors = helpers.getfactors(fontdata,true) - if factors then - specification.factors = factors - fontdata.factors = factors - -- report("factors: % t",factors) - -- else - -- report("bad factors") - end + end + if not specification.factors then + local instance = specification.instance + if type(instance) == "string" then + local factors = helpers.getfactors(fontdata,instance) + if factors then + specification.factors = factors + fontdata.factors = factors + fontdata.instance = instance + report("user instance: %s, factors: % t",instance,factors) else - -- report("unknown instance") + report("user instance: %s, bad factors",instance) end end + end + if not fontdata.factors then + if fontdata.variabledata then + local factors = helpers.getfactors(fontdata,true) + if factors then + specification.factors = factors + fontdata.factors = factors + -- report("factors: % t",factors) + -- else + -- report("bad factors") + end + else + -- report("unknown instance") + end end readtable("os/2",f,fontdata,specification) @@ -2433,6 +2421,7 @@ function readers.loadfont(filename,n,instance) hascolor = fontdata.hascolor or false, instance = fontdata.instance, factors = fontdata.factors, + nofsubfonts = fontdata.subfonts and #fontdata.subfonts or nil, }, resources = { -- filename = fontdata.filename, |