summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/s-math-characters.mkiv
blob: 3b273cb6c217d2ae5fed2821240022a45bf68695 (plain)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
%D \module
%D   [      file=s-math-characters.mkiv, % was: s-fnt-25 and later s-mat-10
%D        version=2009.01.25,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Math Glyph Checking,
%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.

\startmodule[math-characters]

\registerctxluafile{s-math-characters}{}

% context --jit --global --bodyfont=cambria --result=math-characters-cambria s-math-characters.mkiv
% context --jit --global --bodyfont=modern  --result=math-characters-modern  s-math-characters.mkiv

\startsetups s-math-characters:reset

    \let\showmathcharactersstart                 \relax
    \let\showmathcharactersstop                  \relax
    \let\showmathcharactersreference             \gobbleoneargument
    \let\showmathcharactersstartentry            \relax
    \let\showmathcharactersstopentry             \relax
    \let\showmathcharactersentryhexdectit        \gobblethreearguments
    \let\showmathcharactersentrywdhtdpic         \gobblefourarguments
    \let\showmathcharactersentryresource         \gobbleoneargument
    \let\showmathcharactersstartnext             \relax
    \let\showmathcharactersnextentry             \gobblethreearguments
    \let\showmathcharactersnextcycle             \gobbleonearguments
    \let\showmathcharactersstopnext              \relax
    \let\showmathcharactersstarthvariants        \relax
    \let\showmathcharactershvariantsentry        \gobblethreearguments
    \let\showmathcharactersstophvariants         \relax
    \let\showmathcharactersstartvvariants        \showmathcharactersstarthvariants
    \let\showmathcharactersvvariantsentry        \showmathcharactershvariantsentry
    \let\showmathcharactersstopvvariants         \showmathcharactersstophvariants
    \let\showmathcharactersbetweennextandvariants\relax
    \let\showmathcharactersstartentryclassspec   \relax
    \let\showmathcharactersstopentryclassspec    \relax
    \let\showmathcharactersentryclassname        \gobbletwoarguments
    \let\showmathcharactersentrysymbol           \gobbletwoarguments
    \let\showmathcharactersstartlookupvariants   \relax
    \let\showmathcharacterslookupvariant         \gobblefourarguments
    \let\showmathcharactersstoplookupvariants    \relax
    \let\showmathcharacterssetrange              \gobblethreearguments

\stopsetups

\directsetup{s-math-characters:reset}

\startsetups s-math-characters:default

    \directsetup{s-math-characters:reset}

    \unexpanded\def\showmathcharactersstartentry {\blank\begingroup\raggedright}
    \unexpanded\def\showmathcharactersstopentry  {\endgroup\blank}

    \def\showmathcharactersentryhexdectit##1##2##3%
      {##1:\space{\char##2}\space\ruledhbox{\char##2}\space##3\par
       \advance\leftskip\emwidth\relax}

    \def\showmathcharactersentrywdhtdpic##1##2##3##4%
      {width:\space##1,\space height:\space##2,\space depth:\space##3,\space italic:\space##4\par}

    \def\showmathcharactersentryresource##1%
      {virtual:\space##1\par}

    \def\showmathcharactersstartnext
      {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth
       next:\space}

    \def\showmathcharactersnextentry##1##2##3%
      {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}}

    \def\showmathcharactersnextcycle##1%
      {\ifnum##1>\plusone \space=>\space\fi cycle}

    \def\showmathcharactersstopnext
      {\par\endgroup}

    \def\showmathcharactersstarthvariants
      {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth
       variants:\space}

    \def\showmathcharactershvariantsentry##1##2##3%
      {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}}

    \def\showmathcharactersstophvariants
      {\par\endgroup}

    \let\showmathcharactersstartvvariants\showmathcharactersstarthvariants
    \let\showmathcharactersvvariantsentry\showmathcharactershvariantsentry
    \let\showmathcharactersstopvvariants \showmathcharactersstophvariants

    \def\showmathcharactersbetweennextandvariants
      {}% \space=>\space}

    \def\showmathcharactersentryclassname##1##2%
      {mathclass:\space##1,\space mathname:\space##2\par}

    \def\showmathcharactersentrysymbol##1##2%
      {mathsymbol:\space##1~\ruledhbox{\char##2}\par}

    \def\showmathcharactersstartlookupvariants
      {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth
       lookupvariants:\space}

    \def\showmathcharacterslookupvariant##1##2##3##4%
      {\ifnum##1>\plusone,\space\fi##2:~{\char##3}\space(##4)}

    \def\showmathcharactersstoplookupvariants
      {\par\endgroup}

\stopsetups

\unprotect

\unexpanded\def\enableshowmathfontvirtual
  {\ctxlua{fonts.constructors.autocleanup=false}}

\unexpanded\def\showmathfontcharacters
  {\dosingleempty\module_math_characters_show}

\def\module_math_characters_show[#1]%
  {\begingroup
   \getdummyparameters
     [\c!bodyfont=,
      \c!list=,
      \c!check=,
      \c!alternative=default,
      \c!option=\v!all,
      #1]%
   \directsetup{s-math-characters:\dummyparameter\c!alternative}%
   \doifelsenothing{\dummyparameter\c!bodyfont}
     {\definedfont[MathRoman*math-text]}
     {\definedfont[\dummyparameter\c!bodyfont]}%
   \dontcomplain
   \ctxlua{moduledata.math.characters.showlist {
      number   = false,
      check    = "\dummyparameter\c!check",
      list     = "\dummyparameter\c!list",
      option   = "\dummyparameter\c!option",
   }}%
   \endgroup}

\protect

\stopmodule

\continueifinputfile{s-math-characters.mkiv}

\setuplayout
  [width=middle,
   height=middle,
   topspace=15mm,
   backspace=15mm,
   bottomspace=15mm,
   header=1cm,
   headerdistance=0.5cm,
   footer=0pt]

\starttext

    \doifelse {\getdocumentargument{bodyfont}} {} {

        \setupbodyfont[cambria,   12pt]
      % \setupbodyfont[modern,    12pt]
      % \setupbodyfont[lmvirtual, 12pt]
      % \setupbodyfont[pxvirtual, 12pt]
      % \setupbodyfont[txvirtual, 12pt]
      % \setupbodyfont[palatino,  10pt]
      % \setupbodyfont[mathtimes, 12pt]
      % \setupbodyfont[stix,      12pt]
      % \setupbodyfont[xits,      12pt]
      % \setupbodyfont[lucida,    12pt]
      % \setupbodyfont[lucidanova,12pt]
      % \setupbodyfont[pagella,   12pt]
      % \setupbodyfont[bonum,     12pt]

    } {

        \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]}

    }

    \showmathfontcharacters

\stoptext