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\startmodule[fontscoverage]
27
28\unprotect
29
30\definecolor[ColorOne][r=1,t=.5,a=1]
31\definecolor[ColorTwo][b=1,t=.5,a=1]
32
33\startluacode
34 moduledata.fonts = moduledata.fonts or { }
35 moduledata.fonts.overlay = moduledata.fonts.overlay or { }
36
37 function moduledata.fonts.overlay(id)
38 for k, v in table.sortedhash(fonts.hashes.identifiers[id or true].characters) do
39 context.showoverlayedglyphs(k)
40 end
41 end
42\stopluacode
43
44\starttexdefinition unexpanded showoverlayedglyphs#1
45 \startTEXpage[offset=.25\scratchdimentwo,height=10\scratchdimentwo,width=4\scratchdimenone]
46 \ruledhbox to \hsize\bgroup
47 \hss
48 \FontOne\setstrut\strut\showglyphs
49 \startoverlay
50 {\ColorOne\ruledhbox{\FontOne\char#1}}
51 {\ColorTwo\ruledhbox{\FontTwo\char#1}}
52 \stopoverlay
53 \hss
54 \egroup
55 \vfill
56 \dontleavehmode
57 \hbox to \hsize\bgroup
58 \hss
59 \infofont0x\uchexnumbers{#1}
60 \hss
61 \egroup
62 \stopTEXpage
63\stoptexdefinition
64
65\starttexdefinition unexpanded showoverlayedfonts[#1]
66 \start
67 \getdummyparameters[\c!list=,#1]
68 \doifsomething {\dummyparameter\c!list} {
69 \page
70 \getfromcommacommand[\dummyparameter\c!list][1]\let\NameOne\commalistelement
71 \getfromcommacommand[\dummyparameter\c!list][2]\let\NameTwo\commalistelement
72 \definefont[FontOne][\NameOne]
73 \definefont[FontTwo][\NameTwo]
74 \FontOne\expandafter\edef\expandafter\OneID\expandafter{\number\fontid\font}
75 \FontTwo\expandafter\edef\expandafter\TwoID\expandafter{\number\fontid\font}
76 \scratchdimenone\emwidth
77 \scratchdimentwo\exheight
78 \ctxlua{moduledata.fonts.overlay(\OneID)}
79 \page
80
81
82
83
84
85
86
87
88 }
89 \stop
90\stoptexdefinition
91
92\protect
93
94\stopmodule
95
96\continueifinputfile{sfontsoverlay.mkiv}
97
98\starttext
99
100
101
102
103
104 \showoverlayedfonts
105 [list={Serif,SerifBold}]
106
107\stoptext
108 |