summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-missing.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-missing.lua
parentf5aed2e51223c36c84c5f25a6cad238b2af59087 (diff)
downloadcontext-8d8d528d2ad52599f11250cfc567fea4f37f2a8b.tar.gz
2016-01-12 16:26:00
Diffstat (limited to 'tex/context/modules/mkiv/s-fonts-missing.lua')
-rw-r--r--tex/context/modules/mkiv/s-fonts-missing.lua91
1 files changed, 91 insertions, 0 deletions
diff --git a/tex/context/modules/mkiv/s-fonts-missing.lua b/tex/context/modules/mkiv/s-fonts-missing.lua
new file mode 100644
index 000000000..9a75676a9
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-missing.lua
@@ -0,0 +1,91 @@
+if not modules then modules = { } end modules ['s-fonts-missing'] = {
+ version = 1.001,
+ comment = "companion to s-fonts-missing.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.missing = moduledata.fonts.missing or { }
+
+local function legend(id)
+ local c = fonts.hashes.identifiers[id]
+ local privates = c.properties.privates
+ if privates then
+ local categories = table.swapped(fonts.loggers.category_to_placeholder)
+ context.starttabulate { "|c|l|" }
+ context.HL()
+ context.NC()
+ context.bold("symbol")
+ context.NC()
+ context.bold("name")
+ context.NC()
+ context.NR()
+ context.HL()
+ for k, v in table.sortedhash(privates) do
+ local tag = characters.categorytags[categories[k]]
+ if tag and tag ~= "" then
+ context.NC()
+ context.dontleavehmode()
+ context.char(v)
+ context.NC()
+ context(k)
+ context.NC()
+ context.NR()
+ end
+ end
+ context.HL()
+ context.stoptabulate()
+ end
+end
+
+function moduledata.fonts.missing.showlegend(specification)
+ specification = interfaces.checkedspecification(specification)
+ context.begingroup()
+ context.definedfont { "Mono*missing" } -- otherwise no privates added
+ context(function() legend(specification.id or font.current()) end)
+ context.endgroup()
+end
+
+local function missings()
+ local collected = fonts.checkers.getmissing()
+ for filename, list in table.sortedhash(collected) do
+ if #list > 0 then
+ context.starttabulate { "|l|l|" }
+ context.NC()
+ context.bold("filename")
+ context.NC()
+ context(file.basename(filename))
+ context.NC()
+ context.NR()
+ context.NC()
+ context.bold("missing")
+ context.NC()
+ context(#list)
+ context.NC()
+ context.NR()
+ context.stoptabulate()
+ context.starttabulate { "|l|c|l|" }
+ for i=1,#list do
+ local u = list[i]
+ context.NC()
+ context("%U",u)
+ context.NC()
+ context.char(u)
+ context.NC()
+ context(characters.data[u].description)
+ context.NC()
+ context.NR()
+ end
+ context.stoptabulate()
+ end
+ end
+end
+
+function moduledata.fonts.missing.showcharacters(specification)
+ context.begingroup()
+ context.definedfont { "Mono*missing" } -- otherwise no privates added
+ context(function() missings() end)
+ context.endgroup()
+end