1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Typesetting Macros Caps}
15
16\unprotect
17
18
19
20
21\registerctxluafile{typocap}{autosuffix}
22
23
24
25
26
27
28
29
30
31
32\installcorenamespace{capitals}
33
34\installcommandhandler \??capitals {capitals} \??capitals
35
36
37
38
39
40\setupcapitals
41 [\c!category=\zerocount,
42 \c!xscale=\plusthousand,
43 \c!yscale=\plusthousand]
44
45\definecapitals[\v!WORD] [\c!category=\plusone]
46\definecapitals[\v!capital] [\c!category=\plusthree]
47\definecapitals[\v!Capital] [\c!category=\plusthree]
48\definecapitals[\v!mixed] [\c!category=\plusthree]
49\definecapitals[\v!Word] [\c!category=\plusthree]
50\definecapitals[\v!Words] [\c!category=\plusthree]
51\definecapitals[\v!camel] [\c!category=\plusthree]
52
53\definecapitals[\v!cap] [\v!capital]
54\definecapitals[\v!Cap] [\v!Capital]
55
56\definecapitals
57 [\v!word]
58 [\c!category=\plustwo,
59 \c!style=]
60
61\definecapitals
62 [\v!Camel]
63 [\c!xscale=900,
64 \c!yscale=900,
65 \c!category=\plusthree]
66
67\permanent\protected\def\resetcharactercasing{\c_attr_case\attributeunsetvalue}
68
69\definecapitals
70 [randomvariant]
71 [\c!category=\zerocount]
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103\permanent\tolerant\protected\def\setcharactercasing[#1]
104 {\clf_setcharactercasing
105 {#1}
106 {\namedcapitalsparameter{#1}\c!category}
107 {\namedcapitalsparameter{#1}\c!xscale}
108 {\namedcapitalsparameter{#1}\c!yscale}}
109
110\protected\def\casing[#1]{\groupedcommand{\setcharactercasing[#1]}{}}
111\protected\def\nocasing {\groupedcommand{\resetcharactercasing}{}}
112
113\protected\def\typo_capital_WORD {\setcharactercasing[\v!WORD ]}
114\protected\def\typo_capital_word {\setcharactercasing[\v!word ]}
115\protected\def\typo_capital_Word {\setcharactercasing[\v!Word ]}
116\protected\def\typo_capital_Words{\setcharactercasing[\v!Words]}
117\protected\def\typo_capital_camel{\setcharactercasing[\v!camel]}
118\protected\def\typo_capital_Camel{\setcharactercasing[\v!Camel]}
119
120\pushoverloadmode
121
122\permanent\protected\def\WORD {\triggergroupedcommandcs\typo_capital_WORD }
123\permanent\protected\def\word {\triggergroupedcommandcs\typo_capital_word }
124\permanent\protected\def\Word {\triggergroupedcommandcs\typo_capital_Word }
125\permanent\protected\def\Words{\triggergroupedcommandcs\typo_capital_Words}
126\permanent\protected\def\camel{\triggergroupedcommandcs\typo_capital_camel}
127\permanent\protected\def\Camel{\triggergroupedcommandcs\typo_capital_Camel}
128
129\aliased\let\WORDS\WORD
130\aliased\let\words\word
131
132\popoverloadmode
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184\newconditional\c_typo_capitals_pseudo
185
186\permanent\protected\def\usepseudocaps{\c_typo_capitals_pseudo\conditionaltrue}
187\permanent\protected\def\userealcaps {\c_typo_capitals_pseudo\conditionalfalse}
188
189\usepseudocaps
190
191
192
193
194
195\def\typo_capitals_set_fake#1
196 {\cdef\currentcapitals{#1}
197 \setcharactercasing[\currentcapitals]
198 \usecapitalsstyleparameter\c!style}
199
200\def\typo_capitals_set_real#1#2
201 {\cdef\currentcapitals{#1}
202 \sc
203 \setcharactercasing[\currentcapitals]}
204
205\permanent\protected\def\pseudosmallcapped{\triggergroupedcommandcs\font_style_pseudosmallcapped}
206\permanent\protected\def\pseudoSmallcapped{\triggergroupedcommandcs\font_style_pseudoSmallcapped}
207\permanent\protected\def\pseudoSmallCapped{\triggergroupedcommandcs\font_style_pseudoSmallCapped}
208\permanent\protected\def\pseudoMixedCapped{\triggergroupedcommandcs\font_style_pseudoMixedCapped}
209
210\permanent\protected\def\realsmallcapped {\triggergroupedcommandcs\font_style_realsmallcapped}
211\permanent\protected\def\realSmallcapped {\triggergroupedcommandcs\font_style_realSmallcapped}
212\permanent\protected\def\realSmallCapped {\triggergroupedcommandcs\font_style_realSmallCapped}
213
214\permanent\protected\def\notsmallcapped {\triggergroupedcommandcs\font_style_notsmallcapped}
215
216\protected\def\font_style_pseudosmallcapped{\typo_capitals_set_fake\v!WORD}
217\protected\def\font_style_pseudoSmallcapped{\typo_capitals_set_fake\v!capital}
218\protected\def\font_style_pseudoSmallCapped{\typo_capitals_set_fake\v!Capital}
219\protected\def\font_style_pseudoMixedCapped{\typo_capitals_set_fake\v!mixed }
220
221\protected\def\font_style_realsmallcapped {\typo_capitals_set_real\v!WORD}
222\protected\def\font_style_realSmallcapped {\typo_capitals_set_real\v!Word}
223\protected\def\font_style_realSmallCapped {\typo_capitals_set_real\v!Words}
224
225\protected\def\font_style_notsmallcapped {\typo_capitals_set_fake\v!word}
226
227\protected\def\typo_capitals_smallcaps
228 {\ifconditional\c_typo_capitals_pseudo
229 \expandafter\firstoftwoarguments
230 \else
231 \expandafter\secondoftwoarguments
232 \fi}
233
234\permanent\protected\def\smallcapped{\typo_capitals_smallcaps\pseudosmallcapped\realsmallcapped}
235\permanent\protected\def\Smallcapped{\typo_capitals_smallcaps\pseudoSmallcapped\realSmallcapped}
236\permanent\protected\def\SmallCapped{\typo_capitals_smallcaps\pseudoSmallCapped\realSmallCapped}
237
238\permanent\protected\def\font_style_smallcapped{\typo_capitals_smallcaps\font_style_pseudosmallcapped\font_style_realsmallcapped}
239\permanent\protected\def\font_style_Smallcapped{\typo_capitals_smallcaps\font_style_pseudoSmallcapped\font_style_realSmallcapped}
240\permanent\protected\def\font_style_SmallCapped{\typo_capitals_smallcaps\font_style_pseudoSmallCapped\font_style_realSmallCapped}
241
242\permanent\protected\def\autocap{\ifmmode\expandafter\normalcap\else\expandafter\smallcapped\fi}
243
244\prependtoks
245 \enforced\let\normalcap\cap
246\to \everydump
247
248\appendtoks
249 \enforced\let\cap\autocap
250\to \everydump
251
252\ifdefined\kap\else \aliased\let\kap\cap \fi
253
254\aliased\let\Caps\SmallCapped
255
256\aliased\let\mixedcaps\pseudoMixedCapped
257
258\aliased\let\normalsmallcapped\smallcapped
259\aliased\let\normalWORD \WORD
260\aliased\let\normalword \word
261
262\aliased\let\font_style_normalsmallcapped\font_style_smallcapped
263\aliased\let\font_style_normalWORD \WORD
264\aliased\let\font_style_normalword \word
265
266\appendtoks
267 \ifempty\currentcapitals
268 \ifcstok{\directcapitalsparameter\c!title}\v!yes
269 \definealternativestyle[\v!capital ][\font_style_normalsmallcapped][\font_style_normalsmallcapped]
270 \definealternativestyle[\v!smallcaps][\setsmallcaps][\setsmallcaps]
271 \else
272 \definealternativestyle[\v!capital ][\font_style_normalsmallcapped][\font_style_normalWORD]
273 \definealternativestyle[\v!smallcaps][\setsmallcaps][\font_style_normalWORD]
274 \fi
275 \ifcstok{\directcapitalsparameter\s!sc}\v!yes
276 \userealcaps
277 \else
278 \usepseudocaps
279 \fi
280 \fi
281\to \everysetupcapitals
282
283\aliased\let\uppercased\normalWORD
284\aliased\let\lowercased\normalword
285
286\setupcapitals
287 [\c!title=\v!yes,
288 \c!style=\tx,
289 \s!sc=\v!no]
290
291\definefont
292 [MixedCaps]
293 [CurrentFont*default cp 1.2\exheight]
294
295
296
297\setupcapitals
298 [\v!mixed]
299 [\c!style=MixedCaps]
300
301
302
303
304
305
306
307
308
309\permanent\protected\def\randomizetext{\triggergroupedcommand{\c_attr_case\pluseight}}
310
311\definestartstop[randomized][\c!before=\dosetattribute{case}{8},\c!after=]
312
313\protect \endinput
314 |