diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-09 11:20:37 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-09 11:20:37 +0200 |
commit | 2498bbe606e7cca22799e33dc29ae5160693b3d8 (patch) | |
tree | 2e71bea973ba924760facb782342ed063ab096e2 /tex/context/base/mkiv/font-otr.lua | |
parent | 57c3891a6b93b57f91ea77c9bbecffacbcc0da28 (diff) | |
download | context-2498bbe606e7cca22799e33dc29ae5160693b3d8.tar.gz |
2017-05-09 10:20:00
Diffstat (limited to 'tex/context/base/mkiv/font-otr.lua')
-rw-r--r-- | tex/context/base/mkiv/font-otr.lua | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua index 977be70a6..3addf3324 100644 --- a/tex/context/base/mkiv/font-otr.lua +++ b/tex/context/base/mkiv/font-otr.lua @@ -2075,6 +2075,39 @@ local function readdata(f,offset,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 + 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 + end + if not specification.factors then local instance = specification.instance if type(instance) == "string" then @@ -2089,19 +2122,19 @@ local function readdata(f,offset,specification) 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 - fontdata.instance = instance - report("font instance: %s, factors: % t",instance,factors) + fontdata.factors = factors + report("factors: % t",factors) else - report("user instance: %s, bad factors",instance) + report("bad factors") end else - report("unknown instance") + -- report("unknown instance") end end |