s-math-characters.mkiv /size: 6646 b    last modification: 2023-12-21 09:45
1%D \module
2%D   [      file=s-math-characters.mkiv, % was: s-fnt-25 and later s-mat-10
3%D        version=2009.01.25,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Math Glyph Checking,
6%D         author=Hans Hagen,
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]
15
16\registerctxluafile{s-math-characters}{}
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\showmathcharactersentrywdhtdpic       \gobblefourarguments
30    \let\showmathcharactersentryresource       \gobbleoneargument
31    \let\showmathcharactersstartnext           \relax
32    \let\showmathcharactersnextentry           \gobblethreearguments
33    \let\showmathcharactersnextcycle           \gobbleonearguments
34    \let\showmathcharactersstopnext            \relax
35    \let\showmathcharactersstarthparts         \relax
36    \let\showmathcharactershpartsentry         \gobblethreearguments
37    \let\showmathcharactersstophparts          \relax
38    \let\showmathcharactersstartvparts         \relax
39    \let\showmathcharactersvpartsentry         \gobblethreearguments
40    \let\showmathcharactersstopvparts          \relax
41    \let\showmathcharactersbetweennextandvparts\relax
42    \let\showmathcharactersstartentryclassspec \relax
43    \let\showmathcharactersstopentryclassspec  \relax
44    \let\showmathcharactersentryclassname      \gobbletwoarguments
45    \let\showmathcharactersentrysymbol         \gobbletwoarguments
46    \let\showmathcharactersstartlookupvariants \relax
47    \let\showmathcharacterslookupvariant       \gobblefourarguments
48    \let\showmathcharactersstoplookupvariants  \relax
49    \let\showmathcharacterssetrange            \gobblethreearguments
50
51\stopsetups
52
53\directsetup{s-math-characters:reset}
54
55\startsetups s-math-characters:default
56
57    \directsetup{s-math-characters:reset}
58
59    \unexpanded\def\showmathcharactersstartentry {\blank\startpacked\raggedright}
60    \unexpanded\def\showmathcharactersstopentry  {\stoppacked\blank}
61
62    \def\showmathcharactersentryhexdectit##1##2##3%
63      {##1:\space{\char##2}\space\ruledhbox{\char##2}\space##3\par
64       \advance\leftskip\emwidth\relax}
65
66    \def\showmathcharactersentrywdhtdpic##1##2##3##4%
67      {width:\space##1,\space height:\space##2,\space depth:\space##3,\space italic:\space##4\par}
68
69    \def\showmathcharactersentryresource##1%
70      {virtual:\space##1\par}
71
72    \def\showmathcharactersstartnext
73      {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth\relax
74       next:\space}
75
76    \def\showmathcharactersnextentry##1##2##3%
77      {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}}
78
79    \def\showmathcharactersnextcycle##1%
80      {\ifnum##1>\plusone \space=>\space\fi cycle}
81
82    \def\showmathcharactersstopnext
83      {\par\endgroup}
84
85    \def\showmathcharactersstartparts
86      {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth\relax
87       parts:\space}
88
89    \def\showmathcharacterspartsentry##1##2##3%
90      {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}}
91
92    \def\showmathcharactersstopparts
93      {\par\endgroup}
94
95    \let\showmathcharactersstartvparts\showmathcharactersstartparts
96    \let\showmathcharactersvpartsentry\showmathcharacterspartsentry
97    \let\showmathcharactersstopvparts \showmathcharactersstopparts
98
99    \let\showmathcharactersstarthparts\showmathcharactersstartparts
100    \let\showmathcharactershpartsentry\showmathcharacterspartsentry
101    \let\showmathcharactersstophparts \showmathcharactersstopparts
102
103    \def\showmathcharactersbetweennextandparts
104      {}% \space=>\space}
105
106    \def\showmathcharactersentryclassname##1##2%
107      {mathclass:\space##1,\space mathname:\space##2\par}
108
109    \def\showmathcharactersentrysymbol##1##2%
110      {mathsymbol:\space##1~\ruledhbox{\char##2}\par}
111
112    \def\showmathcharactersstartlookupvariants
113      {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth\relax
114       lookupvariants:\space}
115
116    \def\showmathcharacterslookupvariant##1##2##3##4%
117      {\ifnum##1>\plusone,\space\fi##2:~{\char##3}\space(##4)}
118
119    \def\showmathcharactersstoplookupvariants
120      {\par\endgroup}
121
122\stopsetups
123
124\unprotect
125
126\unexpanded\def\enableshowmathfontvirtual
127  {\ctxlua{fonts.constructors.autocleanup=false}}
128
129\unexpanded\def\showmathfontcharacters
130  {\dosingleempty\module_math_characters_show}
131
132\def\module_math_characters_show[#1]%
133  {\begingroup
134   \getdummyparameters
135     [\c!bodyfont=,
136      \c!list=,
137      \c!check=,
138      \c!alternative=default,
139      \c!option=\v!all,
140      #1]%
141   \directsetup{s-math-characters:\dummyparameter\c!alternative}%
142   \doifelsenothing{\dummyparameter\c!bodyfont}
143     {\definedfont[MathRoman*math-text]}
144     {\definedfont[\dummyparameter\c!bodyfont]}%
145   \dontcomplain
146   \ctxlua{moduledata.math.characters.showlist {
147      number   = false,
148      check    = "\dummyparameter\c!check",
149      list     = "\dummyparameter\c!list",
150      option   = "\dummyparameter\c!option",
151   }}%
152   \endgroup}
153
154\protect
155
156\stopmodule
157
158\continueifinputfile{s-math-characters.mkiv}
159
160\setuplayout
161  [width=middle,
162   height=middle,
163   topspace=15mm,
164   backspace=15mm,
165   bottomspace=15mm,
166   header=1cm,
167   headerdistance=0.5cm,
168   footer=0pt]
169
170\starttext
171
172    \doifelse {\getdocumentargument{bodyfont}} {} {
173
174        \setupbodyfont[cambria,   12pt]
175      % \setupbodyfont[modern,    12pt]
176      % \setupbodyfont[lmvirtual, 12pt]
177      % \setupbodyfont[pxvirtual, 12pt]
178      % \setupbodyfont[txvirtual, 12pt]
179      % \setupbodyfont[palatino,  10pt]
180      % \setupbodyfont[mathtimes, 12pt]
181      % \setupbodyfont[stix,      12pt]
182      % \setupbodyfont[xits,      12pt]
183      % \setupbodyfont[lucida,    12pt]
184      % \setupbodyfont[lucidaot,  12pt]
185      % \setupbodyfont[pagella,   12pt]
186      % \setupbodyfont[bonum,     12pt]
187
188    } {
189
190        \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]}
191
192    }
193
194    \showmathfontcharacters
195
196\stoptext
197
198