1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Font Macros Initial Loading}
15
16\unprotect
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\let\m_font_fallback_name\empty
43
44
45
46
47
48
49
50
51\def\font_preload_check_mode
52 {\doifelsemode{lmmath}
53 {\def\m_font_fallback_name{moderndesignsizevirtual}}
54 {\def\m_font_fallback_name{moderndesignsize}}
55 \glet\font_preload_check_mode\relax}
56
57\def\font_preload_default_fonts
58 {\font_preloads_reset
59 \font_preload_check_mode
60 \setupbodyfont[\m_font_fallback_name,\fontstyle,\fontbody]
61 \showmessage\m!fonts6{fallback \m_font_fallback_name\space \fontstyle\normalspace\normalizedbodyfontsize}}
62
63\def\font_preload_default_fonts_mm
64 {\font_preload_check_mode
65 \writestatus\m!fonts{preloading \m_font_fallback_name\space (math)}
66 \definetypeface[\fontclass][\s!mm][\s!math][\m_font_fallback_name][\s!default]
67 \showmessage\m!fonts6{fallback \m_font_fallback_name\space mm \normalizedbodyfontsize}}
68
69\def\font_preload_default_fonts_tt
70 {\font_preload_check_mode
71 \writestatus\m!fonts{preloading \m_font_fallback_name\space (mono)}
72 \definetypeface[\fontclass][\s!tt][\s!mono][\m_font_fallback_name][\s!default]
73 \showmessage\m!fonts6{fallback \m_font_fallback_name\space tt \normalizedbodyfontsize}}
74
75\def\font_preloads_reset
76 {\glet\font_preload_default_fonts \relax
77
78
79 \glet\font_preloads_zero_stage \relax
80 \glet\font_preloads_first_stage \relax
81 \glet\font_preloads_second_stage \relax
82
83 \glet\fourthstagepreloadfonts \relax
84 \global\everyhbox\emptytoks
85 \global\everyvbox\emptytoks
86
87 \clf_resetnullfont}
88
89\appendtoks
90 \font_preloads_reset
91\to \everystartnotext
92
93\def\font_preloads_reset_checked
94 {\glet\font_preload_default_fonts_tt\relax
95 \glet\font_preload_default_fonts_mm\relax
96 \glet\font_preloads_third_stage \relax
97
98 }
99
100\def\font_preloads_zero_stage_indeed
101 {\definedfont[\s!file:lmmono10regular sa 1]}
102
103\unexpanded\def\font_preloads_zero_stage
104 {\writestatus\m!fonts{beware: no fonts are loaded yet, using lm mono in box}
105 \glet\font_preloads_zero_stage\font_preloads_zero_stage_indeed
106 \font_preloads_zero_stage}
107
108\unexpanded\def\font_preloads_first_stage
109 {\doifelsemode{*preloadfonts}
110 {\font_preload_default_fonts
111 \writestatus\m!fonts{preloading latin modern fonts (first stage)}}
112 {\writestatus\m!fonts{latin modern fonts are not preloaded}}}
113
114\unexpanded\def\font_preloads_second_stage
115 {\writestatus\m!fonts{preloading latin modern fonts (second stage)}
116 \font_preload_default_fonts}
117
118\unexpanded\def\font_preloads_third_stage
119 {\ifx\fontclass\empty
120 \writestatus\m!fonts{preloading latin modern fonts (third stage)}
121 \font_preload_default_fonts
122 \font_preloads_reset
123 \else
124 \font_preloads_reset
125 \push_macro_fontstyle
126 \ifcsname\??fontclass\fontclass\s!mm\s!features\endcsname \else
127 \font_preload_default_fonts_mm
128 \fi
129 \ifcsname\??fontclass\fontclass\s!tt\s!features\endcsname \else
130 \font_preload_default_fonts_tt
131 \fi
132 \pop_macro_fontstyle
133 \font_preloads_reset_checked
134 \setupbodyfont[\fontstyle]
135 \fi}
136
137\unexpanded\def\font_preloads_fourth_stage
138 {\begingroup
139
140 \setbox\scratchbox\hpack{\tf c o n t e x t}
141 \ifzeropt\wd\scratchbox
142 \writeline
143 \writestatus\m!fonts{!! No bodyfont has been defined and no defaults have been}
144 \writestatus\m!fonts{!! loaded (maybe due to a missing \string\starttext).}
145 \writeline
146 \fi
147 \font_preloads_reset
148 \endgroup}
149
150\appendtoks
151 \everyhbox{\font_preloads_zero_stage}
152 \everyvbox{\font_preloads_zero_stage}
153\to \everydump
154
155\unexpanded\def\font_preloads_at_every_job {\font_preloads_first_stage }
156\unexpanded\def\font_preloads_at_start_text{\font_preloads_second_stage}
157\unexpanded\def\font_preloads_at_stop_text {\font_preloads_fourth_stage}
158\unexpanded\def\font_preloads_at_definition{\font_preloads_third_stage
159 \glet\font_preloads_at_definition\relax}
160
161
162
163
164\protect \endinput
165 |