font-mat.mkvi /size: 20 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=font-mat,
3
%D version=2011.01.13, % (copied fron font-ini)
4
%D title=\CONTEXT\ Font Macros,
5
%D subtitle=Math,
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
\writestatus
{
loading
}{
ConTeXt
Font
Macros
/
Math
}
15 16
\unprotect
17 18
%D Be nice:
19 20
\ifdefined
\??fontinstanceready
\else
\installcorenamespace
{
fontinstanceready
}
\fi
21
\ifdefined
\??fontinstancebasic
\else
\installcorenamespace
{
fontinstancebasic
}
\fi
22
\ifdefined
\??fontinstanceclass
\else
\installcorenamespace
{
fontinstanceclass
}
\fi
23 24
%D The order 3 2 1 of siuze matters: needed for math-fbk relative size storage!
25 26
%D \macros
27
%D {textonly}
28
%D
29
%D Traditionally math has a big impact on font definitions, mainly because we need
30
%D to define alphabet variants using families and fonts. This means that one can
31
%D easily get 10 fonts loaded per math size. In \MKIV\ we use a different approach:
32
%D one family which has either a virtual font made of traditional fonts, or an
33
%D \OPENTYPE\ font that has it all.
34
%D
35
%D We currently use only one math family but in the future we might consider using a
36
%D second one for bold math. For the moment we keep the \MKII\ method of using a
37
%D token register for definitions but we already dropped the text and symbols ones
38
%D since they now live in the same family.
39 40
\newtoks
\t_font_math_strategies
41
\newconditional
\c_font_synchronize_math_fonts
\settrue
\c_font_synchronize_math_fonts
42 43
\unexpanded
\def
\font_helpers_synchronize_math
% math stuff in mmode
44
{
\ifconditional
\c_font_synchronize_math_fonts
\the
\t_font_math_strategies
\fi
}
45 46
\unexpanded
\def
\textonly
{
\setfalse
\c_font_synchronize_math_fonts
}
% document this
47 48
%D The main math font definer. We have removed some optimized code simply because we
49
%D now always have a fontclass. We could check for fontclass being default or empty
50
%D and save a few tests but it does not help us when no math is defined.
51
%D
52
%D Because we want to keep mr=.. and mb=... settings (read: not break downward
53
%D compatibility by enforcing mrlr etc) we need a bit more code that optimal.
54 55
% todo: \c_font_fam_mr
56 57
\let
\c_font_fam_mr
\zerocount
% math regular
58
\let
\c_font_fam_mr_lr
\plusone
% math regular l2r
59
\let
\c_font_fam_mr_rl
\plustwo
% math regular r2l
60 61
\let
\c_font_fam_mb
\plusthree
% math bold
62
\let
\c_font_fam_mb_lr
\plusfour
% math bold l2r
63
\let
\c_font_fam_mb_rl
\plusfive
% math bold r2l
64 65
\definesystemattribute
[
mathfamily
][
public
]
66 67
\newconditional
\c_font_bidirectional_mathstrategy
% can be default, not that much overhead: \settrue\c_font_bidirectional_mathstrategy
68
\newconditional
\c_font_complete_bold_mathstrategy
\settrue
\c_font_complete_bold_mathstrategy
69 70
\def
\mathtextsuffix
{
-
text
}
71
\def
\mathscriptsuffix
{
-
script
}
72
\def
\mathscriptscriptsuffix
{
-
scriptscript
}
73 74
\def
\mathsizesuffix
{
\ifcase
\fontface
\or
\mathtextsuffix
\or
\mathscriptsuffix
\or
\mathscriptscriptsuffix
\fi
}
75 76
%D Beware: truefontname also does a fallback on defaultfontclass so there
77
%D can be some interference here, which is why we use a different method
78
%D for bold.
79 80
\def
\font_helpers_set_math_family_a
81
{
\ifcsname
\??fontinstanceready
\fontclass
-
\fontbody
-
\s!mm
-
\fontfamily
-
\fontsize
\endcsname
\setfalse
\c_font_auto_size
82
\lastnamedcs
\else
83
\ifcsname
\??fontinstanceready
\fontclass
-
\fontbody
-
\s!mm
-
\fontfamily
\endcsname
\settrue
\c_font_auto_size
84
\lastnamedcs
\else
85
\font_helpers_set_math_family_b
86
\fi\fi
}
87 88
\def
\font_helpers_set_math_family_b
89
{
\ifcsname
\??fontinstanceready
\defaultfontclass
-
\fontbody
-
\s!mm
-
\fontfamily
-
\fontsize
\endcsname
\setfalse
\c_font_auto_size
90
\lastnamedcs
\else
91
\ifcsname
\??fontinstanceready
\defaultfontclass
-
\fontbody
-
\s!mm
-
\fontfamily
\endcsname
\settrue
\c_font_auto_size
92
\lastnamedcs
\else
93
\font_helpers_set_math_family_c
94
\fi\fi
}
95 96
\def
\font_helpers_set_math_family_c
97
{
\ifcsname
\??fontinstanceready
\fontbody
-
\s!mm
-
\fontfamily
-
\fontsize
\endcsname
\setfalse
\c_font_auto_size
98
\lastnamedcs
\else
99
\ifcsname
\??fontinstanceready
\fontbody
-
\s!mm
-
\fontfamily
\endcsname
\settrue
\c_font_auto_size
100
\lastnamedcs
\else
101
\settrue
\c_font_auto_size
102
\fi\fi
}
103 104
\let
\mathsizesuffix\empty
105 106
\def
\font_helpers_set_math_family_indeed
#
mrtag
#
family
% \fontface etc are also used later on
107
{
\let
\savedfontbody
\fontbody
108
\let
\fontfamily
#
family
%
109
% the order is important as we depend on known id's when completing fonts
110
% enabling is needed when we have fallbacks which spoils the families
111
\let
\mathsizesuffix
\mathscriptscriptsuffix
\let
\fontface
\!!plusthree
112
\font_helpers_set_math_family_a
\scriptscriptfont
#
mrtag
\font
% defines
113
\font_helpers_set_math_family_a
\scriptscriptfont
#
mrtag
\font
% enables
114
\let
\mathsizesuffix
\mathscriptsuffix
\let
\fontface
\!!plustwo
115
\font_helpers_set_math_family_a
\scriptfont
#
mrtag
\font
% defines
116
\font_helpers_set_math_family_a
\scriptfont
#
mrtag
\font
% enables
117
\let
\mathsizesuffix
\mathtextsuffix
\let
\fontface
\!!plusone
118
\font_helpers_set_math_family_a
\textfont
#
mrtag
\font
% defines
119
\font_helpers_set_math_family_a
\textfont
#
mrtag
\font
% enables
120
\let
\mathsizesuffix\empty
\let
\fontface
\!!zerocount
121
\let
\fontbody
\savedfontbody
122
\setfalse
\c_font_auto_size
}
123 124
\def
\font_helpers_set_math_family_bold_a
#
font
#
mbfam
#
mrfam
%
125
{
\ifcsname
\??fontinstanceready
\fontclass
-
\fontbody
-
\s!mm
-
\fontfamily
-
\fontsize
\endcsname
\setfalse
\c_font_auto_size
126
\lastnamedcs
#
font
#
mbfam
\font
\else
127
\ifcsname
\??fontinstanceready
\fontclass
-
\fontbody
-
\s!mm
-
\fontfamily
\endcsname
\settrue
\c_font_auto_size
128
\lastnamedcs
#
font
#
mbfam
\font
\else
129
#
font
#
mbfam
#
font
#
mrfam
%
130
\fi\fi
}
131 132
\def
\font_helpers_set_math_family_bold_indeed
#
mbfam
#
familytag
#
mrfam
% \c_font_fam_mb \s!mb \c_font_fam_mr
133
{
\let
\savedfontclass
\defaultfontclass
134
\let
\defaultfontclass
\fontclass
% else truefontname falls back on the wrong one
135
\let
\savedfontbody
\fontbody
136
\let
\fontfamily
#
familytag
%
137
\let
\mathsizesuffix
\mathscriptscriptsuffix
\let
\fontface
\!!plusthree
138
\font_helpers_set_math_family_bold_a
\scriptscriptfont
#
mbfam
#
mrfam
% defines
139
\font_helpers_set_math_family_bold_a
\scriptscriptfont
#
mbfam
#
mrfam
% enables
140
\let
\mathsizesuffix
\mathscriptsuffix
\let
\fontface
\!!plustwo
141
\font_helpers_set_math_family_bold_a
\scriptfont
#
mbfam
#
mrfam
% defines
142
\font_helpers_set_math_family_bold_a
\scriptfont
#
mbfam
#
mrfam
% enables
143
\let
\mathsizesuffix
\mathtextsuffix
\let
\fontface
\!!plusone
144
\font_helpers_set_math_family_bold_a
\textfont
#
mbfam
#
mrfam
% defines
145
\font_helpers_set_math_family_bold_a
\textfont
#
mbfam
#
mrfam
% enables
146
\let
\mathsizesuffix\empty
\let
\fontface
\!!zerocount
147
\let
\fontbody
\savedfontbody
148
\let
\defaultfontclass
\savedfontclass
149
\setfalse
\c_font_auto_size
}
150 151
% optimized: math fonts are never changed (10K \bfa $x$: 3.2 => 2.5 (baseline 1.0))
152
%
153
% sort of tricky: we cannot reset in \everybeforedefinetypeface as we don't know
154
% all sizes so we postpone the optimization to the first starttext
155
%
156
% pitfall: we should reset 'm when a fontclass name is reused
157 158
\newconditional
\optimizemathfontdefinitions
\settrue
\optimizemathfontdefinitions
159 160
\def
\font_helpers_set_math_family
#
mrfam
#
familytag
%
161
{
\ifconditional
\optimizemathfontdefinitions
162
\ifcsname
\??fontinstanceclass
\fontclass
-
\fontbody
-
\s!mm
-
#
familytag
-
\fontsize
-
1
\endcsname
163
% \writestatus{fonts}{math: reusing \fontclass\fontbody\s!mm#familytag\fontsize1}%
164
\font_helpers_preset_math_family_indeed
#
mrfam
#
familytag
%
165
\else
166
% \writestatus{fonts}{math: defining \fontclass\fontbody\s!mm#familytag\fontsize1}%
167
\font_helpers_set_math_family_indeed
#
mrfam
#
familytag
%
168
\fi
169
\else
170
\font_helpers_set_math_family_indeed
#
mrfam
#
familytag
%
171
\fi
}
172 173
\def
\font_helpers_set_math_family_bold
#
mbfam
#
familytag
#
mrfam
%
174
{
\ifconditional
\optimizemathfontdefinitions
175
%\ifcsname\??fontinstanceclass\fontclass-\textface-\s!mm-#familytag-\fontsize-1\endcsname
176
\ifcsname
\??fontinstanceclass
\fontclass
-
\fontbody
-
\s!mm
-
#
familytag
-
\fontsize
-
1
\endcsname
177
\font_helpers_preset_math_family_indeed
#
mbfam
#
familytag
%
178
\else
179
\font_helpers_set_math_family_bold_indeed
#
mbfam
#
familytag
#
mrfam
%
180
\fi
181
\else
182
\font_helpers_set_math_family_bold_indeed
#
mbfam
#
familytag
#
mrfam
%
183
\fi
}
184 185
%D It can happen that we use a bodyfont with no math in which case we have a problem
186
%D with setting the global bodyfont size in the page builder. For instance in:
187
%D
188
%D \starttext
189
%D \definetypeface[test][rm][serif][pagella][default]
190
%D \setupbodyfont[test]
191
%D test
192
%D \stoptext
193
%D
194
%D This is why we need the check. At the cost of some extra checking we gain a
195
%D little in restoring global states and, what's more important, we get rid of large
196
%D math parameter push/pop in tracingall when not needed.
197 198
\def
\font_helpers_preset_math_family_indeed
#
fam
#
familytag
%
199
{
\expandafter\let\expandafter
\v_font_math_one
\csname
\??fontinstanceclass
\fontclass
-
\fontbody
-
\s!mm
-
#
familytag
-
\fontsize
-
1
\endcsname
200
\ifx
\v_font_math_one
\relax
201
\font_helpers_preset_math_family_warning
202
\else\ifnum\fontid\textfont
#
fam
=
\fontid
\v_font_math_one
\else
203
\font_helpers_preset_math_family_indeed_changed
#
fam
#
familytag
%
204
\fi\fi
}
205 206
\def
\font_helpers_preset_math_family_warning
207
{
\writestatus
{
fonts
}{
math
:
unset
for
global
bodyfont
\fontclass\space
at
\fontbody
}}
208 209
\def
\font_helpers_preset_math_family_indeed_changed
#
fam
#
familytag
%
210
{
\scriptscriptfont
#
fam
\csname
\??fontinstanceclass
\fontclass
-
\fontbody
-
\s!mm
-
#
familytag
-
\fontsize
-
3
\endcsname
211
\scriptfont
#
fam
\csname
\??fontinstanceclass
\fontclass
-
\fontbody
-
\s!mm
-
#
familytag
-
\fontsize
-
2
\endcsname
212
\textfont
#
fam
\v_font_math_one
}
213 214
\let
\font_helpers_reset_fontclass_math_families
\gobbleoneargument
215 216
%D It would be nice if characters could be defined in a neutral way (say fam 255)
217
%D and be mapped to a real family during noad list construction. However, this
218
%D changes tex in critical places so for the moment we simulate this using
219
%D manipulation.
220
%D
221
%D For tracing purposes we use three families but in l2r mode 1 and 2 are copies of
222
%D 0 while in rl mode 0 is a copy of 1. There is no real overhead involved in this.
223
%D This also permits different font definitions for normal and mixed.
224 225
\let
\m_font_class_direction
\empty
226
\let
\m_font_class_features
\empty
227
\let
\m_font_class_fallbacks
\empty
228
\let
\m_font_class_goodies
\empty
229 230
\let
\m_font_direction
\empty
231
\let
\m_font_features
\empty
232
\let
\m_font_fallbacks
\empty
233
\let
\m_font_goodies
\empty
234 235
\appendtoks
% can be analyzed once
236
% why here ..
237
%\edef\m_font_class_direction{\ifcsname\??fontclass\fontclass\s!mm\s!direction\endcsname\csname\??fontclass\fontclass\s!mm\s!direction\endcsname\fi}%
238
\edef
\m_font_class_direction
{
\begincsname
\??fontclass
\fontclass
\s!mm\s!direction
\endcsname
}
%
239
% ...
240
\ifx
\m_font_class_direction
\v!both
241
\settrue
\c_font_bidirectional_mathstrategy
242
\else
243
\setfalse
\c_font_bidirectional_mathstrategy
244
\fi
245
\to
\t_font_math_strategies
246 247
\def
\font_helpers_bidirectional_mathstrategy_yes
248
{
\font_helpers_set_math_family
\c_font_fam_mr_lr
\s!mrlr
249
\font_helpers_set_math_family
\c_font_fam_mr_rl
\s!mrrl
250
\ifnum
\fontid\textfont
\c_font_fam_mr
=
\fontid\textfont
\c_font_fam_mr_lr
\else
251
\font_helpers_bidirectional_mathstrategy_yes_changed
252
\fi
}
253 254
\def
\font_helpers_bidirectional_mathstrategy_yes_changed
255
{
\textfont
\c_font_fam_mr
\textfont
\c_font_fam_mr_lr
256
\scriptfont
\c_font_fam_mr
\scriptfont
\c_font_fam_mr_lr
257
\scriptscriptfont
\c_font_fam_mr
\scriptscriptfont
\c_font_fam_mr_lr
}
258 259
\def
\font_helpers_bidirectional_mathstrategy_nop
260
{
\font_helpers_set_math_family
\c_font_fam_mr
\s!mr
261
\ifnum
\fontid\textfont
\c_font_fam_mr_rl
=
\fontid\textfont
\c_font_fam_mr
\else
262
\font_helpers_bidirectional_mathstrategy_nop_changed
263
\fi
}
264 265
\def
\font_helpers_bidirectional_mathstrategy_nop_changed
266
{
\textfont
\c_font_fam_mr_lr
\textfont
\c_font_fam_mr
267
\scriptfont
\c_font_fam_mr_lr
\scriptfont
\c_font_fam_mr
268
\scriptscriptfont
\c_font_fam_mr_lr
\scriptscriptfont
\c_font_fam_mr
269
\textfont
\c_font_fam_mr_rl
\textfont
\c_font_fam_mr
270
\scriptfont
\c_font_fam_mr_rl
\scriptfont
\c_font_fam_mr
271
\scriptscriptfont
\c_font_fam_mr_rl
\scriptscriptfont
\c_font_fam_mr
}
272 273
\appendtoks
274
\ifconditional
\c_font_bidirectional_mathstrategy
275
\font_helpers_bidirectional_mathstrategy_yes
276
\else
277
\font_helpers_bidirectional_mathstrategy_nop
278
\fi
279
\to
\t_font_math_strategies
280 281
\def
\font_helpers_complete_bold_mathstrategy_yes_bidi
282
{
\font_helpers_set_math_family_bold
\c_font_fam_mb_lr
\s!mblr
\c_font_fam_mr_lr
283
\font_helpers_set_math_family_bold
\c_font_fam_mb_rl
\s!mbrl
\c_font_fam_mr_rl
284
\ifnum
\fontid\textfont
\c_font_fam_mb
=
\fontid\textfont
\c_font_fam_mb_lr
\else
285
\font_helpers_complete_bold_mathstrategy_yes_bidi_changed
286
\fi
}
287 288
\def
\font_helpers_complete_bold_mathstrategy_yes_bidi_changed
289
{
\textfont
\c_font_fam_mb
\textfont
\c_font_fam_mb_lr
290
\scriptfont
\c_font_fam_mb
\scriptfont
\c_font_fam_mb_lr
291
\scriptscriptfont
\c_font_fam_mb
\scriptscriptfont
\c_font_fam_mb_lr
}
292 293
\def
\font_helpers_complete_bold_mathstrategy_yes
294
{
\font_helpers_set_math_family_bold
\c_font_fam_mb
\s!mb
\c_font_fam_mr
\relax
295
\ifnum
\fontid\textfont
\c_font_fam_mb_rl
=
\fontid\textfont
\c_font_fam_mb
\else
296
\font_helpers_complete_bold_mathstrategy_yes_changed
297
\fi
}
298 299
\def
\font_helpers_complete_bold_mathstrategy_yes_changed
300
{
\textfont
\c_font_fam_mb_rl
\textfont
\c_font_fam_mb
301
\scriptfont
\c_font_fam_mb_rl
\scriptfont
\c_font_fam_mb
302
\scriptscriptfont
\c_font_fam_mb_rl
\scriptscriptfont
\c_font_fam_mb
303
\textfont
\c_font_fam_mb_lr
\textfont
\c_font_fam_mb
304
\scriptfont
\c_font_fam_mb_lr
\scriptfont
\c_font_fam_mb
305
\scriptscriptfont
\c_font_fam_mb_lr
\scriptscriptfont
\c_font_fam_mb
}
306 307
\def
\font_helpers_complete_bold_mathstrategy_nop
308
{
\ifnum
\fontid\textfont
\c_font_fam_mb
=
\fontid\textfont
\c_font_fam_mr
\else
309
\font_helpers_complete_bold_mathstrategy_nop_changed
310
\fi
}
311 312
\def
\font_helpers_complete_bold_mathstrategy_nop_changed
313
{
\textfont
\c_font_fam_mb
\textfont
\c_font_fam_mr
314
\scriptfont
\c_font_fam_mb
\scriptfont
\c_font_fam_mr
315
\scriptscriptfont
\c_font_fam_mb
\scriptscriptfont
\c_font_fam_mr
316
\textfont
\c_font_fam_mb_lr
\textfont
\c_font_fam_mr_lr
317
\scriptfont
\c_font_fam_mb_lr
\scriptfont
\c_font_fam_mr_lr
318
\scriptscriptfont
\c_font_fam_mb_lr
\scriptscriptfont
\c_font_fam_mr_lr
319
\textfont
\c_font_fam_mb_rl
\textfont
\c_font_fam_mr_rl
320
\scriptfont
\c_font_fam_mb_rl
\scriptfont
\c_font_fam_mr_rl
321
\scriptscriptfont
\c_font_fam_mb_rl
\scriptscriptfont
\c_font_fam_mr_rl
}
322 323
\def
\font_helpers_apply_complete_bold_mathstrategy
324
{
\ifconditional
\c_font_complete_bold_mathstrategy
325
\ifconditional
\c_font_bidirectional_mathstrategy
326
\font_helpers_complete_bold_mathstrategy_yes_bidi
327
\else
328
\font_helpers_complete_bold_mathstrategy_yes
329
\fi
330
\else
331
\font_helpers_complete_bold_mathstrategy_nop
332
\fi
}
333 334
\appendtoks
335
\font_helpers_apply_complete_bold_mathstrategy
336
\to
\t_font_math_strategies
337 338
\ifdefined
\defaultmathfamily
\else
339
\setnewconstant
\defaultmathfamily
\zerocount
340
\fi
341 342
\appendtoks
343
\fam
\defaultmathfamily
% all characters and symbols are in this family
344
\to
\everymathematics
345 346
\unexpanded
\def
\font_helpers_synchronize_math_family_mr
347
{
\c_attr_mathfamily
\ifconditional
\c_font_bidirectional_mathstrategy
348
\ifconditional
\c_math_right_to_left
349
\plustwo
350
\else
351
\plusone
352
\fi
353
\else
354
\zerocount
355
\fi
}
356 357
\unexpanded
\def
\font_helpers_synchronize_math_family_mb
358
{
\c_attr_mathfamily
\ifconditional
\c_font_bidirectional_mathstrategy
359
\ifconditional
\c_math_right_to_left
360
\ifconditional
\c_font_pseudo_bold_math_state
\pluseight
\else
\plusfive
\fi
361
\else
362
\ifconditional
\c_font_pseudo_bold_math_state
\plusseven
\else
\plusfour
\fi
363
\fi
364
\else
365
\ifconditional
\c_font_pseudo_bold_math_state
\plussix
\else
\plusthree
\fi
366
\fi
}
367 368
\installcorenamespace
{
fontmathsynchronizer
}
369
\installcorenamespace
{
fontmathstoredstrategy
}
370 371
\letvalue
{
\??fontmathsynchronizer\s!tf
}
\font_helpers_synchronize_math_family_mr
372
\letvalue
{
\??fontmathsynchronizer\s!sl
}
\font_helpers_synchronize_math_family_mr
373
\letvalue
{
\??fontmathsynchronizer\s!it
}
\font_helpers_synchronize_math_family_mr
374
\letvalue
{
\??fontmathsynchronizer\s!bf
}
\font_helpers_synchronize_math_family_mb
375
\letvalue
{
\??fontmathsynchronizer\s!bs
}
\font_helpers_synchronize_math_family_mb
376
\letvalue
{
\??fontmathsynchronizer\s!bi
}
\font_helpers_synchronize_math_family_mb
377
\letvalue
{
\??fontmathsynchronizer
\empty
}
\font_helpers_synchronize_math_family_mr
378 379
% \def\font_helpers_synchronize_math_family
380
% {\csname\??fontmathsynchronizer\ifcsname\??fontmathsynchronizer\fontalternative\endcsname\fontalternative\fi\endcsname}
381 382
\def
\font_helpers_synchronize_math_family
383
{
\ifcsname
\??fontmathsynchronizer
\fontalternative
\endcsname
384
\lastnamedcs
385
\else
386
\font_helpers_synchronize_math_family_mr
387
\fi
}
388 389
\ifdefined
\fontid
% we need to keep this test for a while
390
\appendtoks
391
\ifnum
\fontid\textfont
\zerocount
=
\fontid\textfont
\plusthree
392
\letvalue
{
\??fontmathstoredstrategy
\fontclass
}
\font_helpers_set_math_partial_bold_strategy
393
\else
394
\letvalue
{
\??fontmathstoredstrategy
\fontclass
}
\font_helpers_set_math_full_bold_strategy
395
\fi
396
\to
\t_font_math_strategies
397
\else
398
\appendtoks
399
\edef
\currentmathfontmr
{
\fontname\textfont
\zerocount
}
%
400
\edef
\currentmathfontmb
{
\fontname\textfont
\plusthree
}
%
401
\ifx
\currentmathfontmr
\currentmathfontmb
402
\letvalue
{
\??fontmathstoredstrategy
\fontclass
}
\font_helpers_set_math_partial_bold_strategy
403
\else
404
\letvalue
{
\??fontmathstoredstrategy
\fontclass
}
\font_helpers_set_math_full_bold_strategy
405
\fi
406
\to
\t_font_math_strategies
407
\fi
408 409
%def\font_helpers_synchronize_math_bold_strategy{\csname\??fontmathstoredstrategy\fontclass\endcsname}
410
\def
\font_helpers_synchronize_math_bold_strategy
{
\begincsname
\??fontmathstoredstrategy
\fontclass
\endcsname
}
411 412
\newconditional
\c_font_pseudo_bold_math_state
413 414
\def
\font_helpers_set_math_partial_bold_strategy
{
\settrue
\c_font_pseudo_bold_math_state
}
415
\def
\font_helpers_set_math_full_bold_strategy
{
\setfalse
\c_font_pseudo_bold_math_state
}
416 417
\appendtoks
418
\font_helpers_synchronize_math_bold_strategy
419
\to
\everymathematics
420 421
%D Bold is somewhat special as we might want both full-bold-math mixed regular-math,
422
%D as well as automatic adaption to outer bold (in titles and inline text bold) so
423
%D we will need explicit switches as well as an automatic one. (We will use lucida
424
%D as an example.)
425 426
\ifdefined
\mathdefault
\else
\let
\mathdefault
\relax
\fi
427 428
\newconditional
\c_math_bold
429 430
\unexpanded
\def
\mr
% math regular
431
{
\ifmmode
432
\font_helpers_synchronize_math_family_mr
433
\else
434
\font_helpers_set_current_font_alternative
\s!mr
435
\fi
436
\mathdefault
437
\setfalse
\c_math_bold
}
438 439
\unexpanded
\def
\mb
% math bold
440
{
\ifmmode
441
\font_helpers_synchronize_math_family_mb
442
\else
443
\font_helpers_set_current_font_alternative
\s!mb
444
\fi
445
\mathdefault
446
\settrue
\c_math_bold
}
447 448
\appendtoks
449
\font_helpers_synchronize_math_family
% auto bold
450
\to
\everymathematics
451 452
\appendtoks
453
\ifconditional
\c_math_bold
\mb
\fi
454
\to
\everymathematics
455 456
%D \macros
457
%D {bigmath,nobigmath}
458
%D
459
%D We can inhibit this slow||downer with:
460 461
% these can best be combined
462 463
% 0=never 1=everymath 2=always
464 465
\setnewconstant
\synchronizebigmathflag
\plusone
466 467
\appendtoks
468
\ifcase
\synchronizebigmathflag
469
% never
470
\or
471
\synchronizebigmath
472
\or
473
% always
474
\fi
475
\to
\everymathematics
476 477
\unexpanded
\def
\nobigmath
{
\synchronizebigmathflag
\zerocount
}
478
\unexpanded
\def
\autobigmath
{
\synchronizebigmathflag
\plusone
\synchronizebigmath
}
479
\unexpanded
\def
\bigmath
{
\synchronizebigmathflag
\plustwo
\synchronizebigmath
}
480 481
\let
\bigmathfontsize
\empty
482 483
\unexpanded
\def
\synchronizebigmath
484
{
\ifx
\bigmathfontsize
\fontsize
485
% already in sync
486
\else
487
\let
\bigmathfontsize
\fontsize
488
\font_helpers_synchronize_math
489
\fi
}
490 491
\unexpanded
\def
\font_helpers_check_big_math_synchronization
492
{
\ifcase
\synchronizebigmathflag
493
% never
494
\or
495
\ifmmode
\synchronizebigmath
\fi
496
\or
497
\synchronizebigmath
498
\fi
}
499 500
\protect
\endinput
501