1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17\writestatus{loading}{ConTeXt Symbol Libraries Initialization}
18
19\registerctxluafile{symbini}{}
20
21\unprotect
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43\installcorenamespace{symbol}
44\installcorenamespace{symbols}
45\installcorenamespace{symbolset}
46\installcorenamespace{symboldefault}
47
48
49
50\installparameterhandler\??symbols {symbols}
51\installsetuphandler \??symbols {symbols}
52
53\appendtoks
54 \doifelse{\symbolsparameter\c!stylealternative}\v!math
55 \settrue\setfalse\prefermathovertextchar
56\to \everysetupsymbols
57
58\setupsymbols
59 [\c!stylealternative=\v!text]
60
61\let\currentsymbol \empty
62\let\currentsymbolset\empty
63
64\newtoks\t_symb_setups
65
66\let\m_symb_current_set\empty
67
68\newconditional\c_symb_found
69
70\newtoks\everysymbol
71
72
73
74
75\unexpanded\def\definesymbol
76 {\dotripleempty\symb_define}
77
78\def\symb_define[#1][#2][#3]
79 {\ifthirdargument
80 \setvalue{\??symbol#1:#2}{#3}
81 \doifsomething{#1}{\addvalue{\??symbolset#1}{#2}}
82 \else
83 \setvalue{\??symbol\m_symb_current_set:#1}{#2}
84 \addvalue{\??symbolset\m_symb_current_set}{#1}
85 \fi}
86
87\unexpanded\def\doifelseinsymbolset#1#2{\ifcsname\??symbol#1:#2\endcsname\expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi}
88\unexpanded\def\doifinsymbolset #1#2{\ifcsname\??symbol#1:#2\endcsname\expandafter\firstofoneargument \else\expandafter\gobbleoneargument \fi}
89\unexpanded\def\doifelsesymbolset #1{\ifcsname\??symbolset#1\endcsname\expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi}
90
91\let\doifinsymbolsetelse\doifelseinsymbolset
92\let\doifsymbolsetelse \doifelsesymbolset
93
94\letvalue{\??symbolset}\empty
95
96
97
98\def\symbolset#1{\begincsname\??symbolset#1\endcsname}
99
100
101
102
103
104
105
106
107
108
109\unexpanded\def\symbol
110 {\dontleavehmode
111 \dodoubleempty\symb_place}
112
113\def\symb_place
114 {\iffirstargument
115 \expandafter\symb_place_normal
116 \else
117 \expandafter\symb_place_special
118 \fi}
119
120\def\symb_place_normal
121 {\ifsecondargument
122 \expandafter\symb_place_normal_a
123 \else
124 \expandafter\symb_place_normal_b
125 \fi}
126
127
128
129
130
131
132
133
134
135\def\symb_place_normal_a[#1][#2]
136 {\edef\currentsymbol{#2}
137 \ifcsname\??symbol#1:#2\endcsname
138 \symb_place_indeed{#1:#2}
139 \else\ifcsname\??symboldefault#1\endcsname
140 \symb_place_named{#1}
141 \else
142 \symb_place_normal_c
143 \fi\fi}
144
145\def\symb_place_normal_b[#1][#2]
146 {\edef\currentsymbol{#1}
147 \ifcsname\??symbol\currentsymbolset:#1\endcsname
148 \symb_place_indeed{\currentsymbolset:#1}
149 \else
150 \symb_place_normal_c
151 \fi}
152
153\def\symb_place_normal_c
154 {\setfalse\c_symb_found
155 \the\t_symb_setups
156 \ifconditional\c_symb_found \else
157 \symb_place_retry\currentsymbol
158 \fi}
159
160\def\symb_place_special[#1][#2]#3
161 {\firstargumenttrue
162 \secondargumentfalse
163 \symb_place_normal[#3][]}
164
165\def\symb_place_indeed#1
166 {\settrue\c_symb_found
167 \begingroup
168 \the\everysymbol
169 \csname\??symbol#1\endcsname\relax
170 \endgroup}
171
172\letvalue{\??symbol}\firstofoneargument
173
174\def\directsymbol#1#2
175
176 {\begincsname\??symbol#1:#2\endcsname}
177
178\unexpanded\def\symb_fetch
179 {\ifconditional\c_symb_found
180 \expandafter\gobbleoneargument
181 \else
182 \expandafter\symb_fetch_indeed
183 \fi}
184
185
186
187
188
189
190\def\symb_fetch_indeed#1
191 {\ifcsname\??symbol#1:\currentsymbol\endcsname
192 \symb_place_indeed{#1:\currentsymbol}
193 \else\ifcsname\??symboldefault#1\endcsname
194 \symb_place_named{#1}
195 \fi\fi}
196
197\def\symb_place_named#1
198 {\begingroup
199 \setbox\scratchbox\hbox\bgroup
200 \the\everysymbol
201 \getglyphstyled
202 {\csname\??symboldefault#1\endcsname}
203 {\tochar{n:\currentsymbol}}
204 \relax
205 \egroup
206 \ifdim\wd\scratchbox>\zeropoint
207 \unhbox\scratchbox
208 \endgroup
209 \setxvalue{\??symbol#1:\currentsymbol}
210 {\symb_place_named_indeed{#1}{\currentsymbol}}
211 \settrue\c_symb_found
212 \else
213 \endgroup
214 \fi}
215
216\unexpanded\def\symb_place_named_indeed#1#2
217 {\settrue\c_symb_found
218 \begingroup
219 \the\everysymbol
220 \getglyphstyled
221 {\csname\??symboldefault#1\endcsname}
222 {\tochar{n:#2}}
223 \relax
224 \endgroup}
225
226\def\symb_place_retry#1
227 {\ifcsname\??symbol:#1\endcsname
228 \symb_place_indeed{:#1}
229 \else
230 #1
231 \fi}
232
233
234
235
236
237
238
239
240
241
242
243\def\defaultsymbolfactor{10}
244\def\defaultsymbolheight{1.25ex}
245
246\unexpanded\def\figuresymbol
247 {\dodoubleempty\symb_figure}
248
249\ifdefined\externalfigure \else \def\externalfigure[#1][#2]{#1} \fi
250\ifdefined\resetexternalfigures \else \let\resetexternalfigures\relax \fi
251
252\def\symb_figure[#1][
253 {\externalfigure[#1][\c!reset=\v!yes,\c!symbol=\v!yes,\c!height=\defaultsymbolheight,}
254
255\appendtoks \resetexternalfigures \to \everysymbol
256
257\unexpanded\def\definefiguresymbol
258 {\dotripleempty\symb_figure_define}
259
260\def\symb_figure_define[#1][#2][#3]
261 {\ifsecondargument
262 \definesymbol[#1][{\symb_figure[#2][#3]}]
263 \fi}
264
265
266
267
268
269
270\def\symb_fetch_first
271 {\ifconditional\c_symb_found
272 \expandafter\gobbleoneargument
273 \else
274 \expandafter\symb_fetch_first_indeed
275 \fi}
276
277\def\symb_fetch_first_indeed#1
278 {\doifinsymbolset{#1}\currentsymbol{\settrue\c_symb_found}}
279
280\def\symb_fetch_second#1
281 {\doifinsymbolset\empty\currentsymbol{\settrue\c_symb_found}}
282
283\unexpanded\def\doifelsesymboldefined#1
284 {\begingroup
285 \edef\currentsymbol{#1}
286 \let\symb_fetch\symb_fetch_first
287 \setfalse\c_symb_found
288 \the\t_symb_setups
289 \ifconditional\c_symb_found
290 \endgroup\expandafter\firstoftwoarguments
291 \else
292 \symb_fetch_second\currentsymbol
293 \ifconditional\c_symb_found
294 \endgroup\doubleexpandafter\firstoftwoarguments
295 \else
296 \endgroup\doubleexpandafter\secondoftwoarguments
297 \fi
298 \fi}
299
300\let\doifsymboldefinedelse\doifelsesymboldefined
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332\installcorenamespace{symbolsets}
333
334
335
336
337
338
339
340\unexpanded\def\startsymbolset
341 {\dodoubleargument\symb_start_set}
342
343\def\symb_start_set[#1][#2]
344 {\pushmacro\m_symb_current_set
345 \def\m_symb_current_set{#1}
346 \ifsecondargument
347 \getdummyparameters[\s!font=,#2]
348 \edef\p_font{\dummyparameter\s!font}
349 \ifx\p_font\empty\else
350 \letvalue{\??symboldefault#1}\p_font
351 \fi
352 \fi}
353
354\unexpanded\def\stopsymbolset
355 {\popmacro\m_symb_current_set}
356
357\unexpanded\def\setupsymbolset[#1]
358 {\edef\currentsymbolset{#1}
359 \ifcsname\??symbolsets\currentsymbolset\endcsname \else
360 \symb_setup_symbol_set
361 \fi}
362
363\def\symb_setup_symbol_set
364 {\normalexpanded{\t_symb_setups{\symb_fetch{\currentsymbolset}\the\t_symb_setups}}
365 \letvalue{\??symbolsets\currentsymbolset}\empty}
366
367\unexpanded\def\resetsymbolset
368 {\t_symb_setups\emptytoks}
369
370\unexpanded\def\forcesymbolset[#1]
371 {\t_symb_setups{\symb_fetch{#1}}}
372
373
374
375
376
377
378\fetchruntimecommand \showsymbolset \f!symb_run
379
380
381
382
383
384
385\unexpanded\def\usesymbols[#1]{\clf_usesymbols{#1}}
386
387
388
389
390
391\protect \endinput
392 |