summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-goodies.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
commit8d8d528d2ad52599f11250cfc567fea4f37f2a8b (patch)
tree94286bc131ef7d994f9432febaf03fe23d10eef8 /tex/context/modules/mkiv/s-fonts-goodies.lua
parentf5aed2e51223c36c84c5f25a6cad238b2af59087 (diff)
downloadcontext-8d8d528d2ad52599f11250cfc567fea4f37f2a8b.tar.gz
2016-01-12 16:26:00
Diffstat (limited to 'tex/context/modules/mkiv/s-fonts-goodies.lua')
-rw-r--r--tex/context/modules/mkiv/s-fonts-goodies.lua117
1 files changed, 117 insertions, 0 deletions
diff --git a/tex/context/modules/mkiv/s-fonts-goodies.lua b/tex/context/modules/mkiv/s-fonts-goodies.lua
new file mode 100644
index 000000000..381fc45ea
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-goodies.lua
@@ -0,0 +1,117 @@
+if not modules then modules = { } end modules['s-fonts-goodies'] = {
+ version = 1.001,
+ comment = "companion to s-fonts-goodies.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+moduledata.fonts = moduledata.fonts or { }
+moduledata.fonts.goodies = moduledata.fonts.goodies or { }
+
+local NC, NR, HL = context.NC, context.NR, context.HL
+
+local function initialized(specification)
+ specification = interfaces.checkedspecification(specification)
+ local name = specification.name
+ if name then
+ local goodies = fonts.goodies.load(name)
+ if goodies then
+ return specification, goodies
+ end
+ end
+end
+
+function moduledata.fonts.goodies.showstylistics(specification)
+ local specification, goodies = initialized(specification)
+ if goodies then
+ local stylistics = goodies.stylistics
+ if stylistics then
+ context.starttabulate { "|Tl|Tpl|" }
+ HL()
+ NC() context.bold("feature")
+ NC() context.bold("meaning")
+ NC() NR()
+ HL()
+ for feature, meaning in table.sortedpairs(stylistics) do
+ NC() context(feature)
+ NC() context(string.lower(meaning))
+ NC() NR()
+ end
+ HL()
+ context.stoptabulate()
+ end
+ end
+end
+
+function moduledata.fonts.goodies.showfeaturesets(specification)
+ local specification, goodies = initialized(specification)
+ if goodies then
+ local featuresets = goodies.featuresets
+ if featuresets then
+ context.starttabulate { "|Tl|Tpl|" }
+ HL()
+ NC() context.bold("featureset")
+ NC() context.bold("definitions")
+ NC() NR()
+ HL()
+ for featureset, definitions in table.sortedpairs(featuresets) do
+ NC() context.type(featureset) NC()
+ for k, v in table.sortedpairs(definitions) do
+ context("%s=%S",k,v)
+ context.quad()
+ end
+ NC() NR()
+ end
+ HL()
+ context.stoptabulate()
+ end
+ end
+end
+
+function moduledata.fonts.goodies.showcolorschemes(specification)
+ local specification, goodies = initialized(specification)
+ if goodies then
+ local colorschemes = goodies.colorschemes
+ if colorschemes then
+ context.starttabulate { "|Tl|Tpl|" }
+ HL()
+ NC() context.bold("colorscheme")
+ NC() context.bold("numbers")
+ NC() NR()
+ HL()
+ for colorscheme, numbers in table.sortedpairs(colorschemes) do
+ NC() context.type(colorscheme) NC()
+ for i=1,#numbers do
+ context(i)
+ context.quad()
+ end
+ NC() NR()
+ end
+ HL()
+ context.stoptabulate()
+ end
+ end
+end
+
+function moduledata.fonts.goodies.showfiles(specification)
+ local specification, goodies = initialized(specification)
+ if goodies then
+ local files = goodies.files
+ if files and files.list then
+ for filename, specification in table.sortedpairs(files.list) do
+ context.start()
+ context.dontleavehmode()
+ context.definedfont{ filename .. "*default" }
+ context("%s-%s-%s-%s-%s",
+ specification.name or files.name,
+ specification.weight or "normal",
+ specification.style or "normal",
+ specification.width or "normal",
+ specification.variant or "normal")
+ context.par()
+ context.stop()
+ end
+ end
+ end
+end