1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31\writestatus{loading}{ConTeXt Language Macros Initialization}
32
33\registerctxluafile{langdis}{autosuffix}
34\registerctxluafile{langhyp}{autosuffix}
35
36\unprotect
37
38\definesystemattribute[hyphenation][public]
39
40
41
42
43
44
45
46\newcount\compoundhyphenpenalty
47
48
49
50
51
52
53\hyphenpenalty 50
54\automatichyphenpenalty 50
55\explicithyphenpenalty 50
56\compoundhyphenpenalty 50
57\exceptionpenalty 1000
58
59
60
61
62\installcorenamespace{hyphenation}
63\installcorenamespace{hyphenationfeatures}
64
65\installparameterhandler \??hyphenation {hyphenation}
66\installrootparameterhandler \??hyphenation {hyphenation}
67\installsetuphandler \??hyphenation {hyphenation}
68
69
70
71\setuphyphenation
72 [\c!method=\s!default,
73 \c!hyphens=\v!yes,
74 \s!righthyphenchar=0,
75 \s!lefthyphenchar=0]
76
77\appendtoks
78
79 \edef\p_hyphens{\hyphenationparameter\c!hyphens}
80 \ifx\p_hyphens\v!no
81 \nohyphencollapsing
82 \else
83 \dohyphencollapsing
84 \fi
85\to \everysetuphyphenation
86
87\appendtoks
88 \clf_sethyphenationmethod{\hyphenationparameter\c!method}
89\to \everysetuphyphenation
90
91
92
93\permanent\protected\def\starthyphenation[#1]
94 {\begingroup
95 \clf_pushhyphenation{#1}}
96
97\permanent\protected\def\stophyphenation
98 {\ifhmode\par\fi
99 \clf_pophyphenation
100 \endgroup}
101
102
103
104
105
106
107
108
109\permanent\tolerant\protected\def\definehyphenationfeatures[#1]#*[#2]
110 {\begingroup
111 \letdummyparameter\c!characters \empty
112 \letdummyparameter\c!hyphens \empty
113 \letdummyparameter\c!joiners \empty
114 \letdummyparameter\c!rightwords \zerocount
115 \letdummyparameter\s!lefthyphenmin \zerocount
116 \letdummyparameter\s!righthyphenmin \zerocount
117 \letdummyparameter\s!hyphenmin \zerocount
118 \letdummyparameter\s!lefthyphenchar \zerocount
119 \letdummyparameter\s!righthyphenchar\zerocount
120 \letdummyparameter\c!alternative \empty
121 \letdummyparameter\c!rightedge \empty
122 \letdummyparameter\c!rightchars \empty
123 \getdummyparameters[#2]
124 \clf_definehyphenationfeatures
125 {#1}
126 {
127 characters {\dummyparameter\c!characters}
128 hyphens {\dummyparameter\c!hyphens}
129 joiners {\dummyparameter\c!joiners}
130 rightwordmin \numexpr\dummyparameter\c!rightwords\relax
131 rightchars {\dummyparameter\c!rightchars}
132 charmin \numexpr\dummyparameter\s!hyphenmin\relax
133 leftcharmin \numexpr\dummyparameter\s!lefthyphenmin\relax
134 rightcharmin \numexpr\dummyparameter\s!righthyphenmin\relax
135 leftchar \numexpr\dummyparameter\s!lefthyphenchar\relax
136 rightchar \numexpr\dummyparameter\s!righthyphenchar\relax
137 alternative {\dummyparameter\c!alternative}
138 rightedge {\dummyparameter\c!rightedge}
139
140
141 }
142 \relax
143 \endgroup}
144
145\permanent\protected\def\sethyphenationfeatures[#1]
146 {\clf_sethyphenationfeatures{#1}}
147
148\permanent\protected\def\resethyphenationfeatures
149 {\attribute\hyphenationattribute\attributeunsetvalue}
150
151\resethyphenationfeatures
152
153
154
155\permanent\tolerant\protected\def\registerhyphenationpattern[#1]#*[#2]
156 {\clf_registerhyphenationpattern\ifparameter#2\or{#1}{#2}\else{\currentlanguage}{#1}\fi\s!true\relax}
157
158\permanent\tolerant\protected\def\unregisterhyphenationpattern[#1]#*[#2]
159 {\clf_registerhyphenationpattern\ifparameter#2\or{#1}{#2}\else{\currentlanguage}{#1}\fi\s!false\relax}
160
161\permanent\tolerant\protected\def\registerhyphenationexception[#1]#*[#2]
162 {\clf_registerhyphenationexception\ifparameter#2\or{#1}{#2}\else{\currentlanguage}{#1}\fi\relax}
163
164\permanent\tolerant\protected\def\showhyphenationtrace[#1]#*[#2]
165 {\begingroup
166 \tt
167 \clf_showhyphenationtrace\ifparameter#2\or{#1}{#2}\else{\currentlanguage}{#1}\fi\relax
168 \endgroup}
169
170
171
172\permanent\protected\def\atleastoneword#1
173 {\begingroup
174 \starthyphenation[traditional]
175 \sethyphenationfeatures[words]
176 #1\par
177 \stophyphenation
178 \endgroup}
179
180
181
182\permanent\protected\def\showdiscretionaries
183 {\clf_showdiscretionaries}
184
185
186
187\definehyphenationfeatures
188 [fences]
189 [\c!characters={[]()}]
190
191\definehyphenationfeatures
192 [words]
193 [\c!rightwords=1,
194 \s!lefthyphenmin=4,
195 \s!righthyphenmin=4]
196
197\definehyphenationfeatures
198 [default]
199 [
200 \c!hyphens=\v!yes,
201 \c!joiners=\v!yes]
202
203\definehyphenationfeatures
204 [strict]
205 [\c!rightedge=\s!tex]
206
207
208
209
210
211
212
213\protect \endinput
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274 |