1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
%D \module
%D [ file=s-fonts-missing,
%D version=2011.10.30,
%D title=\CONTEXT\ Style File,
%D subtitle=Some Missing Character Info,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\startluacode
moduledata.fonts = moduledata.fonts or { }
moduledata.fonts.missing = moduledata.fonts.missing or { }
function moduledata.fonts.missing.legend(id)
local c = fonts.hashes.identifiers[id or font.current()]
local privates = c.properties.privates
if privates then
local categories = table.swapped(fonts.loggers.category_to_placeholder)
-- context.starttabulate { "|l|c|c|l|" }
context.starttabulate { "|l|c|l|" }
context.NC()
context.bold("name")
context.NC()
context.bold("symbol")
context.NC()
-- context.bold("node")
-- context.NC()
context.bold("category")
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(k)
context.NC()
context.dontleavehmode()
context.char(v)
context.NC()
-- context.dontleavehmode()
-- commands.getprivatechar(k)
-- context.NC()
context(string.lower(tag))
context.NC()
context.NR()
end
end
context.stoptabulate()
end
end
function moduledata.fonts.missing.characters()
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
\stopluacode
\definefontfeature[missing][missing=yes]
\unexpanded\def\showmissingcharacterslegend
{\begingroup
\definedfont[Mono*missing]% else no privates added
\ctxlua{moduledata.fonts.missing.legend()}%
\endgroup}
\unexpanded\def\showmissingcharacters
{\begingroup
\definedfont[Mono*missing]% else no privates added
\ctxlua{moduledata.fonts.missing.characters()}%
\endgroup}
\continueifinputfile{s-fonts-missing.mkiv}
% the sooner, the more efficient, see log for details
% \enabletrackers[fonts.missing=replace]
% \definefontfeature[default][default][missing=yes] % automatically when enabled
% \usemodule[art-01]
\starttext
\showmissingcharacterslegend
\page
½ ⅓ ¼ ⅕ ⅙ ⅛
\startluacode
for i=1,1000 do
local c = characters.data[i]
if c then
context.char(c.unicodeslot)
context.space()
end
end
\stopluacode
\page
\bf ½ ⅓ ¼ ⅕ ⅙ ⅛
\page
\showmissingcharacters
\stoptext
|