Debian Codegraph @

texmf-dist/doc/fonts/pennstander-otf/s-math-characters-renewed.mkiv

raw
1 %D \module
2 %D [ file=s-math-characters-renewed.mkiv, % was: s-fnt-25 and later s-mat-10 and later s-math-characters.mkiv
3 %D version=2026.04.20
4 %D title=\CONTEXT\ Style File,
5 %D subtitle=Math Glyph Checking,
6 %D author=Hans Hagen, Julius Ross
7 %D date=\currentdate,
8 %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9 %C
10 %C This module is part of the \CONTEXT\ macro||package and is
11 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12 %C details.
13
14 \startmodule[math-characters-renewed]
15
16 \registerctxluafile{s-math-characters-renewed}{}
17
18 % context --jit --global --bodyfont=cambria --result=math-characters-cambria s-math-characters.mkiv
19 % context --jit --global --bodyfont=modern --result=math-characters-modern s-math-characters.mkiv
20
21 \startsetups s-math-characters:reset
22
23 \let\showmathcharactersstart \relax
24 \let\showmathcharactersstop \relax
25 \let\showmathcharactersreference \gobbleoneargument
26 \let\showmathcharactersstartentry \relax
27 \let\showmathcharactersstopentry \relax
28 \let\showmathcharactersentryhexdectit \gobblethreearguments
29 \let\showmathcharactersdefinemathsymbol \gobblethreearguments
30 \let\showmathcharactersdefinevariantsymbol \gobblethreearguments
31 \let\showmathcharactersdefinesizesymbol \gobblethreearguments
32 \let\showmathcharactersentrywdhtdpic \gobblefourarguments
33 \ifcase\contextlmtxmode
34 \let\showmathcharactersentrywdhtdpicta \gobblefivearguments
35 \else
36 \let\showmathcharactersentrywdhtdpicta \gobbleoneargument
37 \fi
38 \let\showmathcharactersentryresource \gobbleoneargument
39 \let\showmathcharactersstartnext \relax
40 \let\showmathcharactersnextentry \gobblethreearguments
41 \let\showmathcharactersnextcycle \gobbleonearguments
42 \let\showmathcharactersstopnext \relax
43 \let\showmathcharactersstarthparts \relax
44 \let\showmathcharactershpartsentry \gobblethreearguments
45 \let\showmathcharactersstophparts \relax
46 \let\showmathcharactersstartvparts \relax
47 \let\showmathcharactersvpartsentry \gobblethreearguments
48 \let\showmathcharactersstopvparts \relax
49 \let\showmathcharactersbetweennextandvparts\relax
50 \let\showmathcharactersstartentryclassspec \relax
51 \let\showmathcharactersstopentryclassspec \relax
52 \let\showmathcharactersentryclassname \gobbletwoarguments
53 \let\showmathcharactersentrysymbol \gobbletwoarguments
54 \let\showmathcharactersstartlookupvariants \relax
55 \let\showmathcharacterslookupvariant \gobblefourarguments
56 \let\showmathcharactersstoplookupvariants \relax
57 \let\showmathcharacterssetrange \gobblethreearguments
58
59 \stopsetups
60
61 \directsetup{s-math-characters:reset}
62
63 %
64 % default setup
65 %
66
67 \startsetups s-math-characters:default
68
69 \directsetup{s-math-characters:reset}
70
71 \unexpanded\def\showmathcharactersstartentry {\blank\raggedright}
72 \unexpanded\def\showmathcharactersstopentry {\blank}
73
74 \def\showmathcharactersentryhexdectit##1##2##3%
75 {##1:\space{\char##2}\space\ruledhbox{\char##2}\space##3\par}
76
77 %% define the command \showmathcharactersmathsymbol for the base symbol
78 %% taking into account the exceptions needed if the base is special
79 %% is there a better way to do this?
80 \def\showmathcharactersdefinemathsymbol##1##2##3%
81 {
82 \edef\tempa{##2}%
83 \edef\tempb{92}\ifx\tempa\tempb % backslash
84 \def\showmathcharactersmathsymbol{\backslash}%
85 \else
86 \edef\tempb{94}\ifx\tempa\tempb % caret
87 \def\showmathcharactersmathsymbol{\^{}}%
88 \else
89 \edef\tempb{95}\ifx\tempa\tempb % underscore
90 \def\showmathcharactersmathsymbol{\_{}}%
91 \else
92 \definemathsymbol[showmathcharactersmathsymbol][##3][##2]%
93 \fi\fi\fi
94 }
95
96 %% define the command \showmathcharactersdefinevariantsymbol for the variant symbol
97 %% taking into account the exceptions needed if the variant is special
98 \def\showmathcharactersdefinevariantsymbol##1##2##3%
99 {
100 \edef\tempa{##2}%
101 \edef\tempb{92}\ifx\tempa\tempb % backslash
102 \def\showmathcharactersvariantsymbol{\backslash}%
103 \else
104 \edef\tempb{94}\ifx\tempa\tempb % caret
105 \def\showmathcharactersvariantsymbol{\^{}}%
106 \else
107 \edef\tempb{95}\ifx\tempa\tempb % underscore
108 \def\showmathcharactersvariantsymbol{\_{}}%
109 \else
110 \definemathsymbol[showmathcharactersvariantsymbol][##3][##2]%
111 \fi\fi\fi
112 }
113 %% define the command \showmathcharacterssizesymbol to use the size symbol
114 %% taking into account the exceptions needed if the variant is special
115 \def\showmathcharactersdefinesizesymbol##1##2##3%
116 {
117 \edef\tempa{##2}%
118 \edef\tempb{92}\ifx\tempa\tempb % backslash
119 \def\showmathcharacterssizesymbol{\backslash}%
120 \else
121 \edef\tempb{94}\ifx\tempa\tempb % caret
122 \def\showmathcharacterssizesymbol{\^{}}%
123 \else
124 \edef\tempb{95}\ifx\tempa\tempb % underscore
125 \def\showmathcharacterssizesymbol{\_{}}%
126 \else
127 \definemathsymbol[showmathcharacterssizesymbol][##3][##2]%
128 \fi\fi\fi
129 }
130
131
132 \def\showmathcharactersentrywdhtdpic##1##2##3##4%
133 {width:\space##1,\space height:\space##2,\space depth:\space##3,\space italic:\space##4\par}
134
135 \def\showmathcharactersentryresource##1%
136 {virtual:\space##1\par}
137
138 \def\showmathcharactersstartnext
139 {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth\relax
140 next:\space}
141
142 \def\showmathcharactersnextentry##1##2##3%
143 {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}}
144
145 \def\showmathcharactersnextcycle##1%
146 {\ifnum##1>\plusone \space=>\space\fi cycle}
147
148 \def\showmathcharactersstopnext
149 {\par\endgroup}
150
151 % parts
152 \def\showmathcharactersstartparts
153 {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth\relax
154 parts:\space}
155
156 \def\showmathcharacterspartsentry##1##2##3%
157 {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}}
158
159 \def\showmathcharactersstopparts
160 {\par\endgroup}
161
162 \let\showmathcharactersstartvparts\showmathcharactersstartparts
163 \let\showmathcharactersvpartsentry\showmathcharacterspartsentry
164 \let\showmathcharactersstopvparts \showmathcharactersstopparts
165
166 \let\showmathcharactersstarthparts\showmathcharactersstartparts
167 \let\showmathcharactershpartsentry\showmathcharacterspartsentry
168 \let\showmathcharactersstophparts \showmathcharactersstopparts
169
170 \def\showmathcharactersbetweennextandparts
171 {}
172
173 \def\showmathcharactersentryclassname##1##2%
174 {mathclass:\space##1,\space mathname:\space##2\par}
175
176 \def\showmathcharactersentrysymbol##1##2%
177 {mathsymbol:\space##1~\ruledhbox{\char##2}\par}
178
179 % variants
180 \def\showmathcharactersstartlookupvariants
181 {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth\relax
182 lookupvariants:\space}
183
184 \def\showmathcharacterslookupvariant##1##2##3##4%
185 {\ifnum##1>\plusone,\space\fi##2:~{\char##3}\space(##4)}
186
187 \def\showmathcharactersstoplookupvariants
188 {\par\endgroup}
189 \stopsetups
190
191 %
192 % alternative=glyphs
193 %
194
195 \startsetups s-math-characters:glyphs
196 \directsetup{s-math-characters:default}
197 \def\showmathcharactersentryhexdectit##1##2##3%
198 {\im{\showmathcharactersmathsymbol}\allowbreak}
199
200 \def\showmathcharactersstartentry{}
201 \def\showmathcharactersstopentry{}
202
203 \def\showmathcharactersstartnext{}
204 \def\showmathcharactersstopnext{}
205 \def\showmathcharactersentryclassname##1##2{}
206 \def\showmathcharactersentrysymbol##1##2{}
207 \def\showmathcharactersstartlookupvariants{}
208
209 \def\showmathcharacterslookupvariant##1##2##3##4%
210 {\im{\showmathcharactersvariantsymbol}\allowbreak}
211
212 \def\showmathcharactersstoplookupvariants{}
213 \def\showmathcharactersnextentry##1##2##3%
214 {\im{\showmathcharacterssizesymbol}\allowbreak}
215 \def\showmathcharactersnextcycle##1{}
216 \stopsetups
217
218 %
219 % alternative=glyphswithoutsizes
220 %
221
222 \startsetups s-math-characters:glyphswithoutsizes
223 \directsetup{s-math-characters:glyphs}
224 \def\showmathcharactersnextentry##1##2##3{}
225 \stopsetups
226
227 %
228 % alternative=glyphvariants
229 %
230
231 \startsetups s-math-characters:glyphvariants
232 \directsetup{s-math-characters:default}
233 \def\showmathcharactersstartentry{}
234 \def\showmathcharactersstopentry{}
235 \def\showmathcharactersstartnext{}
236 \def\showmathcharactersstopnext{}
237 \def\showmathcharactersentryclassname##1##2{}
238 \def\showmathcharactersentrysymbol##1##2{}
239 \def\showmathcharactersnextentry##1##2##3{}
240 \def\showmathcharactersnextcycle##1{}
241 \def\showmathcharactersentryhexdectit##1##2##3{}
242 \def\showmathcharactersstartlookupvariants{}
243 \def\showmathcharactersstoplookupvariants{}
244 \def\showmathcharacterslookupvariant##1##2##3##4%
245 {\im{\showmathcharactersvariantsymbol}\allowbreak}
246 \stopsetups
247
248
249 %
250 % alternative=glyphsincontext
251 %
252
253 \startbuffer[s-math-characters-glyphsincontext-base]
254 \im{\showmathcharactersmathsymbol}\allowbreak%
255 \stopbuffer
256
257 \startbuffer[s-math-characters-glyphsincontext-variant]
258 \im{\showmathcharactersvariantsymbol}\allowbreak%
259 \stopbuffer
260
261 \startbuffer[s-math-characters-glyphsincontext-size]
262 \im{\showmathcharacterssizesymbol}\allowbreak%
263 \stopbuffer
264
265
266 \startsetups s-math-characters:glyphsincontext
267 \directsetup{s-math-characters:glyphs}
268 \def\showmathcharactersentryhexdectit##1##2##3%
269 {\getbuffer[s-math-characters-glyphsincontext-base]}
270 \def\showmathcharacterslookupvariant##1##2##3##4%
271 {\getbuffer[s-math-characters-glyphsincontext-variant]}
272 \def\showmathcharactersnextentry##1##2##3%
273 {\getbuffer[s-math-characters-glyphsincontext-size]}
274 \stopsetups
275
276
277 \unprotect
278
279 \unexpanded\def\enableshowmathfontvirtual
280 {\ctxlua{fonts.constructors.autocleanup=false}}
281
282 \unexpanded\def\showmathfontcharacters
283 {\dosingleempty\module_math_characters_show}
284
285 \def\module_math_characters_show[#1]%
286 {\begingroup
287 \getdummyparameters
288 [\c!bodyfont=,
289 \c!list=,
290 \c!check=,
291 \c!alternative=default,
292 \c!option=\v!all,
293 \c!method=\v!default,
294 showfeatures=,
295 togglelist=,
296 #1]%
297 \directsetup{s-math-characters:\dummyparameter\c!alternative}%
298 \doifelsenothing{\dummyparameter\c!bodyfont}
299 {\definedfont[MathRoman*math-text]}
300 {\definedfont[\dummyparameter\c!bodyfont]}%
301 \dontcomplain
302 \ctxlua{moduledata.math.characters.showlist {
303 number = false,
304 check = "\dummyparameter\c!check",
305 list = "\dummyparameter\c!list",
306 option = "\dummyparameter\c!option",
307 method = "\dummyparameter\c!method",
308 showfeatures = "\dummyparameter{showfeatures}",
309 togglelist = "\dummyparameter{togglelist}",
310 }}%
311 \endgroup}
312
313 \protect
314
315 \stopmodule
316
317 \continueifinputfile{s-math-characters.mkiv}
318
319 \setuplayout
320 [width=middle,
321 height=middle,
322 topspace=15mm,
323 backspace=15mm,
324 bottomspace=15mm,
325 header=1cm,
326 headerdistance=0.5cm,
327 footer=0pt]
328
329 \starttext
330
331 \doifelse {\getdocumentargument{bodyfont}} {} {
332
333 \setupbodyfont[cambria, 12pt]
334 % \setupbodyfont[modern, 12pt]
335 % \setupbodyfont[lmvirtual, 12pt]
336 % \setupbodyfont[pxvirtual, 12pt]
337 % \setupbodyfont[txvirtual, 12pt]
338 % \setupbodyfont[palatino, 10pt]
339 % \setupbodyfont[mathtimes, 12pt]
340 % \setupbodyfont[stix, 12pt]
341 % \setupbodyfont[xits, 12pt]
342 % \setupbodyfont[lucida, 12pt]
343 % \setupbodyfont[lucidaot, 12pt]
344 % \setupbodyfont[pagella, 12pt]
345 % \setupbodyfont[bonum, 12pt]
346
347 } {
348
349 \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]}
350
351 }
352
353 % \showmathfontcharacters
354
355 % \showmathfontcharacters[list=0x2208]
356 % \showmathfontcharacters[list=0x2227]
357 % \showmathfontcharacters[list=0x31]
358
359 \setupbodyfont[stixtwo,12pt]
360 %
361 \showmathfontcharacters[list=lowercaseitalic,method=manual]\blank[10pt]
362 %\showmathfontcharacters[list={0x00303,0x02205,0x02208,0x02227,0x0291F},method=manual]\blank[10pt]
363 %\showmathfontcharacters[list=uppercasedoublestruck]\blank[10pt]
364 %\showmathfontcharacters[alternative=glyphs,list=digitsnormal]\blank[10pt]
365 %\showmathfontcharacters[alternative=glyphvariants,list=lowercaseitalic,showfeatures=all,togglelist={aalt,ssty}]\blank[10pt]
366 %\showmathfontcharacters[alternative=glyphvariants,list={digitsnormal},showfeatures=none,togglelist={ss03,ss07}]\blank[10pt]
367 %\showmathfontcharacters[alternative=glyphvariants,list={lowercasenormal},showfeatures=all,togglelist={uppercasing,aalt,ssty}]\blank[10pt]
368 \stoptext
369