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\writestatus{loading}{ConTeXt Font Macros Initialization}
50
51
52
53
54\unprotect
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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\fontslantperpoint \nullfont 0\scaledpoint
308\fontinterwordspace \nullfont 256377\scaledpoint
309\fontinterwordstretch\nullfont 128188\scaledpoint
310\fontinterwordshrink \nullfont 85459\scaledpoint
311\fontexheight \nullfont 338952\scaledpoint
312\fontemwidth \nullfont 786432\scaledpoint
313\fontextraspace \nullfont 85459\scaledpoint
314
315\appendtoks
316 \fontslantperpoint \nullfont 0\scaledpoint
317 \fontinterwordspace \nullfont 256377\scaledpoint
318 \fontinterwordstretch\nullfont 128188\scaledpoint
319 \fontinterwordshrink \nullfont 85459\scaledpoint
320 \fontexheight \nullfont 338952\scaledpoint
321 \fontemwidth \nullfont 786432\scaledpoint
322 \fontextraspace \nullfont 85459\scaledpoint
323\to \everyjob
324
325
326
327\newtoks\t_font_tracers_definitions
328
329\unexpanded\def\tracefontdefinitions
330 {\the\t_font_tracers_definitions}
331
332
333
334\unexpanded\def\setfontparameters
335 {\setfalse\c_font_synchronize
336 \the\everybodyfont
337 \settrue\c_font_synchronize}
338
339\let\savedfont\empty
340
341\installmacrostack\savedfont
342
343\unexpanded\def\savefont
344 {\edef\savedfont{\the\font}
345 \push_macro_savedfont}
346
347\unexpanded\def\restorefont
348 {\pop_macro_savedfont
349 \savedfont}
350
351\unexpanded\def\pushcurrentfont
352 {\edef\popcurrentfont
353 {\def\noexpand\fontbody {\fontbody}
354 \def\noexpand\fontstyle {\fontstyle}
355 \def\noexpand\fontalternative{\fontalternative}
356 \def\noexpand\fontsize {\fontsize}
357 \font_helpers_check_big_math_synchronization
358 \font_helpers_synchronize_font}}
359
360
361
362\let\thedefinedfont\relax
363
364\unexpanded\def\definedfont
365 {\doifelsenextoptionalcs\font_basics_defined_font_yes\font_basics_defined_font_nop}
366
367\def\font_basics_defined_font_yes[#specification]
368 {\c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly
369 \font_basics_define_font_without_parameters{thedefinedfont}{#specification}
370 \thedefinedfont
371 \the\everydefinedfont}
372
373\def\font_basics_defined_font_nop
374 {\c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly
375 \thedefinedfont
376 \the\everydefinedfont}
377
378
379
380\unexpanded\def\startfont{\begingroup\definedfont}
381\unexpanded\def\stopfont {\endgroup}
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403\ifdefined\globalbodyfontsize\else \newdimen\globalbodyfontsize \fi \globalbodyfontsize=12pt
404\ifdefined\localbodyfontsize \else \newdimen\localbodyfontsize \fi \localbodyfontsize =\globalbodyfontsize
405\ifdefined\bodyfontsize \else \newdimen\bodyfontsize \fi \bodyfontsize =\globalbodyfontsize
406
407
408
409
410
411
412
413
414\installcorenamespace{fontnormalizedbody}
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431\def\normalizebodyfontsize#macro#body
432 {\expandafter\let\expandafter#macro\csname\??fontnormalizedbody\number\dimexpr#body\endcsname
433 \ifx#macro\relax
434 \normalizebodyfontsize_indeed#macro{#body}
435 \fi}
436
437\def\normalizebodyfontsize_indeed#macro#body
438 {\edef#macro{\clf_nbfs\dimexpr#body\relax}
439 \expandafter\glet\csname\??fontnormalizedbody\number\dimexpr#body\endcsname#macro}
440
441\def\thenormalizedbodyfontsize#body
442 {\clf_nbfs\dimexpr#body\relax}
443
444\edef\normalizedglobalbodyfontsize{\thenormalizedbodyfontsize\bodyfontsize}
445\edef\normalizedlocalbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize}
446\edef\normalizedbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize}
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475\installcorenamespace{mappedfontsize}
476
477\unexpanded\def\mapfontsize
478 {\dodoubleargument\font_basics_map_fontsize}
479
480\def\font_basics_map_fontsize[#from][#to]
481 {\setvalue{\??mappedfontsize\the\dimexpr#from\relax}{#to}}
482
483\def\font_basics_set_mapped_fontsize#from
484 {\ifcsname\??mappedfontsize\the\dimexpr#from\relax\endcsname
485 \lastnamedcs\else#from
486 \fi}
487
488\installcorenamespace{fontbodyknown}
489\installcorenamespace{fontclassyes}
490\installcorenamespace{fontclassnop}
491
492\def\font_helpers_process_relative_size_list#command
493 {#command\v!big
494 #command\v!small}
495
496\let\v_font_size_relative \plusone
497\def\v_font_size_absolute {\fontbody}
498
499\let\v_font_rscale_default\!!plusone
500\let\p_font_rscale \v_font_rscale_default
501
502\def\font_helpers_check_relative_font_id
503 {\let\p_font_rscale\minusone
504 \let\p_font_rscale\v_font_rscale_default}
505
506\def\font_helpers_check_relative_font_size#style
507 {\edef\p_font_rscale
508 {\ifcsname\??fontclass\fontclass#style\s!rscale\endcsname
509 \lastnamedcs
510 \else\ifcsname\??fontclass\defaultfontclass#style\s!rscale\endcsname
511 \lastnamedcs
512 \else
513 \v_font_rscale_default
514 \fi\fi}
515
516 \ifx\p_font_rscale\v!auto
517 \let\p_font_rscale\plusone
518 \font_helpers_check_relative_font_id
519 \else
520 \let\relativefontid\minusone
521 \fi}
522
523\def\font_rscale_xx#style
524 {\ifcsname\??fontclass\fontclass#style\s!rscale\endcsname
525 \lastnamedcs
526 \else
527 \v_font_rscale_default
528 \fi}
529
530\def\font_rscale_mm
531 {\ifcsname\??fontclass\fontclass\s!mm\s!rscale\endcsname
532 \lastnamedcs
533 \else
534 \v_font_rscale_default
535 \fi}
536
537\def\font_helpers_register_fontbody#body
538 {\expandafter\let\csname\??fontbodyknown#body\endcsname\empty}
539
540
541
542
543
544
545
546
547
548
549
550
551
552\installcorenamespace{fontstyle}
553\installcorenamespace{fontshortstyle}
554
555\installcorenamespace{fontstyleknown}
556\installcorenamespace{fontalternativeknown}
557\installcorenamespace{fontsizeknown}
558
559\newtoks\t_font_style_commands
560\newtoks\t_font_size_commands
561\newtoks\t_font_alternative_commands
562
563\setnewmacro\m_font_style_command \gobbleoneargument
564\setnewmacro\m_font_size_command \gobbleoneargument
565\setnewmacro\m_font_alternative_command\gobbleoneargument
566
567\def\font_helpers_process_style_list #command{\def\m_font_style_command {#command}\the\t_font_style_commands}
568\def\font_helpers_process_size_list #command{\def\m_font_size_command {#command}\the\t_font_size_commands}
569\def\font_helpers_process_alternative_list#command{\def\m_font_alternative_command{#command}\the\t_font_alternative_commands}
570
571\def\font_helpers_register_style #style{\expandafter\let\csname\??fontstyleknown #style\endcsname\empty}
572\def\font_helpers_register_size #size{\expandafter\let\csname\??fontsizeknown #size\endcsname\empty}
573\def\font_helpers_register_alternative#alternative{\expandafter\let\csname\??fontalternativeknown#alternative\endcsname\empty}
574
575\unexpanded\def\definefontstyle
576 {\dodoubleargument\font_basics_define_fontstyle}
577
578\def\font_basics_define_fontstyle[#commands][#style]
579 {\ifcsname\??fontstyleknown#style\endcsname \else
580 \font_helpers_register_style{#style}
581 \toksapp\t_font_style_commands{\m_font_style_command{#style}}
582 \fi
583 \processcommalist[#commands]{\font_basics_define_fontstyle_indeed{#style}}}
584
585\def\font_basics_define_fontstyle_indeed#style#command
586 {\setvalue{\??fontshortstyle#command}{#style}
587 \setvalue{\??fontstyle #command}{\csname#style\endcsname}}
588
589\unexpanded\def\definefontsize[#size]
590 {\ifcsname\??fontsizeknown#size\endcsname \else
591 \font_helpers_register_size{#size}
592 \toksapp\t_font_size_commands{\m_font_size_command{#size}}
593 \fi
594 \font_helpers_check_fontname_combinations}
595
596\unexpanded\def\definefontalternative[#alternative]
597 {\ifcsname\??fontalternativeknown#alternative\endcsname \else
598 \font_helpers_register_alternative{#alternative}
599 \toksapp\t_font_alternative_commands{\m_font_alternative_command{#alternative}}
600 \fi
601 \font_helpers_check_fontname_combinations}
602
603\unexpanded\def\font_helpers_check_fontname_combinations
604 {\font_helpers_process_style_list\font_helpers_check_fontname_combinations_s}
605
606\def\font_helpers_check_fontname_combinations_s#style
607 {\font_helpers_process_alternative_list{\font_helpers_check_fontname_combinations_indeed_s_a{#style}}}
608
609\def\font_helpers_check_fontname_combinations_indeed_s_a#style#alternative
610 {\font_helpers_process_size_list{\font_basics_check_fontname_combination{#style}{#alternative}}}
611
612\definefontstyle [\s!mm] [\s!mm]
613\definefontstyle [\s!rm] [\s!rm]
614\definefontstyle [\s!ss] [\s!ss]
615\definefontstyle [\s!tt] [\s!tt]
616
617
618
619
620
621
622
623
624\newmacro\m_font_mm
625
626\def\font_basics_check_fontname_combination#style
627 {\edef\m_font_mm{#style}
628 \ifx\m_font_mm\s!mm
629 \expandafter\font_basics_check_math_bodyfont
630 \else
631 \expandafter\font_basics_check_text_bodyfont
632 \fi{#style}}
633
634
635
636
637
638\def\font_basics_check_math_bodyfont#style#alternative#size
639 {}
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689\def\font_basics_check_text_bodyfont_step#whatever#body
690 {\ifcsname#whatever\endcsname\else
691 \setugvalue{#whatever}{#body}
692 \fi}
693
694\def\font_basics_check_text_bodyfont#style#alternative#size
695 {\font_basics_check_text_bodyfont_step{#style#size}{\font_helpers_set_current_font_style_size{#style}{#size}}
696 \font_basics_check_text_bodyfont_step{#alternative#size}{\font_helpers_set_current_font_alternative_size{#alternative}{#size}}
697 \font_basics_check_text_bodyfont_step{#style#alternative#size}{\font_helpers_set_current_font_style_alternative_size{#style}{#alternative}{#size}}
698 \font_basics_check_text_bodyfont_step{#style}{\font_helpers_set_current_font_style{#style}}
699 \font_basics_check_text_bodyfont_step{#alternative}{\font_helpers_set_current_font_alternative{#alternative}}
700 \font_basics_check_text_bodyfont_step{#style\s!x }{\font_helpers_set_current_font_x_style_alternative{#style}}
701 \font_basics_check_text_bodyfont_step{#style\s!xx}{\font_helpers_set_current_font_xx_style_alternative{#style}}
702 \font_basics_check_text_bodyfont_step{#alternative\s!x }{\font_helpers_set_current_font_x_alternative{#alternative}}
703 \font_basics_check_text_bodyfont_step{#alternative\s!xx}{\font_helpers_set_current_font_xx_alternative{#alternative}}
704 \font_basics_check_text_bodyfont_step{#style#alternative}{\font_helpers_set_current_font_style_alternative{#style}{#alternative}}}
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735\def\safontscale{\number\dimexpr\v_font_size_absolute\relax}
736\def\mofontscale{\number\dimexpr\font_basics_set_mapped_fontsize\v_font_size_absolute\relax}
737
738\let\somefontname\s!unknown
739\let\somefontspec\s!unknown
740\let\somefontsize\zerocount
741
742\newcount\scaledfontmode
743\newcount\scaledfontsize
744\newcount\lastfontid
745\newtoks \everydefinefont
746
747\let\relativefontid\minusone
748
749\let\c_font_feature_inheritance_fontnone \zerocount
750\let\c_font_feature_inheritance_fontonly \plusone
751\let\c_font_feature_inheritance_classonly \plustwo
752\let\c_font_feature_inheritance_fontfirst \plusthree
753\let\c_font_feature_inheritance_classfirst\plusfour
754
755\let\c_font_feature_inheritance_default \c_font_feature_inheritance_fontfirst
756
757\setnewconstant\c_font_feature_inheritance_mode \c_font_feature_inheritance_default
758
759\newdimen \d_font_scaled_text_face
760\newdimen \d_font_scaled_font_size
761\newconditional\c_font_body_scale
762\newfraction \f_font_body_scale
763
764\unexpanded\def\font_helpers_low_level_define#specification#csname
765 {
766 \glet\somefontname\defaultfontfile
767 \let\somefontsize\empty
768 \clf_definefont_one{\detokenize\expandafter{\normalexpanded{#specification}}}
769
770 \ifcase\fontface\relax
771
772 \or
773 \let\v_font_size_absolute\textface
774 \or
775 \let\v_font_size_absolute\scriptface
776 \or
777 \let\v_font_size_absolute\scriptscriptface
778 \or
779 \let\v_font_size_absolute\xtextface
780 \or
781 \let\v_font_size_absolute\xxtextface
782 \fi
783
784 \ifcase\scaledfontmode\relax
785
786 \d_font_scaled_font_size\plusthousand\scaledpoint
787 \or
788
789 \d_font_scaled_font_size\somefontsize
790 \or
791
792 \d_font_scaled_font_size\v_font_size_absolute\relax
793 \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size
794 \or
795
796 \d_font_scaled_font_size\font_basics_set_mapped_fontsize\v_font_size_absolute
797 \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size
798 \or
799
800 \d_font_scaled_font_size\somefontsize\scaledpoint
801 \else
802
803 \d_font_scaled_font_size\somefontsize
804 \fi
805 \relax
806 \d_font_scaled_font_size\v_font_size_relative\d_font_scaled_font_size
807 \ifconditional\c_font_auto_size
808 \font_helpers_check_body_scale\fontsize
809 \ifconditional\c_font_body_scale
810 \d_font_scaled_font_size\f_font_body_scale\d_font_scaled_font_size
811 \d_font_scaled_text_face\f_font_body_scale\dimexpr\textface\relax
812 \else
813 \d_font_scaled_font_size\f_font_body_scale
814 \d_font_scaled_text_face\textface
815 \fi
816 \else
817 \d_font_scaled_text_face\textface
818 \fi
819 \edef\somefontspec{at \number\d_font_scaled_font_size sp}
820 \edef\somefontfile{\truefontname\somefontname}
821 \ifx\somefontfile\s!unknown
822 \edef\somefontfile{\defaultfontfile}
823 \fi
824 \font_helpers_update_font_parameters
825 \font_helpers_update_font_class_parameters
826
827 \clf_definefont_two
828 \ifx\fontclass\empty\s!false\else\s!true\fi
829 {#csname}
830 {\somefontfile}
831 \d_font_scaled_font_size
832 \c_font_feature_inheritance_mode
833 {\m_font_class_features}
834 {\m_font_features}
835 {\m_font_class_fallbacks}
836 {\m_font_fallbacks}
837 \fontface
838 \d_font_scaled_text_face
839 \relativefontid
840 {\m_font_class_goodies}
841 {\m_font_goodies}
842 {\m_font_class_designsize}
843 {\m_font_designsize}
844 \scaledfontmode
845 \relax
846 \ifcase\scaledfontsize
847
848 \let\somefontspec\empty
849 \let\lastrawfontcall\relax
850 \expandafter\let\csname#csname\endcsname\relax
851 \else
852 \edef\somefontspec{at \number\scaledfontsize sp}
853 \expandafter\let\expandafter\lastrawfontcall\csname#csname\endcsname
854 \the\everydefinefont
855 \fi
856 \c_font_feature_inheritance_mode\c_font_feature_inheritance_default}
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876\def\font_helpers_check_body_scale#fontsize
877 {\ifcsname\??fontenvironments\fontclass\fontbody#fontsize\endcsname
878 \expandafter\let\expandafter\f_font_body_scale\lastnamedcs
879 \setfalse\c_font_body_scale
880 \else\ifcsname\??fontenvironments\fontclass\s!default#fontsize\endcsname
881 \expandafter\let\expandafter\f_font_body_scale\lastnamedcs
882 \settrue\c_font_body_scale
883 \else\ifcsname\??fontenvironments\fontbody#fontsize\endcsname
884 \expandafter\let\expandafter\f_font_body_scale\lastnamedcs
885 \setfalse\c_font_body_scale
886 \else\ifcsname\??fontenvironments\s!default#fontsize\endcsname
887 \expandafter\let\expandafter\f_font_body_scale\lastnamedcs
888 \settrue\c_font_body_scale
889 \else\ifcsname\??fontenvironments\fontclass\s!default\s!text\endcsname
890 \expandafter\let\expandafter\f_font_body_scale\lastnamedcs
891 \settrue\c_font_body_scale
892 \else\ifcsname\??fontenvironments\s!default\s!text\endcsname
893 \expandafter\let\expandafter\f_font_body_scale\lastnamedcs
894 \settrue\c_font_body_scale
895 \else
896 \let\f_font_body_scale\plusone
897 \settrue\c_font_body_scale
898 \fi\fi\fi\fi\fi\fi}
899
900
901
902
903
904
905
906
907
908\newif\ifskipfontcharacteristics \skipfontcharacteristicstrue
909
910\tracingfonts\plussix
911
912
913
914
915\let\fontfile\s!unknown
916
917
918
919\installcorenamespace{fonts}
920\installcorenamespace{fontslanguage}
921
922\installsetuponlycommandhandler \??fonts {fonts}
923
924\newconstant\c_fonts_auto_language
925
926\letvalue{\??fontslanguage\v!auto}\plusone
927
928
929\appendtoks
930 \c_fonts_auto_language
931 \ifcsname\??fontslanguage\fontsparameter\c!language\endcsname
932 \lastnamedcs
933 \else
934 \zerocount
935 \fi
936\to \everysetupfonts
937
938\appendtoks
939 \ifcase\c_fonts_auto_language
940
941 \or
942 \addfflanguage
943
944
945 \fi
946\to \everylanguage
947
948
949
950
951
952
953
954\ifdefined\everyfont \else \newtoks\everyfont \fi
955\ifdefined\everyfontswitch \else \newtoks\everyfontswitch \fi
956
957\def\setfontcharacteristics{\the\everyfont}
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985\unexpanded\def\definefont
986 {\dotripleempty\font_basics_define_font}
987
988\def\font_basics_define_font
989 {\ifthirdargument
990 \expandafter\font_basics_define_font_a
991 \else
992 \expandafter\font_basics_define_font_b
993 \fi}
994
995\def\font_basics_define_font_a[#name][#specification][#settings]
996 {\doifelsesetups{#settings}
997 {\setuvalue{#name}{\font_basics_define_font_with_setups {#name}{#specification}{#settings}}}
998 {\setuvalue{#name}{\font_basics_define_font_with_parameters{#name}{#specification}{#settings}}}}
999
1000\def\font_basics_define_font_b[#name][#specification][#dummy]
1001 {\setuvalue{#name}{\font_basics_define_font_without_parameters{#name}{#specification}}}
1002
1003\def\font_basics_define_font_with_parameters#name#specification#settings
1004 {\font_basics_define_font_without_parameters{#name}{#specification}
1005 \setuplocalinterlinespace[#settings]
1006 \setupspacing\relax}
1007
1008\def\font_basics_define_font_with_setups#name#specification#settings
1009 {\font_basics_define_font_without_parameters{#name}{#specification}
1010 \setups[#settings]}
1011
1012
1013
1014
1015\unexpanded\def\definefrozenfont
1016 {\dotripleempty\font_basics_define_frozen_font}
1017
1018
1019
1020
1021
1022
1023
1024\def\font_basics_define_frozen_font[#name][#specification][#settings]
1025 {\begingroup
1026 \font_basics_define_font[#name][#specification][#settings]
1027 \csname#name\endcsname
1028 \glet\lastglobalrawfontcall\lastrawfontcall
1029 \endgroup
1030 \expandafter\let\csname#name\endcsname\lastglobalrawfontcall}
1031
1032
1033
1034
1035
1036
1037
1038\ifdefined\??fontinstanceready \else \installcorenamespace{fontinstanceready} \fi
1039\ifdefined\??fontinstancebasic \else \installcorenamespace{fontinstancebasic} \fi
1040\ifdefined\??fontinstanceclass \else \installcorenamespace{fontinstanceclass} \fi
1041
1042\newconditional\c_font_auto_size \settrue\c_font_auto_size
1043
1044\let\lastfontidentifier\empty
1045
1046\def\v_font_identifier_basic{\??fontinstancebasic \lastfontidentifier\fontsize\fontface}
1047\def\v_font_identifier_class{\??fontinstanceclass\fontclass\lastfontidentifier\fontsize\fontface}
1048
1049\let\v_font_identifier_basic_saved\v_font_identifier_basic
1050\let\v_font_identifier_class_saved\v_font_identifier_class
1051
1052
1053
1054\def\font_basics_define_font_without_parameters#identifier#2
1055 {\c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly
1056 \edef\lastfontidentifier{#identifier}
1057 \let\v_font_size_relative\v_font_rscale_default
1058 \let\v_font_size_absolute\fontbody
1059 \font_helpers_low_level_define{#2}\v_font_identifier_basic
1060 \csname\v_font_identifier_basic\endcsname
1061 \setfalse\c_font_auto_size
1062 \setfontcharacteristics
1063 \the\everyfontswitch
1064 \let\v_font_identifier_basic\v_font_identifier_basic_saved}
1065
1066\unexpanded\def\font_helpers_trigger#identifier
1067 {\edef\lastfontidentifier{#identifier}
1068 \ifcsname\v_font_identifier_class\endcsname
1069
1070 \expandafter\font_helpers_trigger_reuse
1071 \else
1072
1073 \expandafter\font_helpers_trigger_define
1074 \fi}
1075
1076\def\font_helpers_trigger_define#relative#absolute#specification
1077 {\def\v_font_size_relative{#relative}
1078 \def\v_font_size_absolute{#absolute}
1079 \font_helpers_low_level_define{#specification}\v_font_identifier_class
1080 \csname\v_font_identifier_class\endcsname
1081 \setfalse\c_font_auto_size
1082 \ifskipfontcharacteristics \else
1083 \setfontcharacteristics
1084 \the\everyfontswitch
1085 \fi
1086 \let\v_font_identifier_class\v_font_identifier_class_saved}
1087
1088\def\font_helpers_trigger_reuse#relative#absolute#specification
1089 {\csname\v_font_identifier_class\endcsname
1090 \setfalse\c_font_auto_size
1091 \ifskipfontcharacteristics \else
1092 \setfontcharacteristics
1093 \the\everyfontswitch
1094 \fi
1095 \let\v_font_identifier_class\v_font_identifier_class_saved}
1096
1097
1098
1099
1100
1101
1102
1103
1104\installcorenamespace{fontenvironments}
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128\def\currentfontbodysize
1129 {\ifcsname\??fontenvironments\fontclass\s!default\somefontsize\endcsname
1130 \lastnamedcs
1131 \else\ifcsname\??fontenvironments\s!default\somefontsize\endcsname
1132 \lastnamedcs
1133 \else
1134 \somefontsize
1135 \fi\fi}
1136
1137\def\currentfontbodyscale
1138 {\csname\??fontenvironments
1139 \ifcsname\??fontenvironments\fontclass\s!default\fontsize\endcsname\fontclass\s!default\fontsize\else
1140 \ifcsname\??fontenvironments \s!default\fontsize\endcsname \s!default\fontsize\else
1141 \ifcsname\??fontenvironments\fontclass\s!default\s!text \endcsname\fontclass\s!default\s!text \else
1142 \ifcsname\??fontenvironments \s!default\s!text \endcsname \s!default\s!text \else
1143 \s!default \fi\fi\fi\fi
1144 \endcsname}
1145
1146\def\font_currentfontbodyscale
1147 {\ifcsname\??fontenvironments\fontclass\s!default\fontsize\endcsname\lastnamedcs\else
1148 \ifcsname\??fontenvironments \s!default\fontsize\endcsname\lastnamedcs\else
1149 \ifcsname\??fontenvironments\fontclass\s!default\s!text \endcsname\lastnamedcs\else
1150 \ifcsname\??fontenvironments \s!default\s!text \endcsname\lastnamedcs\else
1151 \csname\??fontenvironments \s!default \endcsname \fi\fi\fi\fi}
1152
1153\def\currentfontscale
1154 {\csname\??fontenvironments
1155 \ifcsname\??fontenvironments\fontclass\s!default\xfontsize\endcsname\fontclass\s!default\fontsize\else
1156 \ifcsname\??fontenvironments \s!default\xfontsize\endcsname \s!default\fontsize\else
1157 \ifcsname\??fontenvironments\fontclass\s!default\s!text \endcsname\fontclass\s!default\s!text \else
1158 \ifcsname\??fontenvironments \s!default\s!text \endcsname \s!default\s!text \else
1159 \s!default \fi\fi\fi\fi
1160 \endcsname}
1161
1162\def\font_currentfontscale
1163 {\ifcsname\??fontenvironments\fontclass\s!default\xfontsize\endcsname\lastnamedcs\else
1164 \ifcsname\??fontenvironments \s!default\xfontsize\endcsname\lastnamedcs\else
1165 \ifcsname\??fontenvironments\fontclass\s!default\s!text \endcsname\lastnamedcs\else
1166 \ifcsname\??fontenvironments \s!default\s!text \endcsname\lastnamedcs\else
1167 \csname\??fontenvironments \s!default \endcsname \fi\fi\fi\fi}
1168
1169\setvalue{\??fontenvironments\s!default}{1}
1170
1171
1172
1173
1174
1175\newconstant\currentxfontsize
1176
1177\def\xfontsize{\ifcase\currentxfontsize\fontsize\or\s!x\else\s!xx\fi}
1178
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
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264\letvalue\??fontenvironments\empty
1265
1266\def\bodyfontvariable#parameter
1267 {\csname\??fontenvironments
1268 \ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname\fontclass\normalizedbodyfontsize#parameter\else
1269 \ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter\else
1270 \ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname \normalizedbodyfontsize#parameter\else
1271 \ifcsname\??fontenvironments\s!default #parameter\endcsname\s!default #parameter\fi\fi\fi\fi
1272 \endcsname}
1273
1274\def\font_bodyfontvariable#parameter
1275 {\ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname\lastnamedcs\else
1276 \ifcsname\??fontenvironments\fontclass #parameter\endcsname\lastnamedcs\else
1277 \ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname\lastnamedcs\else
1278 \ifcsname\??fontenvironments\s!default #parameter\endcsname\lastnamedcs\fi\fi\fi\fi}
1279
1280\def\bodyfontsizevariable#size#parameter
1281 {\csname\??fontenvironments
1282 \ifcsname\??fontenvironments\fontclass#size#parameter\endcsname\fontclass#size#parameter\else
1283 \ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter\else
1284 \ifcsname\??fontenvironments #size#parameter\endcsname #size#parameter\else
1285 \ifcsname\??fontenvironments\s!default #parameter\endcsname\s!default #parameter\fi\fi\fi\fi
1286 \endcsname}
1287
1288\def\font_bodyfontsizevariable#size#parameter
1289 {\ifcsname\??fontenvironments\fontclass#size#parameter\endcsname\lastnamedcs\else
1290 \ifcsname\??fontenvironments\fontclass #parameter\endcsname\lastnamedcs\else
1291 \ifcsname\??fontenvironments #size#parameter\endcsname\lastnamedcs\else
1292 \ifcsname\??fontenvironments\s!default #parameter\endcsname\lastnamedcs\fi\fi\fi\fi}
1293
1294\def\bodyfontinterlinespace{\bodyfontvariable\c!interlinespace}
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307\def\bodyfontdimension#class#size#parameter#body
1308 {\the\dimexpr
1309 \ifcsname\??fontenvironments #class#size#parameter\endcsname \lastnamedcs \else
1310 \ifcsname\??fontenvironments#class\s!default#parameter\endcsname \lastnamedcs\dimexpr#body\relax\else
1311 \ifcsname\??fontenvironments #size#parameter\endcsname \lastnamedcs \else
1312 \lastnamedcs\dimexpr#body\relax\fi\fi\fi
1313 \relax}
1314
1315\unexpanded\def\definebodyfontenvironment
1316 {\dotripleempty\font_basics_define_body_font_environment}
1317
1318\let\setupbodyfontenvironment\definebodyfontenvironment
1319
1320\installcorenamespace{fontenvironmentknown}
1321
1322\def\font_helpers_register_environment#class#body
1323 {\expandafter\let\csname\??fontenvironmentknown#class#body\endcsname\empty}
1324
1325\newmacro\m_font_body
1326\newmacro\m_font_body_normalized
1327
1328\def\font_basics_define_body_font_environment
1329 {\ifthirdargument
1330 \singleexpandafter\font_basics_define_body_font_environment_class
1331 \else\ifsecondargument
1332 \doubleexpandafter\font_basics_define_body_font_environment_empty
1333 \else
1334 \doubleexpandafter\font_basics_define_body_font_environment_unset
1335 \fi\fi}
1336
1337
1338
1339
1340
1341\def\processbodyfontenvironmentlist#1
1342 {\clf_processbodyfontsizes{\strippedcsname#1}}
1343
1344\def\bodyfontenvironmentlist
1345 {\clf_getbodyfontsizes}
1346
1347\def\font_basics_define_body_font_environment_class[#class][#body][#settings]
1348 {\edef\m_font_body{#body}
1349 \ifx\m_font_body\s!default
1350
1351 \getrawparameters[\??fontenvironments#class\s!default][#settings]
1352 \else
1353 \normalizebodyfontsize\m_font_body_normalized\m_font_body
1354 \font_basics_define_body_font_environment_size[#class][\m_font_body_normalized][#settings]
1355 \clf_registerbodyfontsize{\m_font_body_normalized}
1356 \fi}
1357
1358
1359
1360
1361\def\font_basics_define_body_font_environment_empty[#body][#settings][#dummy]
1362 {\push_macro_fontclass
1363 \let\fontclass\empty
1364 \font_basics_define_body_font_environment_class[][#body][#settings]
1365 \pop_macro_fontclass}
1366
1367\def\font_basics_define_body_font_environment_unset[#body][#dummya][#dummyb]
1368 {\push_macro_fontclass
1369 \let\fontclass\empty
1370 \font_basics_define_body_font_environment_class[][#body][]
1371 \pop_macro_fontclass}
1372
1373
1374
1375\newconditional\c_font_defining_environment_state
1376
1377\def\font_basics_define_body_font_environment_size[#class][#normalizedbody][#settings]
1378 {\getrawparameters[\??fontenvironments#class#normalizedbody][#settings]
1379 \ifcsname\??fontenvironmentknown#class#normalizedbody\endcsname
1380
1381 \else\ifproductionrun
1382 \push_macro_fontclass
1383 \edef\fontclass{#class}
1384 \font_helpers_register_environment{#class}{#normalizedbody}
1385 \settrue\c_font_defining_environment_state
1386 \font_helpers_define_unknown_font{#normalizedbody}
1387 \setfalse\c_font_defining_environment_state
1388 \pop_macro_fontclass
1389 \fi\fi
1390 \font_helpers_register_fontbody{#normalizedbody}}
1391
1392
1393
1394\def\font_helpers_check_bodyfont_environment#normalizedbody#body
1395 {\ifcsname\??fontenvironmentknown\fontclass#normalizedbody\endcsname
1396
1397 \else
1398 \font_helpers_check_bodyfont_environment_indeed{#normalizedbody}{#body}
1399 \fi}
1400
1401\def\font_helpers_check_bodyfont_environment_indeed#normalizedbody#body
1402 {\font_helpers_register_environment\fontclass{#normalizedbody}
1403 \ifcsname\??fontbodyknown#normalizedbody\endcsname
1404 \else
1405 \font_helpers_define_unknown_font{#normalizedbody}
1406 \fi}
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\installcorenamespace{fontdefinitions}
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494\unexpanded\def\definebodyfont
1495 {\doquadrupleempty\font_basics_define_body_font}
1496
1497\def\font_basics_define_body_font[#1][#2][#3][#4]
1498 {\iffourthargument
1499 \processcommacommand[#1]{\font_basics_define_body_font_class_given[#2][#3][#4]}
1500 \else
1501 \font_basics_define_body_font_class_known[#1][#2][#3]
1502 \fi}
1503
1504\def\font_basics_define_body_font_class_given[#1][#2][#3]#4
1505 {\push_macro_fontclass
1506 \doifelse{#4}\s!default
1507 {\let\fontclass\empty}
1508 {\def\fontclass{#4}}
1509 \definebodyfont[#1][#2][#3]
1510 \pop_macro_fontclass}
1511
1512\def\font_basics_define_body_font_class_known
1513 {\ifthirdargument
1514 \singleexpandafter\font_basics_define_body_font_a
1515 \else\ifsecondargument
1516 \doubleexpandafter\font_basics_define_body_font_b
1517 \else
1518 \doubleexpandafter\font_basics_define_body_font_c
1519 \fi\fi}
1520
1521\unexpanded\def\font_basics_define_body_font_b[#whatever][#specification][#dummy]
1522 {\font_basics_define_body_font_a[#whatever][\s!rm][#specification]}
1523
1524\unexpanded\def\font_basics_define_body_font_c[#whatever][#dummya][#dummyb]
1525 {\font_basics_define_body_font_a[#whatever][\s!rm][]}
1526
1527\unexpanded\def\font_basics_define_body_font_a[#whatever]
1528 {\doifelsenumber{#whatever}
1529 \font_basics_define_body_font_body
1530 \font_basics_define_body_font_name
1531 [#whatever]}
1532
1533
1534
1535
1536
1537
1538
1539\unexpanded\def\font_basics_define_body_font_body[#body][#style][#specification]
1540 {\ifcondition\validassignment{#specification}
1541 \expandafter\font_basics_define_body_font_body_assignment
1542 \else
1543 \expandafter\font_basics_define_body_font_body_identifier
1544 \fi
1545 [#body][#style][#specification]}
1546
1547
1548
1549
1550
1551
1552
1553\unexpanded\def\font_basics_define_body_font_name[#name][#style][#specification]
1554 {\ifcondition\validassignment{#specification}
1555 \expandafter\font_basics_define_body_font_name_assignment
1556 \else
1557 \expandafter\font_basics_define_body_font_name_identifier
1558 \fi
1559 [#name][#style][#specification]}
1560
1561\unexpanded\def\font_basics_define_body_font_body_assignment[#bodylist][#stylelist][#assignments]
1562 {\processcommalist[#bodylist]{\font_basics_define_body_font_body_assignment_a{#stylelist}{#assignments}}}
1563
1564\unexpanded\def\font_basics_define_body_font_body_assignment_a#stylelist#assignments#body
1565 {\normalizebodyfontsize\m_font_asked_body{#body}
1566
1567 \font_helpers_check_bodyfont_environment\m_font_asked_body\m_font_asked_body
1568 \processcommalist[#stylelist]{\font_basics_define_body_font_body_assignment_b{#assignments}}}
1569
1570\unexpanded\def\font_basics_define_body_font_body_assignment_b#assignments#style
1571 {\edef\m_font_asked_style{#style}
1572 \processcommalist[#assignments]\font_basics_define_body_font_defs}
1573
1574\unexpanded\def\font_basics_define_body_font_defs
1575 {\ifx\fontclass\empty
1576 \expandafter\font_basics_define_body_font_defs_nop
1577 \else
1578 \expandafter\font_basics_define_body_font_defs_yes
1579 \fi}
1580
1581\unexpanded\def\font_basics_define_body_font_defs_yes_normal#assignment
1582 {\ifx\m_font_asked_style\s!mm
1583 \expandafter\font_basics_define_body_font_yes_mm
1584 \else
1585 \expandafter\font_basics_define_body_font_yes_xx
1586 \fi[#assignment]}
1587
1588\unexpanded\def\font_basics_define_body_font_defs_nop_normal#assignment
1589 {\ifx\m_font_asked_style\s!mm
1590 \expandafter\font_basics_define_body_font_nop_mm
1591 \else
1592 \expandafter\font_basics_define_body_font_nop_xx
1593 \fi[#assignment]}
1594
1595\unexpanded\def\font_basics_define_body_font_defs_yes_traced#assignment
1596 {\writestatus\m!fonts{[\fontclass] [\m_font_asked_body] [\m_font_asked_style] [#assignment]}
1597 \ifx\m_font_asked_style\s!mm
1598 \expandafter\font_basics_define_body_font_yes_mm
1599 \else
1600 \expandafter\font_basics_define_body_font_yes_xx
1601 \fi[#assignment]}
1602
1603\unexpanded\def\font_basics_define_body_font_defs_nop_traced#assignment
1604 {\writestatus\m!fonts{[\fontclass] [\m_font_asked_body] [\m_font_asked_style] [#assignment]}
1605 \ifx\m_font_asked_style\s!mm
1606 \expandafter\font_basics_define_body_font_nop_mm
1607 \else
1608 \expandafter\font_basics_define_body_font_nop_xx
1609 \fi[#assignment]}
1610
1611\let\font_basics_define_body_font_defs_yes\font_basics_define_body_font_defs_yes_normal
1612\let\font_basics_define_body_font_defs_nop\font_basics_define_body_font_defs_nop_normal
1613
1614\appendtoks
1615 \let\font_basics_define_body_font_defs_yes\font_basics_define_body_font_defs_yes_traced
1616 \let\font_basics_define_body_font_defs_nop\font_basics_define_body_font_defs_nop_traced
1617\to \t_font_tracers_definitions
1618
1619
1620
1621
1622
1623\unexpanded\def\font_basics_define_body_font_nop_xx[#one#two#rest=#value]
1624 {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
1625 \expandafter\let\csname\??fontinstanceclass\m_font_asked_body\m_font_asked_style#one#two#rest0\endcsname\undefined
1626 \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body\m_font_asked_style#one#two#rest0\endcsname
1627 {\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}}}
1628 \expandafter\let\csname\??fontinstanceclass\m_font_asked_body\m_font_asked_style#one#two#rest4\endcsname\undefined
1629 \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body\m_font_asked_style#one#two#rest4\endcsname
1630 {\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}}}
1631 \expandafter\let\csname\??fontinstanceclass\m_font_asked_body\m_font_asked_style#one#two#rest5\endcsname\undefined
1632 \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body\m_font_asked_style#one#two#rest5\endcsname
1633 {\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}}}
1634 }
1635
1636\unexpanded\def\font_basics_define_body_font_yes_xx[#one#two#rest=#value]
1637 {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
1638 \expandafter\glet\csname\??fontinstanceclass\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest1\endcsname\undefined
1639 \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest0\endcsname
1640 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest0}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1641 \expandafter\glet\csname\??fontinstanceclass\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest2\endcsname\undefined
1642 \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest4\endcsname
1643 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest4}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1644 \expandafter\glet\csname\??fontinstanceclass\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest3\endcsname\undefined
1645 \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest5\endcsname
1646 {\font_helpers_trigger{\m_font_asked_body\m_font_asked_style#one#two#rest5}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1647 }
1648
1649
1650
1651
1652
1653
1654\unexpanded\def\font_basics_define_body_font_nop_mm[#one#two#rest=#value]
1655 {
1656 \expandafter\let\csname\??fontinstanceclass\m_font_asked_body\s!mm#one#two#rest1\endcsname\undefined
1657
1658
1659 \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body\s!mm#one#two#rest\endcsname
1660 {\font_helpers_trigger{\m_font_asked_body\s!mm#one#two#rest}{\noexpand\font_rscale_mm}{\m_font_asked_body}{\normalunexpanded{#value}}}
1661 }
1662
1663
1664
1665\unexpanded\def\font_basics_define_body_font_yes_mm[#one#two#rest=#value]
1666 {
1667 \expandafter\glet\csname\??fontinstanceclass\fontclass\m_font_asked_body\s!mm#one#two#rest1\endcsname\undefined
1668
1669
1670 \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass\m_font_asked_body\s!mm#one#two#rest\endcsname
1671 {\font_helpers_trigger{\m_font_asked_body\s!mm#one#two#rest}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}
1672 }
1673
1674
1675
1676\unexpanded\def\font_basics_define_body_font_body_identifier[#bodylist][#stylelist][#name]
1677 {\processcommalist[#bodylist]{\font_basics_define_body_font_body_identifier_a{#stylelist}{#name}}}
1678
1679\unexpanded\def\font_basics_define_body_font_body_identifier_a#stylelist#name#body
1680 {\normalizebodyfontsize\m_font_asked_body{#body}
1681 \font_helpers_check_bodyfont_environment\m_font_asked_body\m_font_asked_body
1682 \processcommalist[#stylelist]{\font_basics_define_body_font_body_identifier_b{#name}}}
1683
1684\unexpanded\def\font_basics_define_body_font_body_identifier_b#name#style
1685 {\edef\m_font_asked_style{#style}
1686
1687 \csname\??fontdefinitions#name:\m_font_asked_style\endcsname}
1688
1689\unexpanded\def\font_basics_define_body_font_name_assignment[#name][#stylelist][#assignments]
1690 {\processcommalist[#stylelist]{\font_basics_define_body_font_name_assignment_a{#name}{#assignments}}}
1691
1692\unexpanded\def\font_basics_define_body_font_name_assignment_a#name#assignments#style
1693 {
1694 \setevalue{\??fontdefinitions#name:#style}{\font_basics_define_body_font_default{#assignments}}}
1695
1696\unexpanded\def\font_basics_define_body_font_name_identifier[#name][#stylelist][#identifier]
1697 {\processcommalist[#stylelist]{\font_basics_define_body_font_name_identifier_a{#name}{#identifier}}}
1698
1699\unexpanded\def\font_basics_define_body_font_name_identifier_a#name#identifier#style
1700 {
1701 \ifcsname\??fontdefinitions#name:#style\endcsname
1702 \expandafter\let\csname\??fontdefinitions#name:#style\expandafter\endcsname\csname\??fontdefinitions#identifier:#style\endcsname
1703 \else
1704 \expandafter\def\csname\??fontdefinitions#name:#style\endcsname{\csname\??fontdefinitions#identifier:#style\endcsname}
1705 \fi}
1706
1707
1708
1709\newconditional\c_font_defining_unknown
1710\newconditional\c_font_defining_state
1711
1712\unexpanded\def\font_helpers_define_unknown_font#body
1713 {\font_helpers_register_fontbody{#body}
1714 \setfalse\c_font_defining_state
1715 \font_helpers_process_relative_size_list{\font_helpers_define_unknown_check_sizes{#body}}
1716 \ifconditional\c_font_defining_state
1717 \setfalse\c_font_defining_state
1718 \font_helpers_process_style_list{\font_helpers_define_unknown_check_definitions{#body}}
1719 \ifconditional\c_font_defining_state
1720 \ifconditional\c_font_defining_environment_state\else
1721
1722 \clf_registerunknownbodysize{#body}
1723 \fi
1724 \setfalse\c_font_defining_state
1725 \font_helpers_register_fontbody{#body}
1726
1727 \ifconditional\c_font_defining_unknown
1728 \else
1729 \settrue\c_font_defining_unknown
1730 \font_helpers_process_relative_size_list{\font_helpers_define_unknown_check_relatives{#body}}
1731 \setfalse\c_font_defining_unknown
1732 \fi
1733 \fi
1734 \fi}
1735
1736\def\font_helpers_define_unknown_check_sizes#body#relativesize
1737 {\ifcsname\??fontenvironments\s!default#relativesize\endcsname
1738 \expandafter\normalizebodyfontsize\csname\??fontenvironments#body#relativesize\endcsname{\csname\??fontenvironments\s!default#relativesize\endcsname\dimexpr#body\relax}
1739 \settrue\c_font_defining_state
1740 \fi}
1741
1742\def\font_helpers_define_unknown_check_definitions#body#style
1743 {\ifcsname\??fontdefinitions\s!default:#style\endcsname
1744 \edef\m_font_asked_body{#body}
1745 \edef\m_font_asked_style{#style}
1746 \lastnamedcs
1747 \settrue\c_font_defining_state
1748 \fi}
1749
1750
1751
1752
1753
1754
1755
1756
1757\def\font_helpers_define_unknown_check_relatives#body#relativesize
1758 {\ifcsname\??fontbodyknown\csname\??fontenvironments#body#relativesize\endcsname\endcsname \else
1759 \expandafter\font_helpers_define_unknown_font\csname\??fontenvironments#body#relativesize\endcsname
1760 \settrue\c_font_defining_state
1761 \fi}
1762
1763\unexpanded\def\font_basics_define_body_font_default#assignments
1764 {\font_helpers_check_relative_font_size\m_font_asked_style
1765 \ifcsname\m_font_asked_style\endcsname\else
1766 \normalexpanded{\definefontstyle[\m_font_asked_style][\m_font_asked_style]}
1767 \fi
1768 \processcommalist[#assignments]\font_basics_define_body_font_defs
1769 \let\p_font_rscale\v_font_rscale_default}
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788\unexpanded\def\font_basics_switch_points#body
1789 {\ifcsname\??fontbodyknown#body\endcsname \else
1790
1791 \font_helpers_define_unknown_font{#body}
1792 \fi
1793 \ifcsname\??fontbodyknown#body\endcsname
1794 \font_basics_complete_switch{#body}
1795 \localbodyfontsize#body\relax
1796 \normalizebodyfontsize\normalizedbodyfontsize\localbodyfontsize
1797 \font_helpers_check_bodyfont_environment\normalizedbodyfontsize\normalizedbodyfontsize
1798 \else
1799 \showmessage\m!fonts4{#body}
1800 \fi}
1801
1802\unexpanded\def\font_basics_switch_style#style
1803 {\ifcsname\??fontstyle#style\endcsname
1804 \lastnamedcs
1805 \edef\fontstyle{#style}
1806 \ifmmode\mr\fi
1807
1808 \else
1809 \showmessage\m!fonts5{#style}
1810 \fi}
1811
1812
1813
1814
1815\ifdefined\font_preloads_at_definition \else \let\font_preloads_at_definition\relax \fi
1816
1817\def\font_helpers_set_font#method#specification
1818 {\edef\m_font_specification{#specification}
1819 \ifx\m_font_specification\empty \else
1820 \ifx\m_font_specification\v!global
1821 \restoreglobalbodyfont
1822 \else
1823 \processcommacommand[\m_font_specification]{\font_helpers_set_font_check_size}
1824 \processcommacommand[\m_font_specification]{\font_helpers_set_font_set_font{#method}}
1825 \ifproductionrun
1826 \font_preloads_at_definition
1827 \font_basics_switch_points\normalizedbodyfontsize
1828 \font_basics_switch_style\fontstyle
1829 \ifx\defaultfontclass\empty
1830 \let\defaultfontclass\fontclass
1831 \fi
1832 \fi
1833 \fi
1834 \currentxfontsize\zerocount
1835 \fi}
1836
1837\def\font_helpers_set_font_check_size#option
1838 {\doifelsenumber{#option}{\font_helpers_check_bodyfont_environment{#option}{#option}}\donothing}
1839
1840\def\font_helpers_set_font_set_font#method#option
1841 {\doifsomething{#option}{\font_helpers_set_font_set_font_option{#method}{#option}}}
1842
1843\def\font_helpers_set_font_set_font_option#method#option
1844 {\doifelsenumber{#option}
1845 \font_helpers_set_font_set_font_option_body
1846 \font_helpers_set_font_set_font_option_keyword
1847 {#method}{#option}{#option}}
1848
1849\newmacro\m_font_keyword
1850
1851\unexpanded\def\font_helpers_set_font_set_font_option_keyword#method#keyword#message
1852 {\edef\m_font_keyword{#keyword}
1853 \ifcsname\??fontenvironments\normalizedbodyfontsize\m_font_keyword\endcsname
1854 \edef\m_font_step{\font_bodyfontvariable\m_font_keyword}
1855 \normalexpanded{\font_helpers_set_font_set_font_option_body{#method}{\m_font_step}{#message}}
1856 \else\ifx\m_font_keyword\v!reset
1857 \let\fontstyle\empty
1858 \let\fontsize \empty
1859 \else\ifcsname\??fontstyle\m_font_keyword\endcsname
1860 \let\fontstyle\m_font_keyword
1861 \else
1862 \setcurrentfontclass\m_font_keyword
1863 \ifcase#method\relax
1864 \let\globalfontclass\globalfontclass
1865 \else
1866 \let\globalfontclass\fontclass
1867 \fi
1868 \font_helpers_set_fontstyle_of_fontclass
1869 \fi\fi\fi}
1870
1871\def\font_helpers_set_fontstyle_of_fontclass
1872 {\let\fontstyle\s!rm}
1873
1874\unexpanded\def\font_helpers_set_font_set_font_option_body#method#body#message
1875 {\normalizebodyfontsize\normalizedsetfont{#body}
1876 \ifcsname\??fontbodyknown\normalizedsetfont\endcsname \else
1877 \font_helpers_define_unknown_font\normalizedsetfont
1878 \fi
1879 \ifcsname\??fontbodyknown\normalizedsetfont\endcsname
1880 \localbodyfontsize\normalizedsetfont
1881 \let\normalizedbodyfontsize\normalizedsetfont
1882 \else
1883 \showmessage\m!fonts4{#message}
1884
1885 \fi}
1886
1887
1888
1889\def\registerfontclass#class
1890 {\letgvalue{\??fontclassyes#class}\v!yes}
1891
1892\def\setcurrentfontclass#class
1893 {\ifcsname\??fontclassyes#class\endcsname
1894 \edef\fontclass{#class}
1895 \else\ifcsname\??fontclassnop#class\endcsname
1896
1897 \else
1898 \trycurrentfontclass{#class}
1899 \fi\fi}
1900
1901\ifdefined\trycurrentfontclass \else
1902
1903 \unexpanded\def\trycurrentfontclass#typeface
1904 {\letvalueempty{\??fontclassnop#typeface}}
1905
1906\fi
1907
1908\let\defaultfontstyle \s!rm
1909\let\defaultfontalternative\s!tf
1910\let\defaultfontsize \empty
1911\let\defaultfontface \!!zerocount
1912
1913
1914
1915\unexpanded\def\setcurrentfont#body#style#alternative#size
1916 {\edef\fontbody {#body}
1917 \edef\fontstyle {#style}
1918 \edef\fontalternative{#alternative}
1919 \edef\fontsize {#size}
1920 \font_helpers_check_big_math_synchronization
1921 \font_helpers_synchronize_font}
1922
1923\unexpanded\def\setcurrentfontbody#body
1924 {\edef\fontbody{#body}
1925 \font_helpers_synchronize_font}
1926
1927
1928
1929\ifdefined\font_typescripts_inherit_check \else
1930 \let\font_typescripts_inherit_check\gobbleoneargument
1931\fi
1932
1933\unexpanded\def\font_helpers_set_current_font_style#style
1934 {\edef\fontstyle{#style}
1935 \font_typescripts_inherit_check\fontstyle
1936 \ifmmode\mr\fi
1937 \font_helpers_synchronize_font}
1938
1939\unexpanded\def\font_helpers_set_current_xsize_alternative#xsize#alternative
1940 {\edef\fontface{#xsize}
1941 \edef\fontalternative{#alternative}
1942 \font_helpers_synchronize_font}
1943
1944\unexpanded\def\font_helpers_set_current_font_alternative#alternative
1945 {\edef\fontalternative{#alternative}
1946 \font_helpers_synchronize_font}
1947
1948\unexpanded\def\font_helpers_set_current_font_size#size
1949 {\edef\fontsize{#size}
1950 \font_helpers_check_big_math_synchronization
1951 \font_helpers_synchronize_font}
1952
1953\unexpanded\def\font_helpers_set_current_font_style_alternative#style#alternative
1954 {\edef\fontstyle {#style}
1955 \edef\fontalternative{#alternative}
1956 \font_helpers_synchronize_font}
1957
1958\unexpanded\def\font_helpers_set_current_font_style_size#style#size
1959 {\edef\fontstyle{#style}
1960 \edef\fontsize {#size}
1961 \font_helpers_check_big_math_synchronization
1962 \font_helpers_synchronize_font}
1963
1964\unexpanded\def\font_helpers_set_current_font_alternative_size#alternative#size
1965 {\edef\fontalternative{#alternative}
1966 \edef\fontsize {#size}
1967 \font_helpers_check_big_math_synchronization
1968 \font_helpers_synchronize_font}
1969
1970\unexpanded\def\font_helpers_set_current_font_style_alternative_size#style#alternative#size
1971 {\edef\fontstyle {#style}
1972 \edef\fontalternative{#alternative}
1973 \edef\fontsize {#size}
1974 \font_helpers_check_big_math_synchronization
1975 \font_helpers_synchronize_font}
1976
1977\unexpanded\def\font_helpers_synchronize_font
1978 {\ifx\fontclass\empty
1979 \applyfontstrategies
1980 \else
1981 \applyfontclassstrategies
1982 \fi
1983 \setfalse\c_font_auto_size
1984 \ifskipfontcharacteristics
1985 \setfontcharacteristics
1986 \the\everyfontswitch
1987 \fi}
1988
1989
1990
1991
1992\def\font_helpers_check_strategy_class_a
1993 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\fontalternative\fontsize\fontface\endcsname
1994 \setfalse\c_font_auto_size
1995 \lastnamedcs
1996 \else
1997 \expandafter\font_helpers_check_strategy_class_b
1998 \fi}
1999
2000\def\font_helpers_check_strategy_class_b
2001 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\fontalternative\defaultfontsize\fontface\endcsname
2002 \settrue\c_font_auto_size
2003 \lastnamedcs
2004 \else
2005 \expandafter\font_helpers_check_strategy_class_c
2006 \fi}
2007
2008\def\font_helpers_check_strategy_class_c
2009 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\defaultfontalternative\fontsize\fontface\endcsname
2010 \settrue\c_font_auto_size
2011 \lastnamedcs
2012 \else
2013 \expandafter\font_helpers_check_strategy_class_d
2014 \fi}
2015
2016\def\font_helpers_check_strategy_class_d
2017 {\ifcsname\??fontinstanceready\fontclass\fontbody\fontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2018 \settrue\c_font_auto_size
2019 \lastnamedcs
2020 \else
2021 \expandafter\font_helpers_check_strategy_class_e
2022 \fi}
2023
2024\def\font_helpers_check_strategy_class_e
2025 {\ifcsname\??fontinstanceready\fontclass\fontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2026 \setfalse\c_font_auto_size
2027 \lastnamedcs
2028 \else
2029 \expandafter\font_helpers_check_strategy_class_f
2030 \fi}
2031
2032\def\font_helpers_check_strategy_class_f
2033 {\ifcsname\??fontinstanceready\fontclass\defaultfontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2034 \settrue\c_font_auto_size
2035 \lastnamedcs
2036 \else
2037 \expandafter\font_helpers_check_strategy_a
2038 \fi}
2039
2040
2041
2042\def\font_helpers_check_strategy_a
2043 {\ifcsname\??fontinstanceready\fontbody\fontstyle\fontalternative\fontsize\fontface\endcsname
2044 \setfalse\c_font_auto_size
2045 \lastnamedcs
2046 \else
2047 \expandafter\font_helpers_check_strategy_b
2048 \fi}
2049
2050\def\font_helpers_check_strategy_b
2051 {\ifcsname\??fontinstanceready\fontbody\fontstyle\fontalternative\defaultfontsize\fontface\endcsname
2052 \settrue\c_font_auto_size
2053 \lastnamedcs
2054 \else
2055 \expandafter\font_helpers_check_strategy_c
2056 \fi}
2057
2058\def\font_helpers_check_strategy_c
2059 {\ifcsname\??fontinstanceready\fontbody\fontstyle\defaultfontalternative\fontsize\fontface\endcsname
2060 \settrue\c_font_auto_size
2061 \lastnamedcs
2062 \else
2063 \expandafter\font_helpers_check_strategy_d
2064 \fi}
2065
2066\def\font_helpers_check_strategy_d
2067 {\ifcsname\??fontinstanceready\fontbody\fontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2068 \settrue\c_font_auto_size
2069 \lastnamedcs
2070 \else
2071 \expandafter\font_helpers_check_strategy_e
2072 \fi}
2073
2074\def\font_helpers_check_strategy_e
2075 {\ifcsname\??fontinstanceready\fontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2076 \setfalse\c_font_auto_size
2077 \lastnamedcs
2078 \else
2079 \expandafter\font_helpers_check_strategy_f
2080 \fi}
2081
2082\def\font_helpers_check_strategy_f
2083 {\ifcsname\??fontinstanceready\defaultfontbody\defaultfontstyle\defaultfontalternative\defaultfontsize\fontface\endcsname
2084 \settrue\c_font_auto_size
2085 \lastnamedcs
2086 \fi}
2087
2088\let\applyfontstrategies \font_helpers_check_strategy_a
2089\let\applyfontclassstrategies\font_helpers_check_strategy_class_a
2090
2091
2092
2093\newconditional\c_font_synchronize \settrue\c_font_synchronize
2094
2095\prependtoks
2096 \ifconditional\c_font_synchronize
2097 \font_helpers_synchronize_math
2098 \font_helpers_synchronize_font
2099 \fi
2100\to \everybodyfont
2101
2102
2103
2104
2105
2106
2107
2108\def\font_helpers_set_current_font_xxx_alternative#alternative#xsize#scriptstyle
2109 {\ifmmode
2110 #scriptstyle
2111 \else
2112 \font_helpers_set_current_xsize_alternative{#xsize}{#alternative}
2113 \fi}
2114
2115\def\font_helpers_reset_x_fontsize
2116 {\ifcase\currentxfontsize\else
2117 \currentxfontsize\zerocount
2118
2119 \let\tx \normaltx
2120 \let\txx\normaltxx
2121 \fi}
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132\let\font_helpers_check_nested_x_fontsize\relax
2133
2134\def\font_helpers_set_current_font_x_alternative#alternative
2135 {\font_helpers_check_nested_x_fontsize
2136 \font_helpers_set_current_font_xxx_alternative{#alternative}{4}\scriptstyle
2137 \currentxfontsize\plusone
2138 \let\tx\txx}
2139
2140\def\font_helpers_set_current_font_xx_alternative#alternative
2141 {\font_helpers_check_nested_x_fontsize
2142 \font_helpers_set_current_font_xxx_alternative{#alternative}{5}\scriptscriptstyle
2143 \currentxfontsize\plustwo
2144 \let\tx\empty
2145 \let\txx\empty}
2146
2147
2148
2149
2150\def\font_helpers_set_current_font_x_style_alternative #alternative{\csname#alternative\endcsname\tx}
2151\def\font_helpers_set_current_font_xx_style_alternative#alternative{\csname#alternative\endcsname\txx}
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198\installcorenamespace{fontscalex}
2199\installcorenamespace{fontscalexx}
2200
2201\newconditional\c_font_inherit_scale
2202
2203\def\font_scale_inherit#1
2204 {\begingroup
2205 \scratchcounterone\fontid\font\relax
2206 \currentxfontsize\plusone
2207 \normalexpanded{\definedfont[\clf_specifiedfont\scratchcounterone\font_currentfontscale\relax]}
2208 \scratchcountertwo\fontid\font\relax
2209 \currentxfontsize\plustwo
2210 \normalexpanded{\definedfont[\clf_specifiedfont\scratchcounterone\font_currentfontscale\relax]}
2211 \scratchcounterthree\fontid\font\relax
2212
2213
2214 \global\expandafter\chardef\csname\??fontscalex \number\scratchcounterone\endcsname\scratchcountertwo
2215 \global\expandafter\chardef\csname\??fontscalexx\number\scratchcounterone\endcsname\scratchcounterthree
2216 \global\expandafter\chardef\csname\??fontscalex \number\scratchcountertwo\endcsname\scratchcounterthree
2217 \global\expandafter\chardef\csname\??fontscalexx\number\scratchcountertwo\endcsname\scratchcounterthree
2218 \endgroup
2219 \setfontid\csname#1\number\fontid\font\endcsname}
2220
2221\def\font_scale_inherit_x
2222 {\ifcsname\??fontscalex\number\fontid\font\endcsname
2223 \setfontid\lastnamedcs
2224 \else
2225 \font_scale_inherit\??fontscalex
2226 \fi
2227 \ifskipfontcharacteristics
2228 \setfontcharacteristics
2229 \the\everyfontswitch
2230 \fi}
2231
2232\def\font_scale_inherit_xx
2233 {\ifcsname\??fontscalexx\number\fontid\font\endcsname
2234 \setfontid\lastnamedcs
2235 \else
2236 \font_scale_inherit\??fontscalexx
2237 \fi
2238 \ifskipfontcharacteristics
2239 \setfontcharacteristics
2240 \the\everyfontswitch
2241 \fi}
2242
2243\def\font_scale_defined_x
2244 {\let\fontface\!!plusfour
2245 \let\fontalternative\fontalternative
2246 \font_helpers_synchronize_font}
2247
2248\def\font_scale_defined_xx
2249 {\let\fontface\!!plusfive
2250 \let\fontalternative\fontalternative
2251 \font_helpers_synchronize_font}
2252
2253\unexpanded\def\tx
2254 {\currentxfontsize\plusone
2255 \ifmmode
2256 \scriptstyle
2257 \else\ifconditional\c_font_inherit_scale
2258 \font_scale_inherit_x
2259 \else
2260 \font_scale_defined_x
2261 \fi\fi
2262 \let\tx\txx}
2263
2264\unexpanded\def\txx
2265 {\currentxfontsize\plustwo
2266 \ifmmode
2267 \scriptscriptstyle
2268 \else\ifconditional\c_font_inherit_scale
2269 \font_scale_inherit_xx
2270 \else
2271 \font_scale_defined_xx
2272 \fi\fi
2273 \let\tx \empty
2274 \let\txx\empty}
2275
2276\unexpanded\def\sx
2277 {\currentxfontsize\plusone
2278 \ifmmode
2279 \scriptstyle
2280 \else
2281 \font_scale_inherit_x
2282 \fi
2283 \let\tx\txx
2284 \let\sx\sxx}
2285
2286\unexpanded\def\sxx
2287 {\currentxfontsize\plustwo
2288 \ifmmode
2289 \scriptscriptstyle
2290 \else
2291 \font_scale_inherit_xx
2292 \fi
2293 \let\tx \empty
2294 \let\txx\empty
2295 \let\sx \empty
2296 \let\sxx\empty}
2297
2298\unexpanded\def\useinheritxsizes{\settrue \c_font_inherit_scale}
2299\unexpanded\def\usedefinedxsizes{\setfalse\c_font_inherit_scale}
2300
2301\let\normaltx \tx
2302\let\normaltxx\txx
2303
2304\let\normalsx \sx
2305\let\normalsxx\sxx
2306
2307
2308
2309
2310
2311
2312
2313\def\textface {\currentbodyfontdimension\s!text }
2314\def\scriptface {\currentbodyfontdimension\s!script }
2315\def\scriptscriptface{\currentbodyfontdimension\s!scriptscript}
2316\def\xtextface {\currentbodyfontdimension\s!x }
2317\def\xxtextface {\currentbodyfontdimension\s!xx }
2318
2319
2320
2321
2322
2323
2324
2325
2326\installcorenamespace{fontbodyfaces}
2327
2328\unexpanded\def\font_basics_complete_switch#size
2329 {\bodyfontsize#size\relax
2330 \normalizebodyfontsize\normalizedbodyfontsize\bodyfontsize
2331 \expandafter\let\expandafter\font_basics_set_faces\csname\??fontbodyfaces\fontbody\endcsname
2332 \ifx\font_basics_set_faces\relax
2333 \font_basics_set_faces_preset
2334 \fi
2335 \font_basics_set_faces}
2336
2337\def\font_basics_set_faces_preset
2338 {\edef\font_basics_set_faces{
2339 \noexpand\edef\noexpand\textface {\currentbodyfontdimension\s!text }
2340 \noexpand\edef\noexpand\scriptface {\currentbodyfontdimension\s!script }
2341 \noexpand\edef\noexpand\scriptscriptface{\currentbodyfontdimension\s!scriptscript}
2342 \noexpand\edef\noexpand\xtextface {\currentbodyfontdimension\s!x }
2343 \noexpand\edef\noexpand\xxtextface {\currentbodyfontdimension\s!xx }
2344 }
2345 \expandafter\glet\csname\??fontbodyfaces\fontbody\endcsname\font_basics_set_faces}
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360\def\currentbodyfontdimension#parameter
2361 {\the\dimexpr
2362 \ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname
2363 \lastnamedcs
2364 \else\ifcsname\??fontenvironments\fontclass\s!default#parameter\endcsname
2365 \lastnamedcs
2366 \dimexpr\normalizedbodyfontsize\relax
2367 \else\ifcsname\??fontenvironments\normalizedbodyfontsize#parameter\endcsname
2368 \lastnamedcs
2369 \else
2370 \csname\??fontenvironments\s!default#parameter\endcsname
2371 \dimexpr\normalizedbodyfontsize\relax
2372 \fi\fi\fi
2373 \relax}
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401\ifx\saveinterlinespace \undefined \let\saveinterlinespace \relax \fi
2402\ifx\restoreinterlinespace\undefined \let\restoreinterlinespace\relax \fi
2403
2404
2405
2406
2407\unexpanded\def\setupbodyfont
2408 {\doifelsenextoptionalcs\font_basics_setupbodyfont_yes\font_basics_setupbodyfont_nop}
2409
2410\def\font_basics_setupbodyfont_nop
2411 {\restoreglobalbodyfont
2412 \saveinterlinespace}
2413
2414\def\font_basics_setupbodyfont_yes[#specification]
2415 {\doifsomething{#specification}
2416 {\font_helpers_set_font\plusone{#specification}
2417 \globalbodyfontsize\localbodyfontsize
2418 \normalizebodyfontsize\normalizedglobalbodyfontsize\globalbodyfontsize
2419 \let\globalfontstyle\fontstyle
2420 \ifproductionrun
2421 \the\everybodyfont
2422 \the\everyglobalbodyfont
2423 \saveinterlinespace
2424 \fi
2425 \the\everysetupbodyfont}}
2426
2427\unexpanded\def\font_basics_switchtobodyfont#specification
2428 {\edef\m_font_step{\font_bodyfontvariable{#specification}}
2429 \ifx\m_font_step\empty
2430 \font_helpers_set_font\zerocount{#specification}
2431 \else
2432 \font_helpers_switch_bodyfont_step
2433 \fi
2434 \the\everybodyfont
2435 \the\everyswitchtobodyfont}
2436
2437\unexpanded\def\switchtobodyfont[#specification]
2438 {\doifsomething{#specification}{\font_basics_switchtobodyfont{#specification}}}
2439
2440\unexpanded\def\usebodyfontparameter#1
2441 {\edef\m_font_bodyfont_asked{#1\c!bodyfont}
2442 \ifx\m_font_bodyfont_asked\empty\else
2443 \font_basics_switchtobodyfont\m_font_bodyfont_asked
2444 \fi}
2445
2446\def\font_helpers_switch_bodyfont_step
2447 {\font_basics_switch_points\m_font_step
2448 \font_basics_switch_style \fontstyle}
2449
2450
2451
2452
2453\unexpanded\def\fastswitchtobodyfont#name
2454 {\ifcsname\??fontenvironments\normalizedbodyfontsize#name\endcsname
2455
2456 \edef\futurebodyfontsize{\lastnamedcs}
2457 \ifcsname\??fontbodyknown\futurebodyfontsize\endcsname
2458 \font_basics_complete_switch\futurebodyfontsize
2459 \localbodyfontsize\futurebodyfontsize\relax
2460 \fi
2461 \fi
2462 \csname\??fontstyle\fontstyle\endcsname
2463 \the\everybodyfont}
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500\unexpanded\def\usebodyfont[#1]
2501 {\ifx\fontclass\empty
2502 \setupbodyfont[#1]
2503 \else
2504 \switchtobodyfont[#1]
2505 \fullrestoreglobalbodyfont
2506 \fi}
2507
2508\unexpanded\def\showbodyfontstate
2509 {\dontleavehmode
2510 \start
2511 \infofont
2512 [fontclass: \fontclass,\space
2513 fontbody: \fontbody ,\space
2514 fontface: \fontface ,\space
2515 fontsize: \fontsize ]
2516 \stop}
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536\unexpanded\def\fontchar #character{\clf_fontchar{#character}}
2537\unexpanded\def\fontcharbyindex #index{\clf_fontcharbyindex#index\relax}
2538 \def\tochar #specifications{\clf_tochar{#specifications}}
2539
2540
2541
2542\def\purefontname#font{\clf_purefontname{\fontname#font}}
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556\unexpanded\def\switchstyleonly
2557 {\doifelsenextoptionalcs\font_basics_switch_style_only_opt\font_basics_switch_style_only_arg}
2558
2559\def\font_basics_switch_style_only_arg#name
2560 {\font_helpers_set_current_font_style{\csname\??fontshortstyle\checkedstrippedcsname#name\endcsname}
2561 \the\everybodyfont}
2562
2563\def\font_basics_switch_style_only_opt[#name]
2564 {\font_helpers_set_current_font_style{\csname\??fontshortstyle#name\endcsname}
2565 \the\everybodyfont}
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579\unexpanded\def\definebodyfontswitch
2580 {\dodoubleargument\font_basics_define_bodyfont_switch}
2581
2582\def\font_basics_define_bodyfont_switch[#command][#specification]
2583 {\setvalue{#command}{\switchtobodyfont[#specification]}}
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593\newmacro\m_font_step
2594
2595\def\font_helpers_set_bodyfont_step#step
2596 {\edef\m_font_step{\font_bodyfontvariable{#step}}
2597 \font_basics_switch_points\m_font_step
2598 \font_basics_switch_style \fontstyle}
2599
2600\unexpanded\def\setsmallbodyfont{\font_helpers_set_bodyfont_step\v!small\the\everybodyfont}
2601\unexpanded\def\setbigbodyfont {\font_helpers_set_bodyfont_step\v!big \the\everybodyfont}
2602
2603\unexpanded\def\setmainbodyfont
2604 {\font_basics_switch_points\normalizedbodyfontsize
2605 \font_basics_switch_style\fontstyle
2606 \the\everybodyfont
2607 \the\everyglobalbodyfont
2608 \saveinterlinespace}
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623\let\globalfontstyle\s!rm
2624
2625\unexpanded\def\fullrestoreglobalbodyfont
2626 {\let\fontsize\defaultfontsize
2627 \let\fontbody\defaultfontbody
2628 \let\fontface\defaultfontface
2629 \currentxfontsize\zerocount
2630 \let\fontclass\globalfontclass
2631 \font_basics_switch_points\normalizedglobalbodyfontsize
2632 \font_basics_switch_style\globalfontstyle
2633 \redoconvertfont
2634 \tf
2635 \the\everybodyfont
2636 \the\everyglobalbodyfont
2637 \saveinterlinespace}
2638
2639\unexpanded\def\partialrestoreglobalbodyfont
2640 {\let\fontsize\defaultfontsize
2641 \let\fontbody\defaultfontbody
2642 \let\fontface\defaultfontface
2643 \currentxfontsize\zerocount
2644 \redoconvertfont
2645 \tf
2646 \the\everybodyfont
2647 \the\everyglobalbodyfont
2648 \saveinterlinespace}
2649
2650\unexpanded\def\restoreglobalbodyfont
2651 {\ifx\fontclass\globalfontclass
2652 \ifx\fontstyle\globalfontstyle
2653 \ifx\normalizedbodyfontsize\normalizedglobalbodyfontsize
2654 \partialrestoreglobalbodyfont
2655 \else
2656 \fullrestoreglobalbodyfont
2657 \fi
2658 \else
2659 \fullrestoreglobalbodyfont
2660 \fi
2661 \else
2662 \fullrestoreglobalbodyfont
2663 \fi}
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680\installcorenamespace{predefinedfont}
2681
2682\unexpanded\def\predefinefont[#1]#2[#3]
2683 {\setugvalue{#1}{\font_basics_predefine{#1}{#3}}}
2684
2685\unexpanded\def\predefinedfont[#1]
2686 {\ifcsname\??predefinedfont#1\endcsname
2687 \lastnamedcs
2688 \else
2689 \font_basics_predefined{#1}
2690 \fi}
2691
2692\unexpanded\def\font_basics_predefine#1#2
2693 {\font_basics_defined_font_yes[#2]
2694 \expandafter\glet\csname#1\expandafter\endcsname\csname\v_font_identifier_basic\endcsname}
2695
2696\unexpanded\def\font_basics_predefined#1
2697 {\font_basics_predefine{\??predefinedfont#1}{#1}}
2698
2699
2700
2701\unexpanded\def\savedefinedfont[#1]
2702 {\bgroup
2703 \definedfont[#1]
2704 \xdef\saveddefinedfontid {\number\fontid\font}
2705 \xdef\saveddefinedfontname{\fontname\font}
2706 \egroup}
2707
2708\def\saveddefinedfontid {\number\fontid\font}
2709\def\saveddefinedfontname{\fontname\font}
2710
2711
2712
2713\unexpanded\def\saverunningstyleandcolor
2714 {\unexpanded\edef\restorerunningstyleandcolor
2715 {\setfontid \number\fontid\font
2716 \c_attr_colormodel \the\c_attr_colormodel
2717 \c_attr_color \the\c_attr_color
2718 \c_attr_transparency\the\c_attr_transparency
2719 \relax}}
2720
2721\let\restorerunningstyleandcolor\relax
2722
2723
2724
2725\let\getprivateglyphslot\clf_getprivateglyphslot
2726
2727\let\getprivatechar \clf_getprivatechar
2728\let\getprivatemathchar \clf_getprivatemathchar
2729\let\getprivateslot \clf_getprivateslot
2730
2731
2732
2733
2734\def\privatechar
2735 {\ifmmode
2736 \expandafter\getprivatemathchar
2737 \else
2738 \expandafter\getprivatechar
2739 \fi}
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762\unexpanded\def\definefontcolorpalette
2763 {\dodoubleargument\font_define_color_palette}
2764
2765\def\font_define_color_palette[#1][#2]
2766 {\clf_definefontcolorpalette{#1}{#2}}
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
2795
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
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852\unexpanded\def\usefontpath[#1]
2853 {\clf_addfontpath{#1}}
2854
2855
2856
2857\ifdefined\discretionaryligaturemode
2858 \discretionaryligaturemode\plusone
2859\fi
2860
2861\protect \endinput
2862 |