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