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 {\todimension{
77 \ifdim{#axis\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}}
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\enforced\edef\noexpand\normalizedfontsize{\typo_normalizers_size{#axis}{#size}}}
87 \definefont[\strippedcsname#cs][#font at \normalizedfontsize]}
88
89\protected\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 \typo_normalizers_size{#axis}{#size}]#text
94 \endgroup}
95
96\mutable\def\normalizedfontsize{\bodyfontsize}
97
98\permanent\protected\def\normalizetextwidth {\typo_normalizers_text_at_size\wd}
99\permanent\protected\def\normalizetextheight{\typo_normalizers_text_at_size\ht}
100\permanent\protected\def\normalizetextdepth {\typo_normalizers_text_at_size\dp}
101\permanent\protected\def\normalizetextline {\typo_normalizers_text_at_size\htdp}
102
103\permanent\protected\def\normalizefontwidth {\typo_normalizers_font_at_size\wd}
104\permanent\protected\def\normalizefontheight{\typo_normalizers_font_at_size\ht}
105\permanent\protected\def\normalizefontdepth {\typo_normalizers_font_at_size\dp}
106\permanent\protected\def\normalizefontline {\typo_normalizers_font_at_size\htdp}
107
108\permanent\protected\def\widthspanningtext #text#size#specification{\hbox{\normalizefontwidth \temp{#text}{#size}{#specification}\temp#text}}
109\permanent\protected\def\heightspanningtext#text#size#specification{\hbox{\normalizefontheight\temp{#text}{#size}{#specification}\temp#text}}
110\permanent\protected\def\depthspanningtext #text#size#specification{\hbox{\normalizefontdepth \temp{#text}{#size}{#specification}\temp#text}}
111\permanent\protected\def\linespanningtext #text#size#specification{\hbox{\normalizefontline \temp{#text}{#size}{#specification}\temp#text}}
112
113
114
115\aliased\let\NormalizeFontHeight \normalizefontheight
116\aliased\let\NormalizeFontWidth \normalizefontwidth
117\aliased\let\NormalizeTextHeight \normalizetextheight
118\aliased\let\NormalizeTextWidth \normalizetextwidth
119
120\aliased\let\WidthSpanningText \widthspanningtext
121
122\permanent\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\permanent\protected\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\permanent\tolerant\protected\def\startnicelyfilledbox[#S#1]
201 {\vbox\bgroup
202 \forgetall
203 \letdummyparameter\c!width \hsize
204 \letdummyparameter\c!height\vsize
205 \letdummyparameter\c!offset\exheight
206 \letdummyparameter\c!strut \v!yes
207 \getdummyparameters[#1]
208 \scratchoffset{\dummyparameter\c!offset}
209 \setbox\scratchbox\vbox to {\dummyparameter\c!height} \bgroup
210 \hsize{\dummyparameter\c!width}
211 \emergencystretch10\scratchoffset
212 \parfillskip\zeroskip
213 \parfillleftskip\zeroskip
214 \leftskip \scratchoffset
215 \rightskip\scratchoffset}
216
217\permanent\protected\def\stopnicelyfilledbox
218 {\egroup
219 \vbox to {\dummyparameter\c!height} \bgroup
220 \ifcstok{\dummyparameter\c!strut}\v!yes
221 \dorecurse{\boxlines\scratchbox}
222 {\boxlineht\scratchbox\recurselevel\strutht
223 \boxlinedp\scratchbox\recurselevel\strutdp
224 \boxline\scratchbox\recurselevel
225 \vss}
226 \else
227 \dorecurse{\boxlines\scratchbox}
228 {\boxline\scratchbox\recurselevel
229 \vss}
230 \fi
231 \unskip
232 \egroup
233 \egroup}
234
235\protect \endinput
236 |