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\writestatus{loading}{ConTeXt Font Macros Initialization}
61
62
63
64
65\unprotect
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318\fontslantperpoint \nullfont 0\scaledpoint
319\fontinterwordspace \nullfont 256377\scaledpoint
320\fontinterwordstretch\nullfont 128188\scaledpoint
321\fontinterwordshrink \nullfont 85459\scaledpoint
322\fontexheight \nullfont 338952\scaledpoint
323\fontemwidth \nullfont 786432\scaledpoint
324\fontextraspace \nullfont 85459\scaledpoint
325
326\appendtoks
327 \fontslantperpoint \nullfont 0\scaledpoint
328 \fontinterwordspace \nullfont 256377\scaledpoint
329 \fontinterwordstretch\nullfont 128188\scaledpoint
330 \fontinterwordshrink \nullfont 85459\scaledpoint
331 \fontexheight \nullfont 338952\scaledpoint
332 \fontemwidth \nullfont 786432\scaledpoint
333 \fontextraspace \nullfont 85459\scaledpoint
334\to \everyjob
335
336
337
338\newtoks\t_font_tracers_definitions
339
340\permanent\protected\def\tracefontdefinitions
341 {\expand\t_font_tracers_definitions}
342
343
344
345\permanent\protected\def\setfontparameters
346 {\c_font_synchronize\conditionalfalse
347 \expand\everybodyfont
348 \c_font_synchronize\conditionaltrue}
349
350\mutable\lettonothing\savedfont
351
352\installmacrostack\savedfont
353
354
355
356
357
358
359
360\permanent\protected\def\savefont
361 {\edef\savedfont{\the\font}
362 \push_macro_savedfont}
363
364\permanent\protected\def\restorefont
365 {\pop_macro_savedfont
366 \savedfont}
367
368\aliased\let\popcurrentfont\relax
369
370\permanent\protected\def\pushcurrentfont
371 {\enforced\permanent\protected\edef\popcurrentfont
372 {\def\noexpand\fontbody {\fontbody}
373 \def\noexpand\fontstyle {\fontstyle}
374 \def\noexpand\fontalternative{\fontalternative}
375 \def\noexpand\fontsize {\fontsize}
376 \font_helpers_check_big_math_synchronization
377 \font_helpers_synchronize_font}}
378
379
380
381\mutable\let\thedefinedfont\relax
382
383\permanent\tolerant\protected\def\definedfont[#specification]
384 {\ifarguments
385 \c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly
386 \or
387 \c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly
388 \font_basics_define_font_without_parameters{thedefinedfont}{#specification}
389 \fi
390 \thedefinedfont
391 \expand\everydefinedfont}
392
393
394
395\permanent\protected\def\startfont{\begingroup\definedfont}
396\permanent\protected\def\stopfont {\endgroup}
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435\ifdefined\globalbodyfontsize \else \newdimension\globalbodyfontsize \fi \globalbodyfontsize=12pt
436\ifdefined\localbodyfontsize \else \newdimension\localbodyfontsize \fi \localbodyfontsize =\globalbodyfontsize
437\ifdefined\bodyfontsize \else \newdimension\bodyfontsize \fi \bodyfontsize =\globalbodyfontsize
438
439\permanent\protected\def\widthofzero{\scaledfontcharwd\font\zeroasciicode}
440
441
442
443
444
445\pushoverloadmode
446 \newuserunit\globalbodyfontsize fs
447 \newuserunit\widthofzero ch
448 \newuserunit\ascender fa
449 \newuserunit\descender fd
450 \newuserunit\capheight fc
451\popoverloadmode
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470\installcorenamespace{fontnormalizedbody}
471
472
473
474
475
476
477
478
479
480
481
482\permanent\protected\def\normalizebodyfontsize#macro#body
483 {\scratchdimen\ifchkdimension#body\or\lastchkdimension\else#body\dimexpr\fontbody\relax\fi
484 \expandafter\let\expandafter#macro\csname\??fontnormalizedbody\number\scratchdimen\endcsname
485 \ifrelax#macro
486 \normalizebodyfontsize_indeed#macro
487 \fi}
488
489\def\normalizebodyfontsize_indeed#macro
490 {\edef#macro{\clf_normalizedbodyfontsize\scratchdimen}
491 \gletcsname\??fontnormalizedbody\number\scratchdimen\endcsname#macro}
492
493\permanent\def\thenormalizedbodyfontsize#body
494 {\clf_normalizedbodyfontsize\dimexpr#body\relax}
495
496\mutable\edef\normalizedglobalbodyfontsize{\thenormalizedbodyfontsize\bodyfontsize}
497\mutable\edef\normalizedlocalbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize}
498\mutable\edef\normalizedbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize}
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528\installcorenamespace{mappedfontsize}
529
530
531\letcsname\??mappedfontsize\s!script \endcsname\!!plustwo
532\letcsname\??mappedfontsize\s!scriptscript\endcsname\!!plusthree
533
534\permanent\tolerant\protected\def\mapfontsize[#class]#spacer[#from]#spacer[#to]
535 {\ifarguments
536
537 \or
538
539 \letcsname\??mappedfontsize#class:1\endcsname\undefined
540 \letcsname\??mappedfontsize#class:2\endcsname\undefined
541 \letcsname\??mappedfontsize#class:3\endcsname\undefined
542 \or
543
544 \or
545
546 \defcsname
547 \??mappedfontsize
548 #class:
549 \begincsname\??mappedfontsize#from\endcsname
550 \endcsname{#to}
551 \fi}
552
553\permanent\tolerant\protected\def\checkedmapfontsize[#class]#spacer[#from]#spacer[#to]
554 {\ifcsname\??mappedfontsize#class:\begincsname\??mappedfontsize#from\endcsname\endcsname
555
556 \else
557 \mapfontsize[#class][#from][#to]
558 \fi}
559
560\permanent\tolerant\def\mappedfontsize#class#from
561 {\begincsname
562 \??mappedfontsize
563 #class:
564 \begincsname\??mappedfontsize#from\endcsname
565 \endcsname}
566
567\def\font_basics_set_mapped_fontsize#from
568 {\ifcsname\??mappedfontsize\fontclass:\fontface\endcsname
569
570
571 \the\dimexpr\lastnamedcs\dimexpr\normalizedbodyfontsize\relax\relax
572 \else
573 #from
574 \fi}
575
576\appendtoks
577 \def\font_basics_set_mapped_fontsize#from
578 {\ifcsname\??mappedfontsize\fontclass:\fontface\endcsname
579 \the\dimexpr\lastnamedcs\dimexpr\normalizedbodyfontsize\relax\relax
580 \else
581 #from
582 \fi}
583\to \everycompactfontmode
584
585
586
587
588
589
590
591
592
593\defcsname fontbasicsmappedfontsize1\endcsname
594 {\the\plusthousand}
595
596\defcsname fontbasicsmappedfontsize2\endcsname
597 {\the\numexpr
598 \plusthousand
599 *\dimexpr
600 \ifcsname\??mappedfontsize\fontclass:2\endcsname
601 \lastnamedcs\dimexpr\textface\relax
602 \else
603 \scriptface
604 \fi
605 \relax
606 \dimexpr\textface\relax
607 \relax}
608
609\defcsname fontbasicsmappedfontsize3\endcsname
610 {\the\numexpr
611 \plusthousand
612 *\dimexpr
613 \ifcsname\??mappedfontsize\fontclass:3\endcsname
614 \lastnamedcs\dimexpr\textface\relax
615 \else
616 \scriptscriptface
617 \fi
618 \relax
619 \dimexpr\textface\relax
620 \relax}
621
622\installcorenamespace{fontbodyknown}
623\installcorenamespace{fontclassyes}
624\installcorenamespace{fontclassnop}
625
626\def\font_helpers_process_relative_size_list#command
627 {#command\v!big
628 #command\v!small}
629
630\let\v_font_size_relative \plusone
631\def\v_font_size_absolute {\fontbody}
632
633\let\v_font_rscale_default\!!plusone
634\let\p_font_rscale \v_font_rscale_default
635
636\def\font_helpers_check_relative_font_id
637 {\let\p_font_rscale\minusone
638 \let\p_font_rscale\v_font_rscale_default}
639
640\def\font_helpers_check_relative_font_size#style
641 {\edef\p_font_rscale
642 {\ifcsname\??fontclass\fontclass#style\s!rscale\endcsname
643 \lastnamedcs
644 \orelse\ifcsname\??fontclass\defaultfontclass#style\s!rscale\endcsname
645 \lastnamedcs
646 \else
647 \v_font_rscale_default
648 \fi}
649
650 \ifx\p_font_rscale\v!auto
651 \let\p_font_rscale\plusone
652 \font_helpers_check_relative_font_id
653 \fi}
654
655\def\font_rscale_xx#style
656 {\ifcsname\??fontclass\fontclass#style\s!rscale\endcsname
657 \lastnamedcs
658 \else
659 \v_font_rscale_default
660 \fi}
661
662\def\font_rscale_mm
663 {\ifcsname\??fontclass\fontclass\s!mm\s!rscale\endcsname
664 \lastnamedcs
665 \else
666 \v_font_rscale_default
667 \fi}
668
669\protected\def\font_helpers_register_fontbody#body
670 {\letcsname\??fontbodyknown#body\endcsname\empty}
671
672
673
674
675
676
677
678
679
680
681
682
683
684\installcorenamespace{fontstyle}
685\installcorenamespace{fontshortstyle}
686
687\installcorenamespace{fontstyleknown}
688\installcorenamespace{fontalternativeknown}
689\installcorenamespace{fontsizeknown}
690
691\newtoks\t_font_style_commands
692\newtoks\t_font_size_commands
693\newtoks\t_font_alternative_commands
694
695\setnewmacro\m_font_style_command \gobbleoneargument
696\setnewmacro\m_font_size_command \gobbleoneargument
697\setnewmacro\m_font_alternative_command\gobbleoneargument
698
699\def\font_helpers_process_style_list #command{\def\m_font_style_command {#command}\expand\t_font_style_commands}
700\def\font_helpers_process_size_list #command{\def\m_font_size_command {#command}\expand\t_font_size_commands}
701\def\font_helpers_process_alternative_list#command{\def\m_font_alternative_command{#command}\expand\t_font_alternative_commands}
702
703\def\font_helpers_register_style #style{\letcsname\??fontstyleknown #style\endcsname\empty}
704\def\font_helpers_register_size #size{\letcsname\??fontsizeknown #size\endcsname\empty}
705\def\font_helpers_register_alternative#alternative{\letcsname\??fontalternativeknown#alternative\endcsname\empty}
706
707\permanent\protected\def\definefontstyle[#commands]#spacer[#style]
708 {\ifcsname\??fontstyleknown#style\endcsname \else
709 \font_helpers_register_style{#style}
710 \toksapp\t_font_style_commands{\m_font_style_command{#style}}
711 \fi
712 \processcommalist[#commands]{\font_basics_define_fontstyle_indeed{#style}}}
713
714\def\font_basics_define_fontstyle_indeed#style#command
715 {\defcsname\??fontshortstyle#command\endcsname{#style}
716 \defcsname\??fontstyle #command\endcsname{\csname#style\endcsname}}
717
718\permanent\protected\def\definefontsize[#size]
719 {\ifcsname\??fontsizeknown#size\endcsname \else
720 \font_helpers_register_size{#size}
721 \toksapp\t_font_size_commands{\m_font_size_command{#size}}
722 \fi
723 \font_helpers_check_fontname_combinations}
724
725\permanent\protected\def\definefontalternative[#alternative]
726 {\ifcsname\??fontalternativeknown#alternative\endcsname \else
727 \font_helpers_register_alternative{#alternative}
728 \toksapp\t_font_alternative_commands{\m_font_alternative_command{#alternative}}
729 \fi
730 \font_helpers_check_fontname_combinations}
731
732\protected\def\font_helpers_check_fontname_combinations
733 {\font_helpers_process_style_list\font_helpers_check_fontname_combinations_s}
734
735\def\font_helpers_check_fontname_combinations_s#style
736 {\font_helpers_process_alternative_list{\font_helpers_check_fontname_combinations_indeed_s_a{#style}}}
737
738\def\font_helpers_check_fontname_combinations_indeed_s_a#style#alternative
739 {\font_helpers_process_size_list{\font_basics_check_fontname_combination{#style}{#alternative}}}
740
741\definefontstyle [\s!mm] [\s!mm]
742\definefontstyle [\s!rm] [\s!rm]
743\definefontstyle [\s!ss] [\s!ss]
744\definefontstyle [\s!tt] [\s!tt]
745
746
747
748
749
750
751
752
753\newmacro\m_font_mm
754
755\def\font_basics_check_fontname_combination#style
756 {\edef\m_font_mm{#style}
757 \ifx\m_font_mm\s!mm
758 \expandafter\font_basics_check_math_bodyfont
759 \else
760 \expandafter\font_basics_check_text_bodyfont
761 \fi{#style}}
762
763\def\font_basics_check_math_bodyfont#style#alternative#size
764 {}
765
766\def\font_basics_check_text_bodyfont_step#whatever#body
767 {\ifcsname#whatever\endcsname\else
768
769 \permanent\protected\gdefcsname#whatever\endcsname{#body}
770 \fi}
771
772\def\font_basics_check_text_bodyfont#style#alternative#size
773 {\font_basics_check_text_bodyfont_step{#style#size}{\font_helpers_set_current_font_style_size{#style}{#size}}
774 \font_basics_check_text_bodyfont_step{#alternative#size}{\font_helpers_set_current_font_alternative_size{#alternative}{#size}}
775 \font_basics_check_text_bodyfont_step{#style#alternative#size}{\font_helpers_set_current_font_style_alternative_size{#style}{#alternative}{#size}}
776 \font_basics_check_text_bodyfont_step{#style}{\font_helpers_set_current_font_style{#style}}
777 \font_basics_check_text_bodyfont_step{#alternative}{\font_helpers_set_current_font_alternative{#alternative}}
778 \font_basics_check_text_bodyfont_step{#style\s!x }{\font_helpers_set_current_font_x_style_alternative{#style}}
779 \font_basics_check_text_bodyfont_step{#style\s!xx}{\font_helpers_set_current_font_xx_style_alternative{#style}}
780 \font_basics_check_text_bodyfont_step{#alternative\s!x }{\font_helpers_set_current_font_x_alternative{#alternative}}
781 \font_basics_check_text_bodyfont_step{#alternative\s!xx}{\font_helpers_set_current_font_xx_alternative{#alternative}}
782 \font_basics_check_text_bodyfont_step{#style#alternative}{\font_helpers_set_current_font_style_alternative{#style}{#alternative}}}
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816\mutable\let\somefontname \s!unknown
817\mutable\let\somefontspec \s!unknown
818\mutable\let\somefontfile \s!unknown
819\mutable\let\somefontsize \zerocount
820
821\mutable\lettonothing\somefontsizex
822\mutable\lettonothing\somefontsizey
823
824
825
826
827
828\newtoks \everydefinefont
829
830\aliased\let\c_font_feature_inheritance_fontnone \zerocount
831\aliased\let\c_font_feature_inheritance_fontonly \plusone
832\aliased\let\c_font_feature_inheritance_classonly \plustwo
833\aliased\let\c_font_feature_inheritance_fontfirst \plusthree
834\aliased\let\c_font_feature_inheritance_classfirst\plusfour
835
836\aliased\let\c_font_feature_inheritance_default\c_font_feature_inheritance_fontfirst
837
838\setnewconstant\c_font_feature_inheritance_mode\c_font_feature_inheritance_default
839
840\newdimension \d_font_scaled_text_face
841\newdimension \d_font_scaled_font_size
842\newconditional\c_font_body_scale
843\newfraction \f_font_body_scale
844
845\newinteger \c_font_scaled_glyph_scale
846
847\immutable\dimensiondef\d_font_scaled_default 10pt
848
849
850
851
852
853
854
855\mutable\lettonothing\somefontspec
856
857\mutable\let\lastrawfontcall \relax
858\mutable\let\lastglobalrawfontcall\relax
859
860\immutable\dimensiondef\d_font_default_size 10pt
861
862
863\lettonothing\m_font_class_features
864\lettonothing\m_font_class_fallbacks
865\lettonothing\m_font_class_goodies
866
867\lettonothing\m_font_direction
868\lettonothing\m_font_features
869\lettonothing\m_font_fallbacks
870\lettonothing\m_font_goodies
871
872\protected\def\font_helpers_low_level_define#specification#csname
873 {\font_ignore_compact_font_mode
874
875 \glet\somefontname\defaultfontfile
876 \lettonothing\somefontsize
877 \lettonothing\somefontsizex
878 \lettonothing\somefontsizey
879 \clf_definefont_one{\detokenize\expandafter{\normalexpanded{#specification}}}
880
881 \ifcase\fontface\relax
882
883 \let\v_font_size_absolute\textface
884 \or
885 \let\v_font_size_absolute\textface
886 \or
887 \let\v_font_size_absolute\scriptface
888 \or
889 \let\v_font_size_absolute\scriptscriptface
890 \or
891 \let\v_font_size_absolute\xtextface
892 \or
893 \let\v_font_size_absolute\xxtextface
894 \fi
895
896 \ifcase\scaledfontmode\relax
897 \d_font_scaled_font_size\d_font_default_size
898 \or
899
900 \d_font_scaled_font_size\somefontsize
901 \or
902
903 \d_font_scaled_font_size\v_font_size_absolute\relax
904 \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size
905 \or
906
907 \d_font_scaled_font_size\font_basics_set_mapped_fontsize\v_font_size_absolute
908 \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size
909 \or
910
911 \d_font_scaled_font_size\somefontsize\scaledpoint
912 \else
913
914 \d_font_scaled_font_size\somefontsize
915 \fi
916 \relax
917 \d_font_scaled_font_size\v_font_size_relative\d_font_scaled_font_size
918 \relax
919
920 \ifconditional\c_font_auto_size
921 \font_helpers_check_body_scale\fontsize
922 \ifconditional\c_font_body_scale
923 \d_font_scaled_font_size\f_font_body_scale\d_font_scaled_font_size
924 \d_font_scaled_text_face\f_font_body_scale\dimexpr\textface\relax
925 \else
926 \d_font_scaled_font_size\f_font_body_scale
927 \d_font_scaled_text_face\textface
928 \fi
929 \else
930 \d_font_scaled_text_face\textface
931 \fi
932
933 \edef\somefontspec{at \number\d_font_scaled_font_size sp}
934 \edef\somefontfile{\truefontname\somefontname}
935 \ifx\somefontfile\s!unknown
936 \edef\somefontfile{\defaultfontfile}
937 \fi
938 \font_helpers_update_font_parameters
939 \font_helpers_update_font_class_parameters
940 \clf_definefont_two
941 \ifempty\fontclass\s!false\else\s!true\fi
942 {#csname}
943 \somefontfile
944 \d_font_scaled_font_size
945 \c_font_feature_inheritance_mode
946 \m_font_class_features
947 \m_font_features
948 \m_font_class_fallbacks
949 \m_font_fallbacks
950 \fontface
951 \d_font_scaled_text_face
952 \m_font_class_goodies
953 \m_font_goodies
954 \m_font_class_designsize
955 \m_font_designsize
956 \scaledfontmode
957 \relax
958 \ifcase\scaledfontsize
959
960 \lettonothing\somefontspec
961 \let\lastrawfontcall\relax
962 \mutable\letcsname#csname\endcsname\relax
963 \else
964 \edef\somefontspec{at \number\scaledfontsize sp}
965 \expandafter\let\expandafter\lastrawfontcall\csname#csname\endcsname
966 \expand\everydefinefont
967 \fi
968 \c_font_feature_inheritance_mode\c_font_feature_inheritance_default}
969
970\mutable\lettonothing\somefontslant
971\mutable\lettonothing\somefontweight
972\mutable\lettonothing\somefontextend
973\mutable\lettonothing\somefontsqueeze
974
975\protected\def\font_helpers_low_level_define_compact#specification#csname
976 {
977 \glet\somefontname\defaultfontfile
978 \lettonothing\somefontsize
979 \lettonothing\somefontsizex
980 \lettonothing\somefontsizey
981 \clf_definefont_one{\detokenize\expandafter{\normalexpanded{#specification}}}
982
983 \ifcase\scaledfontmode\relax
984 \d_font_scaled_font_size\d_font_default_size
985 \or
986
987 \d_font_scaled_font_size\somefontsize
988 \or
989
990 \d_font_scaled_font_size\textface
991 \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size
992 \or
993
994 \d_font_scaled_font_size\font_basics_set_mapped_fontsize\textface
995 \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size
996 \or
997
998 \d_font_scaled_font_size\somefontsize\scaledpoint
999 \else
1000 \d_font_scaled_font_size\somefontsize
1001 \fi
1002 \relax
1003 \d_font_scaled_font_size\v_font_size_relative\d_font_scaled_font_size
1004 \relax
1005
1006 \ifconditional\c_font_auto_size
1007 \font_helpers_check_body_scale\fontsize
1008 \ifconditional\c_font_body_scale
1009 \d_font_scaled_font_size\f_font_body_scale\d_font_scaled_font_size
1010 \d_font_scaled_text_face\f_font_body_scale\dimexpr\textface\relax
1011 \else
1012 \d_font_scaled_font_size\f_font_body_scale
1013 \d_font_scaled_text_face\textface
1014 \fi
1015 \else
1016 \d_font_scaled_text_face\textface
1017 \fi
1018
1019 \ifnum\c_font_scaled_font_mode_saved>\plusfour
1020 \c_font_scaled_font_mode_saved\scaledfontmode
1021 \scaledfontmode\zerocount
1022 \fi
1023 \c_font_future_glyph_scale\numexpr\plushundred*\d_font_scaled_font_size\maxcard\relax
1024
1025 \edef\somefontspec{at \number\d_font_scaled_font_size sp}
1026
1027 \edef\somefontfile{\truefontname\somefontname}
1028 \ifx\somefontfile\s!unknown
1029 \edef\somefontfile{\defaultfontfile}
1030 \fi
1031 \font_helpers_update_font_parameters
1032 \font_helpers_update_font_class_parameters
1033
1034
1035 \clf_definefont_two
1036 \ifempty\fontclass\s!false\else\s!true\fi
1037 {#csname}
1038 \somefontfile
1039 \d_font_scaled_font_size
1040 \c_font_feature_inheritance_mode
1041 \m_font_class_features
1042 \m_font_features
1043 \m_font_class_fallbacks
1044 \m_font_fallbacks
1045 \zerocount
1046 \d_font_scaled_default
1047 \m_font_class_goodies
1048 \m_font_goodies
1049 \m_font_class_designsize
1050 \m_font_designsize
1051 \scaledfontmode
1052 \relax
1053 \ifcase\scaledfontsize
1054
1055 \lettonothing\somefontspec
1056 \let\lastrawfontcall\relax
1057 \mutable\letcsname#csname\endcsname\relax
1058 \else
1059 \edef\somefontspec{at \number\scaledfontsize sp}
1060
1061 \glyphscale\c_font_future_glyph_scale
1062 \glyphxscale\ifempty\somefontsizex\plusthousand\else\somefontsizex\fi\relax
1063 \glyphyscale\ifempty\somefontsizey\plusthousand\else\somefontsizey\fi\relax
1064
1065 \expandafter\let\expandafter\lastrawfontcall\csname#csname\endcsname
1066 \ifrelax\lastrawfontcall
1067 \lettonothing\somefontspec
1068 \else
1069 \ifempty\somefontextend \else\glyphxscale\somefontextend \relax\fi
1070 \ifempty\somefontsqueeze\else\glyphyscale\somefontsqueeze\relax\fi
1071 \glyphslant \ifempty\somefontslant \zerocount\else\somefontslant \fi\relax
1072 \glyphweight\ifempty\somefontweight\zerocount\else\somefontweight\fi\relax
1073 \mutable\fontspecdef\lastrawfontcall
1074 \lastnamedcs
1075 all \glyphscale \glyphxscale \glyphyscale \glyphslant \glyphweight
1076 \relax
1077 \mutable\ifempty\fontclass\letcsname\else\gletcsname\fi#csname\endcsname\lastrawfontcall
1078 \expand\everydefinefont
1079 \fi
1080 \fi
1081 \c_font_feature_inheritance_mode\c_font_feature_inheritance_default}
1082
1083\appendtoks
1084 \enforced\let\font_helpers_low_level_define\font_helpers_low_level_define_compact
1085\to \everycompactfontmode
1086
1087\def\font_helpers_check_body_scale#fontsize
1088 {\ifcsname\??fontenvironments\fontclass:\fontstyle\fontbody#fontsize\endcsname
1089 \lettolastnamedcs\f_font_body_scale
1090 \c_font_body_scale\conditionalfalse
1091 \orelse\ifcsname\??fontenvironments\fontclass:\fontstyle\s!default#fontsize\endcsname
1092 \lettolastnamedcs\f_font_body_scale
1093 \c_font_body_scale\conditionaltrue
1094 \orelse\ifcsname\??fontenvironments\fontclass\fontbody#fontsize\endcsname
1095 \lettolastnamedcs\f_font_body_scale
1096 \c_font_body_scale\conditionalfalse
1097 \orelse\ifcsname\??fontenvironments\fontclass\s!default#fontsize\endcsname
1098 \lettolastnamedcs\f_font_body_scale
1099 \c_font_body_scale\conditionaltrue
1100
1101 \orelse\ifcsname\??fontenvironments\fontclass\s!default\s!parent\endcsname
1102 \ifcsname\??fontenvironments\lastnamedcs#fontsize\endcsname
1103 \lettolastnamedcs\f_font_body_scale
1104 \else
1105 \let\f_font_body_scale\plusone
1106 \fi
1107 \c_font_body_scale\conditionaltrue
1108
1109 \orelse\ifcsname\??fontenvironments\fontbody:\fontstyle#fontsize\endcsname
1110 \lettolastnamedcs\f_font_body_scale
1111 \c_font_body_scale\conditionalfalse
1112 \orelse\ifcsname\??fontenvironments\fontbody#fontsize\endcsname
1113 \lettolastnamedcs\f_font_body_scale
1114 \c_font_body_scale\conditionalfalse
1115 \orelse\ifcsname\??fontenvironments\s!default#fontsize\endcsname
1116 \lettolastnamedcs\f_font_body_scale
1117 \c_font_body_scale\conditionaltrue
1118 \orelse\ifcsname\??fontenvironments\fontclass\s!default\s!text\endcsname
1119 \lettolastnamedcs\f_font_body_scale
1120 \c_font_body_scale\conditionaltrue
1121 \orelse\ifcsname\??fontenvironments\s!default\s!text\endcsname
1122 \lettolastnamedcs\f_font_body_scale
1123 \c_font_body_scale\conditionaltrue
1124 \else
1125 \let\f_font_body_scale\plusone
1126 \c_font_body_scale\conditionaltrue
1127 \fi}
1128
1129\newif\ifskipfontcharacteristics \skipfontcharacteristicstrue
1130
1131
1132
1133
1134
1135
1136\mutable\let\fontfile\s!unknown
1137
1138
1139
1140\installcorenamespace{fonts}
1141\installcorenamespace{fontslanguage}
1142
1143\installsetuponlycommandhandler \??fonts {fonts}
1144
1145\newconstant\c_fonts_auto_language
1146
1147\letcsname\??fontslanguage\v!auto\endcsname\plusone
1148
1149
1150\appendtoks
1151 \c_fonts_auto_language
1152 \ifcsname\??fontslanguage\fontsparameter\c!language\endcsname
1153 \lastnamedcs
1154 \else
1155 \zerocount
1156 \fi
1157\to \everysetupfonts
1158
1159\appendtoks
1160 \ifcase\c_fonts_auto_language
1161
1162 \or
1163 \addfflanguage
1164
1165
1166 \fi
1167\to \everylanguage
1168
1169
1170
1171
1172
1173
1174
1175\ifdefined\everyfont \else \newtoks\everyfont \fi
1176\ifdefined\everyfontswitch \else \newtoks\everyfontswitch \fi
1177
1178\permanent\def\setfontcharacteristics{\expand\everyfont}
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205\permanent\tolerant\protected\def\definefont[#1]#*[#2]#*[#3]
1206 {\ifparameter#3\or
1207 \expandafter\font_basics_define_font_a
1208 \else
1209 \expandafter\font_basics_define_font_b
1210 \fi[#1][#2][#3]}
1211
1212
1213
1214
1215
1216
1217\def\font_basics_define_font_a[#name][#specification][#settings]
1218 {\ifsetups{#settings}
1219 \mutable\protected\defcsname#name\endcsname{\font_basics_define_font_with_setups {#name}{#specification}{#settings}}
1220 \else
1221 \mutable\protected\defcsname#name\endcsname{\font_basics_define_font_with_parameters{#name}{#specification}{#settings}}
1222 \fi}
1223
1224\def\font_basics_define_font_b[#name][#specification][#dummy]
1225 {\mutable\protected\defcsname#name\endcsname{\font_basics_define_font_without_parameters{#name}{#specification}}}
1226
1227\def\font_basics_define_font_with_parameters#name#specification#settings
1228 {\font_basics_define_font_without_parameters{#name}{#specification}
1229 \setuplocalinterlinespace[#settings]
1230 \setupspacing\relax}
1231
1232\def\font_basics_define_font_with_setups#name#specification#settings
1233 {\font_basics_define_font_without_parameters{#name}{#specification}
1234 \directsetup{#settings}}
1235
1236
1237
1238
1239\permanent\tolerant\protected\def\definefrozenfont[#name]#spacer[#specification]#spacer[#settings]
1240 {\ifparameter#name\or
1241 \begingroup
1242 \definefont[#name][#specification][#settings]
1243 \csname#name\endcsname
1244 \glet\lastglobalrawfontcall\lastrawfontcall
1245 \endgroup
1246 \aliased\letcsname#name\endcsname\lastglobalrawfontcall
1247 \fi}
1248
1249
1250
1251
1252
1253
1254
1255\ifdefined\??fontinstanceready \else \installcorenamespace{fontinstanceready} \fi
1256\ifdefined\??fontinstancebasic \else \installcorenamespace{fontinstancebasic} \fi
1257\ifdefined\??fontinstanceclass \else \installcorenamespace{fontinstanceclass} \fi
1258
1259\newconditional\c_font_auto_size \c_font_auto_size\conditionaltrue
1260
1261\mutable\lettonothing\lastfontidentifier
1262
1263\def\v_font_identifier_basic{\??fontinstancebasic \lastfontidentifier\fontsize\fontface}
1264\def\v_font_identifier_class{\??fontinstanceclass\fontclass\lastfontidentifier\fontsize\fontface}
1265
1266\let\v_font_identifier_basic_saved\v_font_identifier_basic
1267\let\v_font_identifier_class_saved\v_font_identifier_class
1268
1269\appendtoks
1270 \def\v_font_identifier_basic{\??fontinstancebasic \lastfontidentifier\fontsize}
1271 \def\v_font_identifier_class{\??fontinstanceclass\fontclass\lastfontidentifier\fontsize}
1272
1273 \let\v_font_identifier_basic_saved\v_font_identifier_basic
1274 \let\v_font_identifier_class_saved\v_font_identifier_class
1275\to \everycompactfontmode
1276
1277\def\font_basics_define_font_without_parameters#identifier#2
1278 {\relax
1279 \c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly
1280 \cdef\lastfontidentifier{#identifier}
1281 \let\v_font_size_relative\v_font_rscale_default
1282 \let\v_font_size_absolute\fontbody
1283 \font_helpers_low_level_define{#2}\v_font_identifier_basic
1284 \csname\v_font_identifier_basic\endcsname
1285 \c_font_auto_size\conditionalfalse
1286 \expand\everyfont
1287 \expand\everyfontswitch
1288 \let\v_font_identifier_basic\v_font_identifier_basic_saved}
1289
1290\protected\def\font_helpers_trigger#identifier
1291 {\cdef\lastfontidentifier{#identifier}
1292 \ifcsname\v_font_identifier_class\endcsname
1293
1294 \expandafter\font_helpers_trigger_reuse
1295 \else
1296
1297 \expandafter\font_helpers_trigger_define
1298 \fi}
1299
1300\def\font_helpers_trigger_define#relative#absolute#specification
1301 {\def\v_font_size_relative{#relative}
1302 \def\v_font_size_absolute{#absolute}
1303 \font_helpers_low_level_define{#specification}\v_font_identifier_class
1304 \csname\v_font_identifier_class\endcsname
1305 \c_font_auto_size\conditionalfalse
1306 \ifskipfontcharacteristics \else
1307 \expand\everyfont
1308 \expand\everyfontswitch
1309 \fi
1310 \let\v_font_identifier_class\v_font_identifier_class_saved}
1311
1312\def\font_helpers_trigger_reuse#relative#absolute#specification
1313 {\csname\v_font_identifier_class\endcsname
1314 \c_font_auto_size\conditionalfalse
1315 \ifskipfontcharacteristics \else
1316 \expand\everyfont
1317 \expand\everyfontswitch
1318 \fi
1319 \let\v_font_identifier_class\v_font_identifier_class_saved}
1320
1321
1322
1323
1324
1325
1326
1327
1328\installcorenamespace{fontenvironments}
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339\permanent\def\currentfontbodysize
1340 {\ifcsname\??fontenvironments\fontclass:\fontstyle\s!default\somefontsize\endcsname
1341 \lastnamedcs
1342 \orelse\ifcsname\??fontenvironments\fontclass\s!default\somefontsize\endcsname
1343 \lastnamedcs
1344 \orelse\ifcsname\??fontenvironments\fontclass\s!default\s!parent\endcsname
1345 \ifcsname\??fontenvironments\lastnamedcs\somefontsize\endcsname
1346 \lastnamedcs
1347 \else
1348 \somefontsize
1349 \fi
1350 \orelse\ifcsname\??fontenvironments\s!default\somefontsize\endcsname
1351 \lastnamedcs
1352 \else
1353 \somefontsize
1354 \fi}
1355
1356\permanent\def\currentfontbodyscale
1357 {\csname\??fontenvironments
1358 \ifcsname\??fontenvironments\fontclass:\fontstyle\s!default\fontsize\endcsname\fontclass:\fontstyle\s!default\fontsize\orelse
1359 \ifcsname\??fontenvironments\fontclass \s!default\fontsize\endcsname\fontclass \s!default\fontsize\orelse
1360 \ifcsname\??fontenvironments \s!default\fontsize\endcsname \s!default\fontsize\orelse
1361 \ifcsname\??fontenvironments\fontclass:\fontstyle\s!default\s!text \endcsname\fontclass:\fontstyle\s!default\s!text \orelse
1362 \ifcsname\??fontenvironments\fontclass \s!default\s!text \endcsname\fontclass \s!default\s!text \orelse
1363 \ifcsname\??fontenvironments \s!default\s!text \endcsname \s!default\s!text \else
1364 \s!default \fi
1365 \endcsname}
1366
1367\permanent\def\currentfontscale
1368 {\csname\??fontenvironments
1369 \ifcsname\??fontenvironments\fontclass:\fontstyle\s!default\wildcardfontsize\endcsname\fontclass:\fontstyle\s!default\fontsize\orelse
1370 \ifcsname\??fontenvironments\fontclass \s!default\wildcardfontsize\endcsname\fontclass \s!default\fontsize\orelse
1371 \ifcsname\??fontenvironments \s!default\wildcardfontsize\endcsname \s!default\fontsize\orelse
1372 \ifcsname\??fontenvironments\fontclass:\fontstyle\s!default\s!text \endcsname\fontclass:\fontstyle\s!default\s!text \orelse
1373 \ifcsname\??fontenvironments\fontclass \s!default\s!text \endcsname\fontclass \s!default\s!text \orelse
1374 \ifcsname\??fontenvironments \s!default\s!text \endcsname \s!default\s!text \else
1375 \s!default \fi
1376 \endcsname}
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387\def\font_currentfontscale
1388 {\ifcsname\??fontenvironments\fontclass:\fontstyle\s!default\wildcardfontsize\endcsname\lastnamedcs\orelse
1389 \ifcsname\??fontenvironments\fontclass \s!default\wildcardfontsize\endcsname\lastnamedcs\orelse
1390 \ifcsname\??fontenvironments \s!default\wildcardfontsize\endcsname\lastnamedcs\orelse
1391 \ifcsname\??fontenvironments\fontclass:\fontstyle\s!default\s!text \endcsname\lastnamedcs\orelse
1392 \ifcsname\??fontenvironments\fontclass \s!default\s!text \endcsname\lastnamedcs\orelse
1393 \ifcsname\??fontenvironments \s!default\s!text \endcsname\lastnamedcs\else
1394 \csname\??fontenvironments \s!default \endcsname \fi}
1395
1396\defcsname\??fontenvironments\s!default\endcsname{1}
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490\letcsname\??fontenvironments\endcsname\empty
1491
1492\permanent\def\bodyfontvariable#parameter
1493 {\begincsname\??fontenvironments
1494 \ifcsname\??fontenvironments\fontclass:\fontstyle\normalizedbodyfontsize#parameter\endcsname\fontclass:\fontstyle\normalizedbodyfontsize#parameter
1495 \orelse\ifcsname\??fontenvironments\fontclass \normalizedbodyfontsize#parameter\endcsname\fontclass \normalizedbodyfontsize#parameter
1496 \orelse\ifcsname\??fontenvironments\fontclass:\fontstyle #parameter\endcsname\fontclass:\fontstyle #parameter
1497 \orelse\ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter
1498 \orelse\ifcsname\??fontenvironments\fontclass \s!default \s!parent\endcsname\lastnamedcs #parameter
1499 \orelse\ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname \normalizedbodyfontsize#parameter
1500 \orelse\ifcsname\??fontenvironments \s!default #parameter\endcsname\s!default #parameter\fi
1501 \endcsname}
1502
1503\permanent\def\bodyfontsizevariable#size#parameter
1504 {\begincsname\??fontenvironments
1505 \ifcsname\??fontenvironments\fontclass:\fontstyle#size#parameter\endcsname\fontclass:\fontstyle#size#parameter
1506 \orelse\ifcsname\??fontenvironments\fontclass #size#parameter\endcsname\fontclass #size#parameter
1507 \orelse\ifcsname\??fontenvironments\fontclass:\fontstyle #parameter\endcsname\fontclass:\fontstyle#parameter
1508 \orelse\ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter
1509 \orelse\ifcsname\??fontenvironments\fontclass \s!default \s!parent\endcsname\lastnamedcs #parameter
1510 \orelse\ifcsname\??fontenvironments #size#parameter\endcsname #size#parameter
1511 \orelse\ifcsname\??fontenvironments \s!default #parameter\endcsname\s!default #parameter\fi
1512 \endcsname}
1513
1514\def\font_bodyfontvariable#parameter
1515 {\ifcsname\??fontenvironments\fontclass:\fontstyle\normalizedbodyfontsize#parameter\endcsname\lastnamedcs
1516 \orelse\ifcsname\??fontenvironments\fontclass \normalizedbodyfontsize#parameter\endcsname\lastnamedcs
1517 \orelse\ifcsname\??fontenvironments\fontclass:\fontstyle #parameter\endcsname\lastnamedcs
1518 \orelse\ifcsname\??fontenvironments\fontclass #parameter\endcsname\lastnamedcs
1519 \orelse\ifcsname\??fontenvironments\fontclass\s!default \s!parent\endcsname\begincsname\??fontenvironments\lastnamedcs#parameter\endcsname
1520 \orelse\ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname\lastnamedcs
1521 \orelse\ifcsname\??fontenvironments \s!default #parameter\endcsname\lastnamedcs\fi}
1522
1523\def\font_bodyfontsizevariable#size#parameter
1524 {\ifcsname\??fontenvironments\fontclass:\fontstyle #size#parameter\endcsname\lastnamedcs
1525 \orelse\ifcsname\??fontenvironments\fontclass #size#parameter\endcsname\lastnamedcs
1526 \orelse\ifcsname\??fontenvironments\fontclass:\fontstyle #parameter\endcsname\lastnamedcs
1527 \orelse\ifcsname\??fontenvironments\fontclass #parameter\endcsname\lastnamedcs
1528 \orelse\ifcsname\??fontenvironments\fontclass\s!default \s!parent\endcsname\begincsname\??fontenvironments\lastnamedcs#parameter\endcsname
1529 \orelse\ifcsname\??fontenvironments #size#parameter\endcsname\lastnamedcs
1530 \orelse\ifcsname\??fontenvironments\s!default #parameter\endcsname\lastnamedcs\fi}
1531
1532\permanent\def\currentbodyfontdimension#parameter
1533 {\the\dimexpr
1534 \ifcsname\??fontenvironments\fontclass:\fontstyle\normalizedbodyfontsize#parameter\endcsname
1535 \orelse\ifcsname\??fontenvironments\fontclass:\fontstyle\s!default #parameter\endcsname
1536 \orelse\ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname
1537 \orelse\ifcsname\??fontenvironments\fontclass\s!default#parameter\endcsname
1538
1539 \orelse\ifcsname\??fontenvironments\fontclass\s!default\s!parent\endcsname
1540 \ifcsname\??fontenvironments\lastnamedcs#parameter\endcsname\fi
1541
1542 \orelse\ifcsname\??fontenvironments\normalizedbodyfontsize#parameter\endcsname
1543 \orelse\ifcsname\??fontenvironments\s!default#parameter\endcsname
1544 \fi
1545 \lastnamedcs
1546 \ifchkdim\lastnamedcs\or\else
1547 \dimexpr\normalizedbodyfontsize\relax
1548 \fi
1549 \relax}
1550
1551\permanent\def\bodyfontdimension#class#size#parameter#body
1552 {\the\dimexpr
1553 \ifcsname\??fontenvironments#class:\fontstyle#size#parameter\endcsname
1554 \orelse\ifcsname\??fontenvironments#class:\fontstyle\s!default#parameter\endcsname
1555 \orelse\ifcsname\??fontenvironments#class#size#parameter\endcsname
1556 \orelse\ifcsname\??fontenvironments#class\s!default#parameter\endcsname
1557
1558 \orelse\ifcsname\??fontenvironments#class\s!default\s!parent\endcsname
1559 \ifcsname\??fontenvironments\lastnamedcs#parameter\endcsname\fi
1560
1561 \orelse\ifcsname\??fontenvironments#size#parameter\endcsname
1562 \orelse\ifcsname\??fontenvironments\s!default#parameter\endcsname
1563 \fi
1564 \lastnamedcs
1565 \ifchkdim\lastnamedcs\or\else
1566 \dimexpr#body\relax
1567 \fi
1568 \relax}
1569
1570
1571
1572
1573
1574\newconstant\currentxfontsize
1575
1576\permanent\def\wildcardfontsize {\ifcase\currentxfontsize\fontsize\or\s!x\else\s!xx\fi}
1577\permanent\def\wildcardfontscale{\normalexpanded{\noexpand\bodyfontvariable{\ifcase\currentxfontsize\fontsize\or\s!x\else\s!xx\fi}}}
1578
1579\permanent\def\bodyfontinterlinespace{\bodyfontvariable \c!interlinespace}
1580
1581
1582\installcorenamespace{fontenvironmentknown}
1583
1584\def\font_helpers_register_environment#class#body
1585 {\letcsname\??fontenvironmentknown#class#body\endcsname\empty}
1586
1587\newmacro\m_font_body
1588\newmacro\m_font_body_normalized
1589
1590\permanent\tolerant\protected\def\definebodyfontenvironment[#1]#*[#2]#*[#3]#*[#4]
1591 {\ifarguments
1592 \expandafter\font_basics_define_body_font_environment_unset
1593 \or
1594 \expandafter\font_basics_define_body_font_environment_unset
1595 \or
1596 \expandafter\font_basics_define_body_font_environment_empty
1597 \or
1598 \expandafter\font_basics_define_body_font_environment_class
1599 \or
1600 \expandafter\font_basics_define_body_font_environment_detail
1601 \fi[#1][#2][#3][#4]}
1602
1603\aliased\let\setupbodyfontenvironment\definebodyfontenvironment
1604
1605
1606
1607
1608
1609\permanent\def\processbodyfontenvironmentlist#1
1610 {\clf_processbodyfontsizes{\strippedcsname#1}}
1611
1612\permanent\def\bodyfontenvironmentlist
1613 {\clf_getbodyfontsizes}
1614
1615\def\font_basics_define_body_font_environment_detail[#class][#style][#body][#settings]
1616 {\font_basics_define_body_font_environment_class[#class:#style][#body][#settings][]}
1617
1618\def\font_basics_define_body_font_environment_class[#class][#body][#settings][#dummy]
1619 {\edef\m_font_body{#body}
1620 \ifchkdim\m_font_body\or
1621 \normalizebodyfontsize\m_font_body_normalized\m_font_body
1622 \font_basics_define_body_font_environment_size[#class][\m_font_body_normalized][#settings]
1623 \clf_registerbodyfontsize{\m_font_body_normalized}
1624 \orelse\ifhastok={#settings}
1625 \getparameters[\??fontenvironments#class#body][#settings]
1626 \else
1627 \setvalue{\??fontenvironments#class#body\s!parent}{#settings}
1628
1629 \fi}
1630
1631
1632
1633
1634\def\font_basics_define_body_font_environment_empty[#body][#settings][#dummya][#dummyb]
1635 {\push_macro_fontclass
1636 \lettonothing\fontclass
1637 \font_basics_define_body_font_environment_class[][#body][#settings][#dummya]
1638 \pop_macro_fontclass}
1639
1640\def\font_basics_define_body_font_environment_unset[#body][#dummya][#dummyb][#dummyc]
1641 {\push_macro_fontclass
1642 \lettonothing\fontclass
1643 \font_basics_define_body_font_environment_class[][#body][][]
1644 \pop_macro_fontclass}
1645
1646
1647
1648\newconditional\c_font_defining_environment_state
1649
1650\def\font_basics_define_body_font_environment_size[#class][#normalizedbody][#settings]
1651 {\getparameters[\??fontenvironments#class#normalizedbody][#settings]
1652 \ifcsname\??fontenvironmentknown#class#normalizedbody\endcsname
1653
1654 \orelse\ifproductionrun
1655 \push_macro_fontclass
1656 \cdef\fontclass{#class}
1657 \font_helpers_register_environment{#class}{#normalizedbody}
1658 \c_font_defining_environment_state\conditionaltrue
1659 \font_helpers_define_unknown_font{#normalizedbody}
1660 \c_font_defining_environment_state\conditionalfalse
1661 \pop_macro_fontclass
1662 \fi
1663 \font_helpers_register_fontbody{#normalizedbody}}
1664
1665
1666
1667\def\font_helpers_check_bodyfont_environment#normalizedbody#body
1668 {\ifcsname\??fontenvironmentknown\fontclass#normalizedbody\endcsname
1669
1670 \else
1671 \font_helpers_check_bodyfont_environment_indeed{#normalizedbody}{#body}
1672 \fi}
1673
1674\def\font_helpers_check_bodyfont_environment_indeed#normalizedbody#body
1675 {\font_helpers_register_environment\fontclass{#normalizedbody}
1676 \ifcsname\??fontbodyknown#normalizedbody\endcsname
1677 \else
1678 \font_helpers_define_unknown_font{#normalizedbody}
1679 \fi}
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757\installcorenamespace{fontdefinitions}
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767\permanent\tolerant\protected\def\definebodyfont[#1]#*[#2]#*[#3]#*[#4]
1768 {\ifarguments
1769 \or
1770 \font_basics_define_body_font[#1][\s!rm][]
1771 \or
1772 \font_basics_define_body_font[#1][\s!rm][#2]
1773 \or
1774 \font_basics_define_body_font[#1][#2][#3]
1775 \or
1776 \processcommacommand[#1]{\font_basics_define_body_font_class_given[#2][#3][#4]}
1777 \fi}
1778
1779\protected\def\font_basics_define_body_font[#whatever]
1780 {\doifelsenumber{#whatever}\font_basics_define_body_font_body\font_basics_define_body_font_name[#whatever]}
1781
1782
1783
1784
1785
1786
1787
1788
1789\protected\def\font_basics_define_body_font_class_given[#1][#2][#3]#4
1790 {\push_macro_fontclass
1791 \ifcstok{#4}\s!default
1792 \lettonothing\fontclass
1793 \else
1794 \cdef\fontclass{#4}
1795 \fi
1796 \definebodyfont[#1][#2][#3]
1797 \pop_macro_fontclass}
1798
1799\protected\def\font_basics_define_body_font_body[#body][#style][#specification]
1800 {\ifhastok={#specification}
1801 \expandafter\font_basics_define_body_font_body_assignment
1802 \else
1803 \expandafter\font_basics_define_body_font_body_identifier
1804 \fi
1805 [#body][#style][#specification]}
1806
1807\protected\def\font_basics_define_body_font_name[#name][#style][#specification]
1808 {\ifhastok={#specification}
1809 \expandafter\font_basics_define_body_font_name_assignment
1810 \else
1811 \expandafter\font_basics_define_body_font_name_identifier
1812 \fi
1813 [#name][#style][#specification]}
1814
1815\protected\def\font_basics_define_body_font_body_assignment[#bodylist][#stylelist][#assignments]
1816 {\processcommalist[#bodylist]{\font_basics_define_body_font_body_assignment_a{#stylelist}{#assignments}}}
1817
1818\protected\def\font_basics_define_body_font_body_assignment_a#stylelist#assignments#body
1819 {\normalizebodyfontsize\m_font_asked_body{#body}
1820
1821 \font_helpers_check_bodyfont_environment\m_font_asked_body\m_font_asked_body
1822 \processcommalist[#stylelist]{\font_basics_define_body_font_body_assignment_b{#assignments}}}
1823
1824\protected\def\font_basics_define_body_font_body_assignment_b#assignments#style
1825 {\edef\m_font_asked_style{#style}
1826 \processcommalist[#assignments]\font_basics_define_body_font_defs}
1827
1828\protected\def\font_basics_define_body_font_defs
1829 {\ifempty\fontclass
1830 \expandafter\font_basics_define_body_font_defs_nop
1831 \else
1832 \expandafter\font_basics_define_body_font_defs_yes
1833 \fi}
1834
1835\protected\def\font_basics_define_body_font_defs_yes_normal#assignment
1836 {\ifx\m_font_asked_style\s!mm
1837 \expandafter\font_basics_define_body_font_yes_mm
1838 \else
1839 \expandafter\font_basics_define_body_font_yes_xx
1840 \fi[#assignment]}
1841
1842\protected\def\font_basics_define_body_font_defs_nop_normal#assignment
1843 {\ifx\m_font_asked_style\s!mm
1844 \expandafter\font_basics_define_body_font_nop_mm
1845 \else
1846 \expandafter\font_basics_define_body_font_nop_xx
1847 \fi[#assignment]}
1848
1849\protected\def\font_basics_define_body_font_defs_yes_traced#assignment
1850 {\writestatus\m!fonts{[\fontclass] [\m_font_asked_body] [\m_font_asked_style] [#assignment]}
1851 \ifx\m_font_asked_style\s!mm
1852 \expandafter\font_basics_define_body_font_yes_mm
1853 \else
1854 \expandafter\font_basics_define_body_font_yes_xx
1855 \fi[#assignment]}
1856
1857\protected\def\font_basics_define_body_font_defs_nop_traced#assignment
1858 {\writestatus\m!fonts{[\fontclass] [\m_font_asked_body] [\m_font_asked_style] [#assignment]}
1859 \ifx\m_font_asked_style\s!mm
1860 \expandafter\font_basics_define_body_font_nop_mm
1861 \else
1862 \expandafter\font_basics_define_body_font_nop_xx
1863 \fi[#assignment]}
1864
1865\let\font_basics_define_body_font_defs_yes\font_basics_define_body_font_defs_yes_normal
1866\let\font_basics_define_body_font_defs_nop\font_basics_define_body_font_defs_nop_normal
1867
1868\appendtoks
1869 \let\font_basics_define_body_font_defs_yes\font_basics_define_body_font_defs_yes_traced
1870 \let\font_basics_define_body_font_defs_nop\font_basics_define_body_font_defs_nop_traced
1871\to \t_font_tracers_definitions
1872
1873
1874
1875
1876
1877\protected\def\font_basics_define_body_font_nop_xx[#one#two#rest=#value]
1878 {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
1879 \letcsname\??fontinstanceclass\m_font_asked_body\m_font_asked_style#one#two#rest0\endcsname\undefined
1880 \protected\edefcsname\??fontinstanceready\m_font_asked_body\m_font_asked_style#one#two#rest0\endcsname
1881 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}
1882 \letcsname\??fontinstanceclass\m_font_asked_body\m_font_asked_style#one#two#rest4\endcsname\undefined
1883 \protected\edefcsname\??fontinstanceready\m_font_asked_body\m_font_asked_style#one#two#rest4\endcsname
1884 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}
1885 \letcsname\??fontinstanceclass\m_font_asked_body\m_font_asked_style#one#two#rest5\endcsname\undefined
1886 \protected\edefcsname\??fontinstanceready\m_font_asked_body\m_font_asked_style#one#two#rest5\endcsname
1887 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}
1888 }
1889
1890\protected\def\font_basics_define_body_font_yes_xx[#one#two#rest=#value]
1891 {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
1892 \gletcsname\??fontinstanceclass\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest1\endcsname\undefined
1893 \protected\xdefcsname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest0\endcsname
1894 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest0}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1895 \gletcsname\??fontinstanceclass\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest2\endcsname\undefined
1896 \protected\xdefcsname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest4\endcsname
1897 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest4}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1898 \gletcsname\??fontinstanceclass\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest3\endcsname\undefined
1899 \protected\xdefcsname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest5\endcsname
1900 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest5}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1901 }
1902
1903\appendtoks
1904
1905 \protected\def\font_basics_define_body_font_nop_xx[#one#two#rest=#value]
1906 {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
1907 \letcsname\??fontinstanceclass\m_font_asked_body\m_font_asked_style#one#two#rest\endcsname\undefined
1908 \protected\edefcsname\??fontinstanceready\m_font_asked_body\m_font_asked_style#one#two#rest\endcsname
1909 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}
1910 }
1911 \protected\def\font_basics_define_body_font_yes_xx[#one#two#rest=#value]
1912 {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
1913 \gletcsname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest\endcsname\undefined
1914 \protected\xdefcsname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest\endcsname
1915 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1916 }
1917\to \everycompactfontmode
1918
1919
1920
1921
1922
1923
1924
1925
1926\protected\def\font_basics_define_body_font_nop_mm[#one#two#rest=#value]
1927 {
1928 \letcsname\??fontinstanceclass\m_font_asked_body\s!mm#one#two#rest1\endcsname\undefined
1929
1930
1931 \protected\xdefcsname\??fontinstanceready\m_font_asked_body\s!mm#one#two#rest\endcsname
1932 {\font_helpers_trigger{\m_font_asked_body\s!mm#one#two#rest}{\noexpand\font_rscale_mm}{\m_font_asked_body}{\normalunexpanded{#value}}}
1933 }
1934
1935
1936
1937\protected\def\font_basics_define_body_font_yes_mm[#one#two#rest=#value]
1938 {
1939 \gletcsname\??fontinstanceclass\fontclass\m_font_asked_body\s!mm#one#two#rest1\endcsname\undefined
1940
1941
1942 \protected\xdefcsname\??fontinstanceready\fontclass\m_font_asked_body\s!mm#one#two#rest\endcsname
1943 {\font_helpers_trigger{\m_font_asked_body\s!mm#one#two#rest}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1944 }
1945
1946\appendtoks
1947 \protected\def\font_basics_define_body_font_nop_mm[#one#two#rest=#value]
1948 {\letcsname\??fontinstanceclass\m_font_asked_body\s!mm#one#two#rest\endcsname\undefined
1949 \protected\xdefcsname\??fontinstanceready\m_font_asked_body\s!mm#one#two#rest\endcsname
1950 {\font_helpers_trigger{\m_font_asked_body\s!mm#one#two#rest}{\noexpand\font_rscale_mm}{\m_font_asked_body}{\normalunexpanded{#value}}}
1951 }
1952 \protected\def\font_basics_define_body_font_yes_mm[#one#two#rest=#value]
1953 {\gletcsname\??fontinstanceclass\fontclass\m_font_asked_body\s!mm#one#two#rest\endcsname\undefined
1954 \protected\xdefcsname\??fontinstanceready\fontclass\m_font_asked_body\s!mm#one#two#rest\endcsname
1955 {\font_helpers_trigger{\m_font_asked_body\s!mm#one#two#rest}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1956 }
1957\to \everycompactfontmode
1958
1959
1960
1961\protected\def\font_basics_define_body_font_body_identifier[#bodylist][#stylelist][#name]
1962 {\processcommalist[#bodylist]{\font_basics_define_body_font_body_identifier_a{#stylelist}{#name}}}
1963
1964\protected\def\font_basics_define_body_font_body_identifier_a#stylelist#name#body
1965 {\normalizebodyfontsize\m_font_asked_body{#body}
1966 \font_helpers_check_bodyfont_environment\m_font_asked_body\m_font_asked_body
1967 \processcommalist[#stylelist]{\font_basics_define_body_font_body_identifier_b{#name}}}
1968
1969\protected\def\font_basics_define_body_font_body_identifier_b#name#style
1970 {\edef\m_font_asked_style{#style}
1971
1972 \csname\??fontdefinitions#name:\m_font_asked_style\endcsname}
1973
1974\protected\def\font_basics_define_body_font_name_assignment[#name][#stylelist][#assignments]
1975 {\processcommalist[#stylelist]{\font_basics_define_body_font_name_assignment_a{#name}{#assignments}}}
1976
1977\protected\def\font_basics_define_body_font_name_assignment_a#name#assignments#style
1978 {
1979 \edefcsname\??fontdefinitions#name:#style\endcsname{\font_basics_define_body_font_default{#assignments}}}
1980
1981\protected\def\font_basics_define_body_font_name_identifier[#name][#stylelist][#identifier]
1982 {\processcommalist[#stylelist]{\font_basics_define_body_font_name_identifier_a{#name}{#identifier}}}
1983
1984\protected\def\font_basics_define_body_font_name_identifier_a#name#identifier#style
1985 {
1986 \ifcsname\??fontdefinitions#name:#style\endcsname
1987 \letcsname\??fontdefinitions#name:#style\expandafter\endcsname\csname\??fontdefinitions#identifier:#style\endcsname
1988 \else
1989 \defcsname\??fontdefinitions#name:#style\endcsname{\csname\??fontdefinitions#identifier:#style\endcsname}
1990 \fi}
1991
1992
1993
1994\newconditional\c_font_defining_unknown
1995\newconditional\c_font_defining_state
1996
1997\protected\def\font_helpers_define_unknown_font#body
1998 {\font_helpers_register_fontbody{#body}
1999 \c_font_defining_state\conditionalfalse
2000 \font_helpers_process_relative_size_list{\font_helpers_define_unknown_check_sizes{#body}}
2001 \ifconditional\c_font_defining_state
2002 \c_font_defining_state\conditionalfalse
2003 \font_helpers_process_style_list{\font_helpers_define_unknown_check_definitions{#body}}
2004 \ifconditional\c_font_defining_state
2005 \ifconditional\c_font_defining_environment_state\else
2006
2007 \clf_registerunknownbodysize{#body}
2008 \fi
2009 \c_font_defining_state\conditionalfalse
2010 \font_helpers_register_fontbody{#body}
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021 \fi
2022 \fi}
2023
2024\def\font_helpers_define_unknown_check_sizes#body#relativesize
2025 {\ifcsname\??fontenvironments\s!default#relativesize\endcsname
2026 \expandafter\normalizebodyfontsize\csname\??fontenvironments#body#relativesize\endcsname{\csname\??fontenvironments\s!default#relativesize\endcsname\dimexpr#body\relax}
2027 \c_font_defining_state\conditionaltrue
2028 \fi}
2029
2030\def\font_helpers_define_unknown_check_definitions#body#style
2031 {\ifcsname\??fontdefinitions\s!default:#style\endcsname
2032 \edef\m_font_asked_body{#body}
2033 \edef\m_font_asked_style{#style}
2034 \lastnamedcs
2035 \c_font_defining_state\conditionaltrue
2036 \fi}
2037
2038\def\font_helpers_define_unknown_check_relatives#body#relativesize
2039 {\ifcsname\??fontbodyknown\csname\??fontenvironments#body#relativesize\endcsname\endcsname \else
2040 \expandafter\font_helpers_define_unknown_font\csname\??fontenvironments#body#relativesize\endcsname
2041 \c_font_defining_state\conditionaltrue
2042 \fi}
2043
2044\protected\def\font_basics_define_body_font_default#assignments
2045 {\font_helpers_check_relative_font_size\m_font_asked_style
2046 \ifcsname\m_font_asked_style\endcsname\else
2047 \normalexpanded{\definefontstyle[\m_font_asked_style][\m_font_asked_style]}
2048 \fi
2049 \processcommalist[#assignments]\font_basics_define_body_font_defs
2050 \let\p_font_rscale\v_font_rscale_default}
2051
2052
2053
2054
2055\protected\def\font_basics_switch_points#body
2056 {\ifcsname\??fontbodyknown#body\endcsname \else
2057
2058 \font_helpers_define_unknown_font{#body}
2059 \fi
2060 \ifcsname\??fontbodyknown#body\endcsname
2061 \font_basics_complete_switch{#body}
2062 \localbodyfontsize#body\relax
2063 \normalizebodyfontsize\normalizedbodyfontsize\localbodyfontsize
2064 \font_helpers_check_bodyfont_environment\normalizedbodyfontsize\normalizedbodyfontsize
2065 \else
2066 \showmessage\m!fonts4{#body}
2067 \fi}
2068
2069\appendtoks
2070 \protected\def\font_basics_switch_points#body
2071 {\ifcsname\??fontbodyknown#body\endcsname \else
2072
2073 \font_helpers_define_unknown_font{#body}
2074 \fi
2075 \ifcsname\??fontbodyknown#body\endcsname
2076 \font_basics_complete_switch{#body}
2077 \localbodyfontsize#body\relax
2078 \normalizebodyfontsize\normalizedbodyfontsize\localbodyfontsize
2079 \font_helpers_check_bodyfont_environment\normalizedbodyfontsize\normalizedbodyfontsize
2080 \else
2081 \showmessage\m!fonts4{#body}
2082 \fi
2083 \glyphscale\numexpr\plushundred*\dimexpr\normalizedbodyfontsize\relax\maxcard\relax}
2084\to \everycompactfontmode
2085
2086\protected\def\font_basics_switch_style#style
2087 {\ifcsname\??fontstyle#style\endcsname
2088 \lastnamedcs
2089 \cdef\fontstyle{#style}
2090 \ifmmode\mr\fi
2091
2092 \else
2093 \showmessage\m!fonts5{#style}
2094 \fi}
2095
2096
2097
2098
2099\ifdefined\font_preloads_at_definition \else \let\font_preloads_at_definition\relax \fi
2100
2101\def\font_helpers_set_font#method#specification
2102 {\edef\m_font_specification{#specification}
2103 \ifempty\m_font_specification \else
2104 \ifx\m_font_specification\v!global
2105 \restoreglobalbodyfont
2106 \else
2107 \processcommacommand[\m_font_specification]{\font_helpers_set_font_set_font{#method}}
2108 \processcommacommand[\m_font_specification]{\font_helpers_set_font_check_size}
2109 \ifproductionrun
2110 \font_preloads_at_definition
2111 \font_basics_switch_points\normalizedbodyfontsize
2112 \font_basics_switch_style\fontstyle
2113 \ifempty\defaultfontclass
2114 \let\defaultfontclass\fontclass
2115 \fi
2116 \fi
2117 \fi
2118 \currentxfontsize\zerocount
2119 \fi}
2120
2121\def\font_helpers_set_font_check_size#option
2122 {\ifchkdimension#option\or
2123 \font_helpers_check_bodyfont_environment{#option}{#option}
2124 \fi}
2125
2126\def\font_helpers_set_font_set_font#method#option
2127 {\ifempty{#option}\else
2128 \font_helpers_set_font_set_font_option{#method}{#option}
2129 \fi}
2130
2131\def\font_helpers_set_font_set_font_option#method#option
2132 {\ifchkdimension#option\or
2133 \expandafter\font_helpers_set_font_set_font_option_body
2134 \else
2135 \expandafter\font_helpers_set_font_set_font_option_keyword
2136 \fi{#method}{#option}{#option}}
2137
2138\newmacro\m_font_keyword
2139
2140\protected\def\font_helpers_set_font_set_font_option_keyword#method#keyword#message
2141 {\edef\m_font_keyword{#keyword}
2142 \ifcsname\??fontenvironments\normalizedbodyfontsize\m_font_keyword\endcsname
2143 \edef\m_font_step{\font_bodyfontvariable\m_font_keyword}
2144 \normalexpanded{\font_helpers_set_font_set_font_option_body{#method}{\m_font_step}{#message}}
2145 \orelse\ifx\m_font_keyword\v!reset
2146 \lettonothing\fontstyle
2147 \lettonothing\fontsize
2148 \orelse\ifcsname\??fontstyle\m_font_keyword\endcsname
2149 \let\fontstyle\m_font_keyword
2150 \else
2151 \setcurrentfontclass\m_font_keyword
2152 \ifcase#method\relax
2153 \let\globalfontclass\globalfontclass
2154 \else
2155 \let\globalfontclass\fontclass
2156 \fi
2157 \font_helpers_set_fontstyle_of_fontclass
2158 \fi}
2159
2160\def\font_helpers_set_fontstyle_of_fontclass
2161 {\let\fontstyle\s!rm}
2162
2163\protected\def\font_helpers_set_font_set_font_option_body#method#body#message
2164 {\normalizebodyfontsize\normalizedsetfont{#body}
2165 \ifcsname\??fontbodyknown\normalizedsetfont\endcsname \else
2166 \font_helpers_define_unknown_font\normalizedsetfont
2167 \fi
2168 \ifcsname\??fontbodyknown\normalizedsetfont\endcsname
2169 \localbodyfontsize\normalizedsetfont
2170 \let\normalizedbodyfontsize\normalizedsetfont
2171 \else
2172 \showmessage\m!fonts4{#message}
2173
2174 \fi}
2175
2176
2177
2178\permanent\protected\def\registerfontclass#class
2179 {\gletcsname\??fontclassyes#class\endcsname\v!yes}
2180
2181\permanent\protected\def\setcurrentfontclass#class
2182 {\ifcsname\??bodyfontalias#class\endcsname
2183 \constant\lettolastnamedcs\fontclass
2184 \orelse\ifcsname\??fontclassyes#class\endcsname
2185 \cdef\fontclass{#class}
2186 \orelse\ifcsname\??fontclassnop#class\endcsname
2187
2188 \else
2189 \fonts_helpers_try_currentfontclass{#class}
2190 \fi}
2191
2192\ifdefined\fonts_helpers_try_currentfontclass \else
2193
2194 \protected\def\fonts_helpers_try_currentfontclass#typeface
2195 {\letcsname\??fontclassnop#typeface\endcsname\empty}
2196
2197\fi
2198
2199
2200
2201\permanent\protected\def\setcurrentfont#body#style#alternative#size
2202 {\cdef\fontbody {#body}
2203 \cdef\fontstyle {#style}
2204 \cdef\fontalternative{#alternative}
2205 \cdef\fontsize {#size}
2206 \font_helpers_check_big_math_synchronization
2207 \font_helpers_synchronize_font}
2208
2209\permanent\protected\def\setcurrentfontbody#body
2210 {\cdef\fontbody{#body}
2211 \font_helpers_synchronize_font}
2212
2213
2214
2215\ifdefined\font_typescripts_inherit_check \else
2216 \let\font_typescripts_inherit_check\gobbleoneargument
2217\fi
2218
2219\protected\def\font_helpers_set_current_font_style#style
2220 {\cdef\fontstyle{#style}
2221 \font_typescripts_inherit_check\fontstyle
2222 \ifmmode\mr\fi
2223 \font_helpers_synchronize_font}
2224
2225\protected\def\font_helpers_set_current_xsize_alternative#xsize#alternative
2226 {\cdef\fontface{#xsize}
2227 \cdef\fontalternative{#alternative}
2228 \font_helpers_synchronize_font}
2229
2230\appendtoks
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240 \protected\def\font_helpers_set_current_xsize_alternative#xsize#alternative
2241 {\cdef\fontface{0}
2242 \cdef\fontalternative{#alternative}
2243 \currentxfontsize#xsize\relax
2244 \font_helpers_synchronize_font}
2245\to \everycompactfontmode
2246
2247\protected\def\font_helpers_set_current_font_alternative#alternative
2248 {\cdef\fontalternative{#alternative}
2249 \font_helpers_synchronize_font}
2250
2251\protected\def\font_helpers_set_current_font_size#size
2252 {\cdef\fontsize{#size}
2253 \font_helpers_check_big_math_synchronization
2254 \font_helpers_synchronize_font}
2255
2256\protected\def\font_helpers_set_current_font_style_alternative#style#alternative
2257 {\cdef\fontstyle {#style}
2258 \cdef\fontalternative{#alternative}
2259 \font_helpers_synchronize_font}
2260
2261\protected\def\font_helpers_set_current_font_style_size#style#size
2262 {\cdef\fontstyle{#style}
2263 \cdef\fontsize {#size}
2264 \font_helpers_check_big_math_synchronization
2265 \font_helpers_synchronize_font}
2266
2267\protected\def\font_helpers_set_current_font_alternative_size#alternative#size
2268 {\cdef\fontalternative{#alternative}
2269 \cdef\fontsize {#size}
2270 \font_helpers_check_big_math_synchronization
2271 \font_helpers_synchronize_font}
2272
2273\protected\def\font_helpers_set_current_font_style_alternative_size#style#alternative#size
2274 {\cdef\fontstyle {#style}
2275 \cdef\fontalternative{#alternative}
2276 \cdef\fontsize {#size}
2277 \font_helpers_check_big_math_synchronization
2278 \font_helpers_synchronize_font}
2279
2280\protected\def\font_helpers_synchronize_font
2281 {\ifempty\fontclass
2282 \applyfontstrategies
2283 \else
2284 \applyfontclassstrategies
2285 \fi
2286 \c_font_auto_size\conditionalfalse
2287 \ifskipfontcharacteristics \else
2288 \expand\everyfont
2289 \expand\everyfontswitch
2290 \fi}
2291
2292\appendtoks
2293 \protected\def\font_helpers_synchronize_font
2294 {\ifempty\fontclass
2295 \applyfontstrategies
2296 \else
2297 \applyfontclassstrategies
2298 \fi
2299 \c_font_auto_size\conditionalfalse
2300 \ifcase\currentxfontsize
2301
2302 \or
2303 \normaltx
2304 \else
2305 \normaltxx
2306 \fi
2307 \ifskipfontcharacteristics \else
2308 \expand\everyfont
2309 \expand\everyfontswitch
2310 \fi}
2311\to \everycompactfontmode
2312
2313
2314
2315
2316\def\font_helpers_check_strategy_class_a
2317 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\fontalternative\fontsize\fontface\endcsname
2318 \c_font_auto_size\conditionalfalse
2319 \lastnamedcs
2320 \else
2321 \expandafter\font_helpers_check_strategy_class_b
2322 \fi}
2323
2324\def\font_helpers_check_strategy_class_b
2325 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\fontalternative\defaultfontsize\fontface\endcsname
2326 \c_font_auto_size\conditionaltrue
2327 \lastnamedcs
2328 \else
2329 \expandafter\font_helpers_check_strategy_class_c
2330 \fi}
2331
2332\def\font_helpers_check_strategy_class_c
2333 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\defaultfontalternative\fontsize\fontface\endcsname
2334 \c_font_auto_size\conditionaltrue
2335 \lastnamedcs
2336 \else
2337 \expandafter\font_helpers_check_strategy_class_d
2338 \fi}
2339
2340\def\font_helpers_check_strategy_class_d
2341 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2342 \c_font_auto_size\conditionaltrue
2343 \lastnamedcs
2344 \else
2345 \expandafter\font_helpers_check_strategy_class_e
2346 \fi}
2347
2348\def\font_helpers_check_strategy_class_e
2349 {\ifcsname\??fontinstanceready\fontclass\fontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2350 \c_font_auto_size\conditionalfalse
2351 \lastnamedcs
2352 \else
2353 \expandafter\font_helpers_check_strategy_class_f
2354 \fi}
2355
2356\def\font_helpers_check_strategy_class_f
2357 {\ifcsname\??fontinstanceready\fontclass\defaultfontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2358 \c_font_auto_size\conditionaltrue
2359 \lastnamedcs
2360 \else
2361 \expandafter\font_helpers_check_strategy_a
2362 \fi}
2363
2364\appendtoks
2365 \def\font_helpers_check_strategy_class_a
2366 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\fontalternative\fontsize\endcsname
2367 \c_font_auto_size\conditionalfalse
2368 \lastnamedcs
2369 \else
2370 \expandafter\font_helpers_check_strategy_class_b
2371 \fi}
2372
2373 \def\font_helpers_check_strategy_class_b
2374 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\fontalternative\defaultfontsize\endcsname
2375 \c_font_auto_size\conditionaltrue
2376 \lastnamedcs
2377 \else
2378 \expandafter\font_helpers_check_strategy_class_c
2379 \fi}
2380
2381 \def\font_helpers_check_strategy_class_c
2382 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\defaultfontalternative\fontsize\endcsname
2383 \c_font_auto_size\conditionaltrue
2384 \lastnamedcs
2385 \else
2386 \expandafter\font_helpers_check_strategy_class_d
2387 \fi}
2388
2389 \def\font_helpers_check_strategy_class_d
2390 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\defaultfontalternative\defaultfontsize\endcsname
2391 \c_font_auto_size\conditionaltrue
2392 \lastnamedcs
2393 \else
2394 \expandafter\font_helpers_check_strategy_class_e
2395 \fi}
2396
2397 \def\font_helpers_check_strategy_class_e
2398 {\ifcsname\??fontinstanceready\fontclass\fontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\endcsname
2399 \c_font_auto_size\conditionalfalse
2400 \lastnamedcs
2401 \else
2402 \expandafter\font_helpers_check_strategy_class_f
2403 \fi}
2404
2405 \def\font_helpers_check_strategy_class_f
2406 {\ifcsname\??fontinstanceready\fontclass\defaultfontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\endcsname
2407 \c_font_auto_size\conditionaltrue
2408 \lastnamedcs
2409 \else
2410 \expandafter\font_helpers_check_strategy_a
2411 \fi}
2412\to \everycompactfontmode
2413
2414
2415
2416\def\font_helpers_check_strategy_a
2417 {\ifcsname\??fontinstanceready\fontbody\fontstyle\fontalternative\fontsize\fontface\endcsname
2418 \c_font_auto_size\conditionalfalse
2419 \lastnamedcs
2420 \else
2421 \expandafter\font_helpers_check_strategy_b
2422 \fi}
2423
2424\def\font_helpers_check_strategy_b
2425 {\ifcsname\??fontinstanceready\fontbody\fontstyle\fontalternative\defaultfontsize\fontface\endcsname
2426 \c_font_auto_size\conditionaltrue
2427 \lastnamedcs
2428 \else
2429 \expandafter\font_helpers_check_strategy_c
2430 \fi}
2431
2432\def\font_helpers_check_strategy_c
2433 {\ifcsname\??fontinstanceready\fontbody\fontstyle\defaultfontalternative\fontsize\fontface\endcsname
2434 \c_font_auto_size\conditionaltrue
2435 \lastnamedcs
2436 \else
2437 \expandafter\font_helpers_check_strategy_d
2438 \fi}
2439
2440\def\font_helpers_check_strategy_d
2441 {\ifcsname\??fontinstanceready\fontbody\fontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2442 \c_font_auto_size\conditionaltrue
2443 \lastnamedcs
2444 \else
2445 \expandafter\font_helpers_check_strategy_e
2446 \fi}
2447
2448\def\font_helpers_check_strategy_e
2449 {\ifcsname\??fontinstanceready\fontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2450 \c_font_auto_size\conditionalfalse
2451 \lastnamedcs
2452 \else
2453 \expandafter\font_helpers_check_strategy_f
2454 \fi}
2455
2456\def\font_helpers_check_strategy_f
2457 {\ifcsname\??fontinstanceready\defaultfontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2458 \c_font_auto_size\conditionaltrue
2459 \lastnamedcs
2460 \fi}
2461
2462\appendtoks
2463 \def\font_helpers_check_strategy_a
2464 {\ifcsname\??fontinstanceready\fontbody\fontstyle\fontalternative\fontsize\endcsname
2465 \c_font_auto_size\conditionalfalse
2466 \lastnamedcs
2467 \else
2468 \expandafter\font_helpers_check_strategy_b
2469 \fi}
2470
2471 \def\font_helpers_check_strategy_b
2472 {\ifcsname\??fontinstanceready\fontbody\fontstyle\fontalternative\defaultfontsize\endcsname
2473 \c_font_auto_size\conditionaltrue
2474 \lastnamedcs
2475 \else
2476 \expandafter\font_helpers_check_strategy_c
2477 \fi}
2478
2479 \def\font_helpers_check_strategy_c
2480 {\ifcsname\??fontinstanceready\fontbody\fontstyle\defaultfontalternative\fontsize\endcsname
2481 \c_font_auto_size\conditionaltrue
2482 \lastnamedcs
2483 \else
2484 \expandafter\font_helpers_check_strategy_d
2485 \fi}
2486
2487 \def\font_helpers_check_strategy_d
2488 {\ifcsname\??fontinstanceready\fontbody\fontstyle\defaultfontalternative\defaultfontsize\endcsname
2489 \c_font_auto_size\conditionaltrue
2490 \lastnamedcs
2491 \else
2492 \expandafter\font_helpers_check_strategy_e
2493 \fi}
2494
2495 \def\font_helpers_check_strategy_e
2496 {\ifcsname\??fontinstanceready\fontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\endcsname
2497 \c_font_auto_size\conditionalfalse
2498 \lastnamedcs
2499 \else
2500 \expandafter\font_helpers_check_strategy_f
2501 \fi}
2502
2503 \def\font_helpers_check_strategy_f
2504 {\ifcsname\??fontinstanceready\defaultfontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\endcsname
2505 \c_font_auto_size\conditionaltrue
2506 \lastnamedcs
2507 \fi}
2508\to \everycompactfontmode
2509
2510\permanent\let\applyfontstrategies \font_helpers_check_strategy_a
2511\permanent\let\applyfontclassstrategies\font_helpers_check_strategy_class_a
2512
2513\appendtoks
2514 \enforced\permanent\let\applyfontstrategies \font_helpers_check_strategy_a
2515 \enforced\permanent\let\applyfontclassstrategies\font_helpers_check_strategy_class_a
2516\to \everycompactfontmode
2517
2518
2519
2520\newconditional\c_font_synchronize \c_font_synchronize\conditionaltrue
2521
2522\prependtoks
2523 \ifconditional\c_font_synchronize
2524 \font_helpers_synchronize_math
2525 \font_helpers_synchronize_font
2526 \fi
2527\to \everybodyfont
2528
2529
2530
2531
2532
2533
2534
2535\permanent\protected\def\resettx
2536 {\ifzeronum\currentxfontsize\else
2537 \currentxfontsize\zerocount
2538 \enforced\let\tx\normaltx
2539 \enforced\let\txx\normaltxx
2540
2541
2542 \let\fontsize\empty
2543 \font_scale_defined
2544
2545
2546 \fi}
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561\prependtoks
2562 \currentxfontsize\zerocount
2563 \enforced\let\tx \normaltx
2564 \enforced\let\txx\normaltxx
2565 \font_scale_defined
2566\to \everysetupbodyfont
2567
2568\prependtoks
2569
2570 \currentxfontsize\zerocount
2571 \enforced\let\tx \normaltx
2572 \enforced\let\txx\normaltxx
2573 \font_scale_defined
2574\to \everyswitchtobodyfont
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591\def\font_helpers_set_current_font_xxx_alternative#alternative#xsize#scriptstyle
2592 {\ifmmode
2593 #scriptstyle
2594 \else
2595 \font_helpers_set_current_xsize_alternative{#xsize}{#alternative}
2596 \fi}
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608\def\font_helpers_set_current_font_x_alternative#alternative
2609 {
2610 \font_helpers_set_current_font_xxx_alternative{#alternative}{4}\scriptstyle
2611 \currentxfontsize\plusone
2612 \enforced\let\tx\txx}
2613
2614\def\font_helpers_set_current_font_xx_alternative#alternative
2615 {
2616 \font_helpers_set_current_font_xxx_alternative{#alternative}{5}\scriptscriptstyle
2617 \currentxfontsize\plustwo
2618 \enforced\lettonothing\tx
2619 \enforced\lettonothing\txx}
2620
2621\appendtoks
2622 \def\font_helpers_set_current_font_x_alternative#alternative
2623 {
2624 \currentxfontsize\plusone
2625 \font_helpers_set_current_font_xxx_alternative{#alternative}\plusone\scriptstyle
2626 \enforced\let\tx\txx}
2627 \def\font_helpers_set_current_font_xx_alternative#alternative
2628 {
2629 \currentxfontsize\plusone
2630 \font_helpers_set_current_font_xxx_alternative{#alternative}\plustwo\scriptscriptstyle
2631 \enforced\lettonothing\tx
2632 \enforced\lettonothing\txx}
2633\to \everycompactfontmode
2634
2635
2636
2637
2638\def\font_helpers_set_current_font_x_style_alternative #alternative{\csname#alternative\endcsname\tx}
2639\def\font_helpers_set_current_font_xx_style_alternative#alternative{\csname#alternative\endcsname\txx}
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662\def\font_scale_defined
2663 {\let\fontface\!!zerocount
2664
2665 \font_helpers_synchronize_font}
2666
2667\def\font_scale_defined_x
2668 {\let\fontface\!!plusfour
2669
2670 \font_helpers_synchronize_font}
2671
2672\def\font_scale_defined_xx
2673 {\let\fontface\!!plusfive
2674
2675 \font_helpers_synchronize_font}
2676
2677\appendtoks
2678 \def\font_scale_defined
2679 {\glyphscale\dimexpr\textface*\plushundred\onepoint\relax
2680 \ifskipfontcharacteristics \else
2681 \expand\everyfont
2682 \expand\everyfontswitch
2683 \fi}
2684 \def\font_scale_defined_x
2685 {\glyphscale\dimexpr\xtextface*\plushundred\onepoint\relax
2686 \ifskipfontcharacteristics \else
2687 \expand\everyfont
2688 \expand\everyfontswitch
2689 \fi}
2690 \def\font_scale_defined_xx
2691 {\glyphscale\dimexpr\xxtextface*\plushundred\onepoint\relax
2692 \ifskipfontcharacteristics \else
2693 \expand\everyfont
2694 \expand\everyfontswitch
2695 \fi}
2696\to \everycompactfontmode
2697
2698
2699
2700\permanent\protected\def\tx
2701 {\currentxfontsize\plusone
2702 \ifmmode
2703 \scriptstyle
2704 \else
2705 \font_scale_defined_x
2706 \fi
2707 \enforced\let\tx\txx}
2708
2709\permanent\protected\def\txx
2710 {\currentxfontsize\plustwo
2711 \ifmmode
2712 \scriptscriptstyle
2713 \else
2714 \font_scale_defined_xx
2715 \fi
2716 \enforced\lettonothing\tx
2717 \enforced\lettonothing\txx}
2718
2719\permanent\protected\def\sx
2720 {\currentxfontsize\plusone
2721 \ifmmode
2722 \scriptstyle
2723 \else
2724 \font_scale_defined_x
2725 \fi
2726 \enforced\let\tx\txx
2727 \enforced\let\sx\sxx}
2728
2729\permanent\protected\def\sxx
2730 {\currentxfontsize\plustwo
2731 \ifmmode
2732 \scriptscriptstyle
2733 \else
2734 \font_scale_defined_xx
2735 \fi
2736 \enforced\lettonothing\tx
2737 \enforced\lettonothing\txx
2738 \enforced\lettonothing\sx
2739 \enforced\lettonothing\sxx}
2740
2741\aliased\let\normaltx \tx
2742\aliased\let\normaltxx\txx
2743
2744\aliased\let\normalsx \sx
2745\aliased\let\normalsxx\sxx
2746
2747\lettonothing\useinheritxsizes
2748\lettonothing\usedefinedxsizes
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758\permanent\protected\def\textface {\currentbodyfontdimension\s!text }
2759\permanent\protected\def\scriptface {\currentbodyfontdimension\s!script }
2760\permanent\protected\def\scriptscriptface{\currentbodyfontdimension\s!scriptscript}
2761\permanent\protected\def\xtextface {\currentbodyfontdimension\s!x }
2762\permanent\protected\def\xxtextface {\currentbodyfontdimension\s!xx }
2763
2764\protected\def\font_basics_complete_switch#size
2765 {\bodyfontsize#size\relax
2766 \normalizebodyfontsize\normalizedbodyfontsize\bodyfontsize}
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794\ifdefined\saveinterlinespace \else \let\saveinterlinespace \relax \fi
2795\ifdefined\restoreinterlinespace \else \let\restoreinterlinespace\relax \fi
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821\permanent\protected\tolerant\def\setupbodyfont[#specification]
2822 {\ifparameter#specification\or
2823 \font_helpers_set_font\plusone{#specification}
2824 \globalbodyfontsize\localbodyfontsize
2825 \normalizebodyfontsize\normalizedglobalbodyfontsize\globalbodyfontsize
2826 \let\globalfontstyle\fontstyle
2827 \ifproductionrun
2828 \expand\everybodyfont
2829 \expand\everyglobalbodyfont
2830 \saveinterlinespace
2831 \fi
2832 \expand\everysetupbodyfont
2833 \else
2834 \restoreglobalbodyfont
2835 \saveinterlinespace
2836 \fi}
2837
2838\permanent\protected\def\switchtobodyfont[#specification]
2839 {\ifparameter#specification\or
2840 \font_basics_switchtobodyfont{#specification}
2841 \fi}
2842
2843\protected\def\font_basics_switchtobodyfont#specification
2844 {\edef\m_font_step{\font_bodyfontvariable{#specification}}
2845 \ifempty\m_font_step
2846 \font_helpers_set_font\zerocount{#specification}
2847 \else
2848 \font_helpers_switch_bodyfont_step
2849 \fi
2850 \expand\everybodyfont
2851 \expand\everyswitchtobodyfont
2852\expand\everyfont
2853\expand\everyfontswitch
2854 }
2855
2856\permanent\protected\def\usebodyfontparameter#1
2857 {\edef\m_font_bodyfont_asked{#1\c!bodyfont}
2858 \ifempty\m_font_bodyfont_asked\else
2859 \font_basics_switchtobodyfont\m_font_bodyfont_asked
2860 \fi}
2861
2862\def\font_helpers_switch_bodyfont_step
2863 {\font_basics_switch_points\m_font_step
2864 \font_basics_switch_style \fontstyle}
2865
2866
2867
2868
2869\permanent\protected\def\fastswitchtobodyfont#name
2870 {\ifcsname\??fontenvironments\normalizedbodyfontsize#name\endcsname
2871
2872 \lettolastnamedcs\p_bodyfont
2873 \ifcsname\??fontbodyknown\p_bodyfont\endcsname
2874 \font_basics_complete_switch\p_bodyfont
2875 \localbodyfontsize\p_bodyfont\relax
2876 \fi
2877 \fi
2878 \csname\??fontstyle\fontstyle\endcsname
2879 \expand\everybodyfont
2880\expand\everyfontswitch
2881 }
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912\installcorenamespace{bodyfontalias}
2913
2914\permanent\protected\def\usebodyfont[#1]
2915 {\ifempty\fontclass
2916 \setupbodyfont[#1]
2917 \else
2918 \switchtobodyfont[#1]
2919 \fullrestoreglobalbodyfont
2920 \fi}
2921
2922\permanent\protected\def\aliasbodyfont[#1]#*[#2]
2923 {\ifparameter#2\or
2924 \cdefcsname\??bodyfontalias#1\endcsname{#2}
2925 \fi}
2926
2927\fetchmodulecommand \showbodyfontstate \f!font_run
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947\permanent\protected\def\fontchar #character{\clf_fontchar{#character}}
2948\permanent\protected\def\fontcharbyindex #index{\clf_fontcharbyindex#index\relax}
2949\permanent \def\tochar #specifications{\clf_tochar{#specifications}}
2950
2951
2952
2953\permanent\def\purefontname#font{\clf_purefontname{\fontname#font}}
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967\permanent\protected\def\switchstyleonly
2968 {\doifelsenextoptionalcs\font_basics_switch_style_only_opt\font_basics_switch_style_only_arg}
2969
2970\def\font_basics_switch_style_only_arg#name
2971 {\font_helpers_set_current_font_style{\csname\??fontshortstyle\checkedstrippedcsname#name\endcsname}
2972 \expand\everybodyfont}
2973
2974\def\font_basics_switch_style_only_opt[#name]
2975 {\font_helpers_set_current_font_style{\csname\??fontshortstyle#name\endcsname}
2976 \expand\everybodyfont}
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990\permanent\tolerant\protected\def\definebodyfontswitch[#command]#spacer[#specification]
2991 {\frozen\protected\defcsname#command\endcsname{\switchtobodyfont[#specification]}}
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001\newmacro\m_font_step
3002
3003\def\font_helpers_set_bodyfont_step#step
3004 {\edef\m_font_step{\font_bodyfontvariable{#step}}
3005 \font_basics_switch_points\m_font_step
3006 \font_basics_switch_style \fontstyle}
3007
3008\permanent\protected\def\setsmallbodyfont{\font_helpers_set_bodyfont_step\v!small\expand\everybodyfont}
3009\permanent\protected\def\setbigbodyfont {\font_helpers_set_bodyfont_step\v!big \expand\everybodyfont}
3010
3011\permanent\protected\def\setmainbodyfont
3012 {\font_basics_switch_points\normalizedbodyfontsize
3013 \font_basics_switch_style\fontstyle
3014 \expand\everybodyfont
3015 \expand\everyglobalbodyfont
3016 \saveinterlinespace}
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031\mutable\let\globalfontstyle\s!rm
3032
3033\permanent\protected\def\fullrestoreglobalbodyfont
3034 {\let\fontsize\defaultfontsize
3035 \let\fontbody\defaultfontbody
3036 \let\fontface\defaultfontface
3037 \currentxfontsize\zerocount
3038 \let\fontclass\globalfontclass
3039 \font_basics_switch_points\normalizedglobalbodyfontsize
3040 \font_basics_switch_style\globalfontstyle
3041 \redoconvertfont
3042 \tf
3043 \expand\everybodyfont
3044 \expand\everyglobalbodyfont
3045 \saveinterlinespace}
3046
3047\permanent\protected\def\partialrestoreglobalbodyfont
3048 {\let\fontsize\defaultfontsize
3049 \let\fontbody\defaultfontbody
3050 \let\fontface\defaultfontface
3051 \currentxfontsize\zerocount
3052 \redoconvertfont
3053 \tf
3054 \expand\everybodyfont
3055 \expand\everyglobalbodyfont
3056 \saveinterlinespace}
3057
3058\permanent\protected\def\restoreglobalbodyfont
3059 {\ifx\fontclass\globalfontclass
3060 \ifx\fontstyle\globalfontstyle
3061 \ifx\normalizedbodyfontsize\normalizedglobalbodyfontsize
3062 \partialrestoreglobalbodyfont
3063 \else
3064 \fullrestoreglobalbodyfont
3065 \fi
3066 \else
3067 \fullrestoreglobalbodyfont
3068 \fi
3069 \else
3070 \fullrestoreglobalbodyfont
3071 \fi}
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088\installcorenamespace{predefinedfont}
3089
3090\permanent\protected\def\predefinefont[#1]#*[#2]
3091 {\protected\gdefcsname#1\endcsname{\font_basics_predefine{#1}{#2}}}
3092
3093\permanent\protected\def\predefinedfont[#1]
3094 {\ifcsname\??predefinedfont#1\endcsname
3095 \lastnamedcs
3096 \else
3097 \font_basics_predefined{#1}
3098 \fi}
3099
3100\protected\def\font_basics_predefine#1#2
3101 {\definedfont[#2]
3102 \gletcsname#1\expandafter\endcsname\csname\v_font_identifier_basic\endcsname}
3103
3104\protected\def\font_basics_predefined#1
3105 {\font_basics_predefine{\??predefinedfont#1}{#1}}
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125\permanent\protected\def\saverunningstyleandcolor
3126 {\enforced\permanent\protected\edef\restorerunningstyleandcolor
3127 {\setfontid \the\fontid\font
3128 \glyphscale \the\glyphscale
3129 \glyphxscale \the\glyphxscale
3130 \glyphyscale \the\glyphyscale
3131 \glyphslant \the\glyphslant
3132 \glyphweight \the\glyphweight
3133 \c_attr_colormodel \the\c_attr_colormodel
3134 \c_attr_color \the\c_attr_color
3135 \c_attr_transparency\the\c_attr_transparency
3136 \relax}}
3137
3138\aliased\let\restorerunningstyleandcolor\relax
3139
3140
3141
3142
3143
3144\aliased\let\getprivateglyphslot\clf_getprivateglyphslot
3145
3146\aliased\let\getprivatechar \clf_getprivatechar
3147\aliased\let\getprivatemathchar \clf_getprivatemathchar
3148\aliased\let\getprivateslot \clf_getprivateslot
3149
3150
3151
3152
3153\permanent\protected\def\privatechar
3154 {\ifmmode
3155 \expandafter\getprivatemathchar
3156 \else
3157 \expandafter\getprivatechar
3158 \fi}
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181\permanent\tolerant\protected\def\definefontcolorpalette[#1]#*[#2]
3182 {\clf_definefontcolorpalette{#1}{#2}}
3183
3184
3185
3186
3187
3188
3189\permanent\protected\def\usefontpath[#1]
3190 {\clf_addfontpath{#1}}
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205\appendtoks
3206 \edef\m_list{\fontsparameter\s!serif}
3207 \ifempty\m_list\else
3208 \registerfallbackfont[\s!serif][\m_list]
3209 \fi
3210 \edef\m_list{\fontsparameter\s!sans}
3211 \ifempty\m_list\else
3212 \registerfallbackfont[\s!sans][\m_list]
3213 \fi
3214 \edef\m_list{\fontsparameter\s!mono}
3215 \ifempty\m_list\else
3216 \registerfallbackfont[\s!mono][\m_list]
3217 \fi
3218\to \everysetupfonts
3219
3220
3221
3222
3223\definecolor[currentfont] [darkgray]
3224
3225\permanent\tolerant\protected\def\showcurrentfont[#1]
3226 {\dontleavehmode\bgroup\setbox\scratchbox\hpack\bgroup
3227 \startcolor[currentfont]
3228 \scratchdimen #1\exheight
3229 \ifdim\scratchdimen<\zeropoint
3230 \scratchheight\strutht
3231 \scratchdepth \strutdp
3232 \else
3233 \scratchheight\strutht
3234 \scratchdepth \strutdp
3235 \fi
3236 \virtualvrule
3237 \s!height \scratchheight
3238 \s!depth \scratchdepth
3239 \s!width .5\onepoint
3240 \relax
3241 \ifdim\scratchdimen>\zeropoint
3242 \raise\dimexpr\strutht\scratchdimen1.5\exheight\relax
3243 \else
3244 \lower\dimexpr\strutdp\scratchdimen1.5\exheight\relax
3245 \fi
3246 \hpack to \zeropoint \bgroup\normalexpanded{
3247 \tinyinfofont
3248 \hpack to \zeropoint\bgroup
3249 \hss
3250 \iftok{\fontspecifiedname\font}{\fontname\font}\else
3251 (\fontspecifiedname\font)
3252 \fi
3253 (\fontname\font)
3254 \kern.5\onepoint
3255 \egroup
3256 \kern\onepoint
3257 (
3258 \ifempty\fontclass.\else\fontclass\fi,
3259 \ifempty\fontstyle.\else\fontstyle\fi,
3260 \fontbody
3261 )
3262 (
3263 \ifnum\glyphscale =\plusthousand .\else\the\glyphscale \fi,
3264 \ifnum\glyphxscale=\plusthousand .\else\the\glyphxscale\fi,
3265 \ifnum\glyphyscale=\plusthousand .\else\the\glyphyscale\fi
3266 )
3267 (
3268 \ifnum\glyphslant =\zerocount .\else\the\glyphslant \fi,
3269 \ifnum\glyphweight=\zerocount .\else\the\glyphweight\fi
3270 )
3271 (\toscaled\xtextface,\toscaled\xxtextface)\hss
3272 }
3273 \egroup
3274 \stopcolor
3275 \egroup
3276 \smashbox\scratchbox
3277 \box\scratchbox
3278 \egroup}
3279
3280\protect \endinput
3281 |