1if not modules then modules = { } end modules ['s-fonts-missing'] = {
2 version = 1.001,
3 comment = "companion to s-fonts-missing.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9moduledata.fonts = moduledata.fonts or { }
10moduledata.fonts.missing = moduledata.fonts.missing or { }
11
12local legend = fonts.loggers.category_to_placeholder and
13
14 function(id)
15 local privates = fonts.helpers.getprivates(id)
16 if privates then
17 local categories = table.swapped(fonts.loggers.category_to_placeholder)
18 context.starttabulate { "|c|l|" }
19 context.HL()
20 context.NC() context.bold("symbol")
21 context.NC() context.bold("name")
22 context.NC() context.NR()
23 context.HL()
24 for k, v in table.sortedhash(privates) do
25 local tag = characters.categorytags[categories[k]]
26 if tag and tag ~= "" then
27 context.NC() context.dontleavehmode() context.char(v)
28 context.NC() context(k)
29 context.NC() context.NR()
30 end
31 end
32 context.HL()
33 context.stoptabulate()
34 end
35 end
36
37or
38
39 function(id)
40 local mapping = fonts.checkers.mapping
41 context.starttabulate { "|c|c|l|l|" }
42 context.HL()
43 context.NC() context.bold("symbol")
44 context.NC() context.bold("tag")
45 context.NC() context.bold("name")
46 context.NC() context.NR()
47 context.HL()
48 for k, v in table.sortedhash(mapping) do
49 local p = fonts.helpers.newprivateslot(v[1] .. "-" .. v[2])
50 fonts.checkers.placeholder(font.current(),p,k)
51 context.NC() context.char(p)
52 context.NC() context(k)
53 context.NC() context(v[1])
54 context.NC() context.NR()
55 end
56 context.HL()
57 context.stoptabulate()
58 end
59
60function moduledata.fonts.missing.showlegend(specification)
61 specification = interfaces.checkedspecification(specification)
62 context.begingroup()
63 context.definedfont { "Mono*missing" }
64 context(function() legend(specification.id or font.current()) end)
65 context.endgroup()
66end
67
68local function missings()
69 local collected = fonts.checkers.getmissing()
70 for filename, list in table.sortedhash(collected) do
71 if #list > 0 then
72 context.starttabulate { "|l|l|" }
73 context.NC() context.bold("filename")
74 context.NC() context(file.basename(filename))
75 context.NC() context.NR()
76 context.NC() context.bold("missing")
77 context.NC() context(#list)
78 context.NC() context.NR()
79 context.stoptabulate()
80 context.starttabulate { "|l|c|l|" }
81 for i=1,#list do
82 local u = list[i]
83 context.NC() context("%U",u)
84 context.NC() context.char(u)
85 context.NC() context(characters.data[u].description)
86 context.NC() context.NR()
87 end
88 context.stoptabulate()
89 end
90 end
91end
92
93function moduledata.fonts.missing.showcharacters(specification)
94 context.begingroup()
95 context.definedfont { "Mono*missing" }
96 context(function() missings() end)
97 context.endgroup()
98end
99 |