1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16\writestatus{loading}{ConTeXt Typesetting Macros Text Hacks}
17
18\unprotect
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
61
62
63
64
65
66
67
68
69
70
71
72
73\newbox\b_typo_normalizers
74
75\def\typo_normalizers_size#axis#size
76 {\dimexpr\ifdim#1\b_typo_normalizers=\zeropoint
77 \bodyfontsize
78 \else
79 \luaexpr{\number\dimexpr10pt\relax*\number\dimexpr#size\relax/\number#axis\b_typo_normalizers}\scaledpoint
80 \fi\relax}
81
82\def\typo_normalizers_font_at_size#axis#cs#text#size#font
83 {\begingroup
84 \setbox\b_typo_normalizers\hbox{\definedfont[#font at 10pt]\settrialtypesetting#text}
85 \normalexpanded{\endgroup\enforced\edef\noexpand\normalizedfontsize{\the\typo_normalizers_size{#axis}{#size}}}
86 \definefont[\strippedcsname#cs][#font at \normalizedfontsize]}
87
88\protected\def\typo_normalizers_text_at_size#axis#font#size#text
89 {\dontleavehmode
90 \begingroup
91 \setbox\b_typo_normalizers\hbox{\definedfont[#font at 10pt]\settrialtypesetting#text}
92 \definedfont[#font at \the\typo_normalizers_size{#axis}{#size}]#text
93 \endgroup}
94
95\mutable\def\normalizedfontsize{\bodyfontsize}
96
97\permanent\protected\def\normalizetextwidth {\typo_normalizers_text_at_size\wd}
98\permanent\protected\def\normalizetextheight{\typo_normalizers_text_at_size\ht}
99\permanent\protected\def\normalizetextdepth {\typo_normalizers_text_at_size\dp}
100\permanent\protected\def\normalizetextline {\typo_normalizers_text_at_size\htdp}
101
102\permanent\protected\def\normalizefontwidth {\typo_normalizers_font_at_size\wd}
103\permanent\protected\def\normalizefontheight{\typo_normalizers_font_at_size\ht}
104\permanent\protected\def\normalizefontdepth {\typo_normalizers_font_at_size\dp}
105\permanent\protected\def\normalizefontline {\typo_normalizers_font_at_size\htdp}
106
107\permanent\protected\def\widthspanningtext #text#size#specification{\hbox{\normalizefontwidth \temp{#text}{#size}{#specification}\temp#text}}
108\permanent\protected\def\heightspanningtext#text#size#specification{\hbox{\normalizefontheight\temp{#text}{#size}{#specification}\temp#text}}
109\permanent\protected\def\depthspanningtext #text#size#specification{\hbox{\normalizefontdepth \temp{#text}{#size}{#specification}\temp#text}}
110\permanent\protected\def\linespanningtext #text#size#specification{\hbox{\normalizefontline \temp{#text}{#size}{#specification}\temp#text}}
111
112
113
114\aliased\let\NormalizeFontHeight \normalizefontheight
115\aliased\let\NormalizeFontWidth \normalizefontwidth
116\aliased\let\NormalizeTextHeight \normalizetextheight
117\aliased\let\NormalizeTextWidth \normalizetextwidth
118
119\aliased\let\WidthSpanningText \widthspanningtext
120
121\permanent\def\TheNormalizedFontSize{\normalizedfontsize}
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\setnewconstant\vulgarfractionmethod\plusthree
157
158\definehspace[\v!vulgarfraction][.25em]
159\definesymbol[\v!vulgarfraction][]
160
161\permanent\protected\def\vulgarfraction#1#2
162 {\dontleavehmode
163 \hbox
164 {\def\vulgarfraction{vulgarfraction}
165 \ifcase\vulgarfractionmethod
166 #1\symbol[\v!vulgarfraction]#2
167 \or
168 \high{\tx#1\kern\hspaceamount\empty\v!vulgarfraction}
169 \symbol[\vulgarfraction]
170 \low {\kern\hspaceamount\empty\v!vulgarfraction\tx#2}
171 \or
172 \high{\tx#1}
173 \hbox to \zeropoint{\hss\symbol[\v!vulgarfraction]\hss}
174 \low{\tx#2}
175 \or
176 \setbox0\hbox{\symbol[\vulgarfraction]}
177 \setbox2\hbox{\txx57}
178 \raise\ht0\hbox{\lower\ht2\hbox{\txx#1}}
179 \hbox to \zeropoint{\hss\symbol[\v!vulgarfraction]\hss}
180 \lower\dp0\hbox{\raise\dp2\hbox{\txx#2}}
181 \fi}}
182
183\ifdefined\vfrac \else \let\vfrac\vulgarfraction \fi
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199\permanent\tolerant\protected\def\startnicelyfilledbox[#S#1]
200 {\vbox\bgroup
201 \forgetall
202 \letdummyparameter\c!width \hsize
203 \letdummyparameter\c!height\vsize
204 \letdummyparameter\c!offset\exheight
205 \letdummyparameter\c!strut \v!yes
206 \getdummyparameters[#1]
207 \scratchoffset\dummyparameter\c!offset\relax
208 \setbox\scratchbox\vbox to \dummyparameter\c!height \bgroup
209 \hsize\dummyparameter\c!width\relax
210 \emergencystretch10\scratchoffset
211 \parfillskip\zeroskip
212 \parfillleftskip\zeroskip
213 \leftskip \scratchoffset
214 \rightskip\scratchoffset}
215
216\permanent\protected\def\stopnicelyfilledbox
217 {\egroup
218 \vbox to \dummyparameter\c!height \bgroup
219 \ifcstok{\dummyparameter\c!strut}\v!yes
220 \dorecurse{\boxlines\scratchbox}
221 {\boxlineht\scratchbox\recurselevel\strutht
222 \boxlinedp\scratchbox\recurselevel\strutdp
223 \boxline\scratchbox\recurselevel
224 \vss}
225 \else
226 \dorecurse{\boxlines\scratchbox}
227 {\boxline\scratchbox\recurselevel
228 \vss}
229 \fi
230 \unskip
231 \egroup
232 \egroup}
233
234\protect \endinput
235 |