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
74\newbox\b_typo_normalizers
75
76\def\typo_normalizers_size#axis#size
77 {\dimexpr\ifdim#1\b_typo_normalizers=\zeropoint
78 \bodyfontsize
79 \else
80 \luaexpr{\number\dimexpr10pt\relax*\number\dimexpr#size\relax/\number#axis\b_typo_normalizers}\scaledpoint
81 \fi\relax}
82
83\def\typo_normalizers_font_at_size#axis#cs#text#size#font
84 {\begingroup
85 \setbox\b_typo_normalizers\hbox{\definedfont[#font at 10pt]\settrialtypesetting#text}
86 \normalexpanded{\endgroup\edef\noexpand\normalizedfontsize{\the\typo_normalizers_size{#axis}{#size}}}
87 \definefont[\strippedcsname#cs][#font at \normalizedfontsize]}
88
89\unexpanded\def\typo_normalizers_text_at_size#axis#font#size#text
90 {\dontleavehmode
91 \begingroup
92 \setbox\b_typo_normalizers\hbox{\definedfont[#font at 10pt]\settrialtypesetting#text}
93 \definedfont[#font at \the\typo_normalizers_size{#axis}{#size}]#text
94 \endgroup}
95
96\def\normalizedfontsize{\bodyfontsize}
97
98\unexpanded\def\normalizetextwidth {\typo_normalizers_text_at_size\wd}
99\unexpanded\def\normalizetextheight{\typo_normalizers_text_at_size\ht}
100\unexpanded\def\normalizetextdepth {\typo_normalizers_text_at_size\dp}
101\unexpanded\def\normalizetextline {\typo_normalizers_text_at_size\htdp}
102
103\unexpanded\def\normalizefontwidth {\typo_normalizers_font_at_size\wd}
104\unexpanded\def\normalizefontheight{\typo_normalizers_font_at_size\ht}
105\unexpanded\def\normalizefontdepth {\typo_normalizers_font_at_size\dp}
106\unexpanded\def\normalizefontline {\typo_normalizers_font_at_size\htdp}
107
108\unexpanded\def\widthspanningtext #text#size#specification{\hbox{\normalizefontwidth \temp{#text}{#size}{#specification}\temp#text}}
109\unexpanded\def\heightspanningtext#text#size#specification{\hbox{\normalizefontheight\temp{#text}{#size}{#specification}\temp#text}}
110\unexpanded\def\depthspanningtext #text#size#specification{\hbox{\normalizefontdepth \temp{#text}{#size}{#specification}\temp#text}}
111\unexpanded\def\linespanningtext #text#size#specification{\hbox{\normalizefontline \temp{#text}{#size}{#specification}\temp#text}}
112
113
114
115\let\NormalizeFontHeight \normalizefontheight
116\let\NormalizeFontWidth \normalizefontwidth
117\let\NormalizeTextHeight \normalizetextheight
118\let\NormalizeTextWidth \normalizetextwidth
119
120\let\WidthSpanningText \widthspanningtext
121
122\def\TheNormalizedFontSize{\normalizedfontsize}
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\setnewconstant\vulgarfractionmethod\plusthree
158
159\definehspace[\v!vulgarfraction][.25em]
160\definesymbol[\v!vulgarfraction][]
161
162\unexpanded\def\vulgarfraction#1#2
163 {\dontleavehmode
164 \hbox
165 {\def\vulgarfraction{vulgarfraction}
166 \ifcase\vulgarfractionmethod
167 #1\symbol[\v!vulgarfraction]#2
168 \or
169 \high{\tx#1\kern\hspaceamount\empty\v!vulgarfraction}
170 \symbol[\vulgarfraction]
171 \low {\kern\hspaceamount\empty\v!vulgarfraction\tx#2}
172 \or
173 \high{\tx#1}
174 \hbox to \zeropoint{\hss\symbol[\v!vulgarfraction]\hss}
175 \low{\tx#2}
176 \or
177 \setbox0\hbox{\symbol[\vulgarfraction]}
178 \setbox2\hbox{\txx57}
179 \raise\ht0\hbox{\lower\ht2\hbox{\txx#1}}
180 \hbox to \zeropoint{\hss\symbol[\v!vulgarfraction]\hss}
181 \lower\dp0\hbox{\raise\dp2\hbox{\txx#2}}
182 \fi}}
183
184\ifdefined\vfrac \else \let\vfrac\vulgarfraction \fi
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200\unexpanded\def\startnicelyfilledbox
201 {\vbox\bgroup
202 \forgetall
203 \dosingleempty\dostartnicelyfilledbox}
204
205\def\dostartnicelyfilledbox[#1]
206 {\letdummyparameter\c!width \hsize
207 \letdummyparameter\c!height\vsize
208 \letdummyparameter\c!offset\exheight
209 \letdummyparameter\c!strut \v!yes
210 \getdummyparameters[#1]
211 \scratchoffset\dummyparameter\c!offset\relax
212 \setbox\scratchbox\vbox to \dummyparameter\c!height \bgroup
213 \hsize\dummyparameter\c!width\relax
214 \emergencystretch10\scratchoffset
215 \parfillskip\zeropoint
216 \baselineskip\zeropoint plus \onepoint minus \onepoint
217 \beginofshapebox
218 \leftskip \scratchoffset
219 \rightskip\scratchoffset}
220
221\unexpanded\def\stopnicelyfilledbox
222 {\doifelse{\dummyparameter\c!strut}\v!yes
223 {\xdef\doflushnicelyfilledbox
224 {\ht\shapebox\the\strutht
225 \dp\shapebox\the\strutdp
226 \box\shapebox}}
227 {\gdef\doflushnicelyfilledbox
228 {\box\shapebox}}
229 \endofshapebox
230 \doreshapebox
231 {\doflushnicelyfilledbox}
232 {\penalty\shapepenalty}
233 {\kern\shapekern}
234 {\vfil}
235 \kern\scratchoffset
236 \vfilneg
237 \flushshapebox
238 \vfilneg
239 \kern\scratchoffset
240 \egroup
241 \box\scratchbox
242 \egroup}
243
244\protect \endinput
245 |