summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-variable.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-05-07 01:01:21 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-05-07 01:01:21 +0200
commit57c3891a6b93b57f91ea77c9bbecffacbcc0da28 (patch)
tree410b95f8a809ab33ffba6ac69bac7c466b4d514d /tex/context/modules/mkiv/s-fonts-variable.lua
parent762562da00d0ec1d50e6d3c2a701156ab42e6d71 (diff)
downloadcontext-57c3891a6b93b57f91ea77c9bbecffacbcc0da28.tar.gz
2017-05-06 23:13:00
Diffstat (limited to 'tex/context/modules/mkiv/s-fonts-variable.lua')
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.lua54
1 files changed, 34 insertions, 20 deletions
diff --git a/tex/context/modules/mkiv/s-fonts-variable.lua b/tex/context/modules/mkiv/s-fonts-variable.lua
index d166e320c..d4e3244a9 100644
--- a/tex/context/modules/mkiv/s-fonts-variable.lua
+++ b/tex/context/modules/mkiv/s-fonts-variable.lua
@@ -15,7 +15,7 @@ local lower = string.lower
local rep = string.rep
local context = context
-local NC, NR, HL = context.NC, context.NR, context.HL
+local NC, NR, HL, ML = context.NC, context.NR, context.HL, context.ML
local bold, monobold, mono, formattedmono = context.bold, context.monobold, context.mono, context.formatted.mono
function moduledata.fonts.variable.showvariations(specification)
@@ -36,6 +36,7 @@ function moduledata.fonts.variable.showvariations(specification)
if not fontdata then
context.type("no font with name %a found",fontname)
+ return
end
local resources = fontdata.resources
@@ -119,21 +120,24 @@ function moduledata.fonts.variable.showvariations(specification)
local tag = axis.tag
local name = axis.name
local variants = axis.variants
- local haslimits = variants[1].maximum
- local haslink = variants[1].link
- for i=1,#variants do
- local variant = variants[i]
- NC() monobold(tag)
- NC() context(name)
- NC() context(variant.name)
- NC() formattedmono("0x%04x",variant.flags)
- NC() context(variant.value)
- NC() context(variant.minimum or "-")
- NC() context(variant.maximum or "-")
- NC() context(variant.link or "-")
- NC() NR()
- tag = nil
- name = nil
+ local first = variants and variants[1]
+ if first then
+ local haslimits = first.maximum
+ local haslink = first.link
+ for i=1,#variants do
+ local variant = variants[i]
+ NC() monobold(tag)
+ NC() context(name)
+ NC() context(variant.name)
+ NC() formattedmono("0x%04x",variant.flags)
+ NC() context(variant.value)
+ NC() context(variant.minimum or "-")
+ NC() context(variant.maximum or "-")
+ NC() context(variant.link or "-")
+ NC() NR()
+ tag = nil
+ name = nil
+ end
end
end
context.stoptabulate()
@@ -175,7 +179,16 @@ function moduledata.fonts.variable.showvariations(specification)
local collected = { }
context.startsubject { title = "instances" }
- if instances and #list > 0 then
+ if not instances or #instances == 0 or not list or #list == 0 then
+ context("no instances defined, incomplete \\type{fvar}/\\type{stat} table")
+ else
+ if #axis > 8 then
+ context.start()
+ context.switchtobodyfont { "small" }
+ if #axis > 12 then
+ context.switchtobodyfont { "small" }
+ end
+ end
context.starttabulate { "||" .. rep("c|",#list) .. "|" }
NC()
for i=1,#list do
@@ -185,7 +198,7 @@ function moduledata.fonts.variable.showvariations(specification)
local fullname = lower(stripstring(fontdata.shared.rawdata.metadata.fullname))
formattedmono("%s*",fullname)
NC() NR()
- HL()
+ ML()
for k=1,#instances do
local i = instances[k]
NC() monobold(i.subfamily)
@@ -205,8 +218,9 @@ function moduledata.fonts.variable.showvariations(specification)
NC() NR()
end
context.stoptabulate()
- else
- context("no instances defined, incomplete \\type{fvar} table")
+ if #axis > 8 then
+ context.stop()
+ end
end
context.stopsubject()