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