spac-imp-tests.mkxl /size: 9033 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=spac-imp-tests,
3%D        version=2023.06.10,
4%D          title=\CONTEXT\ Spacing Macros,
5%D       subtitle=Test Passes,
6%D         author=Hans Hagen & Mikael Sundqvist,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D Eventually we will have a set of useable (realistic) presets and definitions
15%D here. So, all be low can change dependin gon what users feed back to us.
16
17% \writestatus{loading}{ConTeXt Spacing Macros / Test Passes}
18
19\unprotect
20
21% \startsetups align:pass:default
22%     \parpasses 2
23%         classes \indecentparpassclasses
24%         fitnessdemerits \zerocount
25%         next
26%         quit
27%     \relax
28%   % \linebreakpasses\plusone
29% \stopsetups
30
31\startsetups align:pass:granular
32    \parpasses 2
33        classes \indecentparpassclasses
34        fitnessdemerits \plusnine
35            \plusninetynine \plusninethousand     \zerocount
36            \plusfourtytwo  \plussixthousand      \plusfivehundred      % .75
37            \plustwelve     \plusfortyfivehundred \plusthousand         % .50
38            \plustwo        \plusthreethousand    \plusthousand         % .25
39            \zerocount      \plusfifteenhundred   \plusfifteenhundred   % .00 \adjdemerits baseline is 5000
40            \plustwo        \plusthousand         \plusthreethousand    % .25
41            \plustwelve     \plusthousand         \plusfortyfivehundred % .50
42            \plusfourtytwo  \plusfivehundred      \plussixthousand      % .75
43            \plusninetynine \zerocount            \plusninethousand
44        next
45        quit
46    \relax
47  % \linebreakpasses\plusone
48\stopsetups
49
50% todo: just store the parpass
51%
52\setnewconstant\c_parpass_quality\parpassidentifier{quality}
53\setnewconstant\c_parpass_decent \parpassidentifier{decent}
54
55\startsetups align:pass:decent
56    \pretolerance 50
57    \tolerance    150
58    \parpasses    2
59        identifier             \c_parpass_decent
60        threshold              0.05pt
61        tolerance            200
62      next
63        threshold              0.05pt
64        tolerance            500
65        adjustspacing          3
66        adjustspacingstep      1
67        adjustspacingshrink   20
68        adjustspacingstretch  40
69    \relax
70  % \linebreakpasses\plusone
71\stopsetups
72
73\startsetups align:pass:quality
74    \pretolerance 50
75    \tolerance    150
76    \parpasses    4
77        identifier             \c_parpass_quality
78      % classes                \indecentparpassclasses
79        threshold              0.025pt
80        tolerance            175
81      next
82        threshold              0.025pt
83        tolerance            200
84      next
85        threshold              0.025pt
86        tolerance            250
87      next
88        threshold              0.025pt
89        tolerance            250
90        adjustspacing          3
91        adjustspacingstep      1
92        adjustspacingshrink   20
93        adjustspacingstretch  40
94    \relax
95  % \linebreakpasses\plusone
96\stopsetups
97
98% the test set:
99
100% \startsetups align:pass:test1
101%     \pretolerance 100
102%     \tolerance    200
103%     \parpasses      2
104%         classes                \indecentparpassclasses
105%         tolerance            400
106%       next
107%         classes                \indecentparpassclasses
108%         tolerance            400
109%         adjustspacing          3
110%         adjustspacingstep      1
111%         adjustspacingshrink   15
112%         adjustspacingstretch  30
113%       % emergencystretch       0.25\bodyfontsize
114%         emergencyfactor      250
115%     \relax
116%     \linebreakpasses\plusone
117% \stopsetups
118
119\startsetups align:pass:test1
120    \pretolerance 100
121    \tolerance    200
122    \parpasses    1
123        classes              \ifnum\fitnessdemerits=\plusnine\almostdecentparpassclasses\else\indecentparpassclasses\fi
124        tolerance            300
125        adjustspacing          3
126        adjustspacingstep      1
127        adjustspacingshrink   15
128        adjustspacingstretch  30
129      % emergencystretch       0.25\bodyfontsize
130        emergencyfactor      250
131    \relax
132%     \linebreakpasses\plusone
133\stopsetups
134
135% This one works quite well About 300 hits, almost all but a handful caught by the
136% the first one.
137
138\startsetups align:pass:test2
139    \pretolerance 100
140    \tolerance    200
141    \parpasses      3
142        classes                \indecentparpassclasses
143        threshold              0.025pt
144        tolerance            250
145        extrahyphenpenalty    50
146      next
147        threshold              0.025pt
148        tolerance            300
149        adjustspacing          3
150        adjustspacingstep      1
151        adjustspacingshrink   10
152        adjustspacingstretch  15
153      next
154        threshold              0.025pt
155        tolerance            350
156        adjustspacing          3
157        adjustspacingstep      1
158        adjustspacingshrink   20
159        adjustspacingstretch  40
160      % emergencystretch       0.25\bodyfontsize
161        emergencyfactor      250
162    \relax
163%     \linebreakpasses\plusone
164\stopsetups
165
166% This one works quite well. About 500 hits, all but about 10 caught by the the
167% first one
168
169\startsetups align:pass:test3
170    \pretolerance  50
171    \tolerance    100
172    \parpasses      2
173        classes                \indecentparpassclasses
174        threshold              0.025pt
175        tolerance            200
176        extrahyphenpenalty    50
177      next
178        threshold              0.025pt
179        tolerance            200
180        extrahyphenpenalty    25
181        adjustspacing          3
182        adjustspacingstep      1
183        adjustspacingshrink   20
184        adjustspacingstretch  40
185      % emergencystretch       0.25\bodyfontsize
186        emergencyfactor      250
187    \relax
188%     \linebreakpasses\plusone
189\stopsetups
190
191% We increase expansion stepwise Here most (about 300) end up in the fourth run,
192% only a handful in the first ones No overfull hboxes present, many large changes.
193
194\startsetups align:pass:test4
195    \pretolerance 100
196    \tolerance    200
197    \parpasses      4
198        classes               \indecentparpassclasses
199        threshold             0.025pt
200        adjustspacing         3
201        adjustspacingstep     1
202        adjustspacingshrink   5
203        adjustspacingstretch 10
204      next
205        classes               \indecentparpassclasses
206        threshold             0.025pt
207        adjustspacing         3
208        adjustspacingstep     1
209        adjustspacingshrink  10
210        adjustspacingstretch 20
211      next
212        classes               \indecentparpassclasses
213        threshold             0.025pt
214        adjustspacing         3
215        adjustspacingstep     1
216        adjustspacingshrink  20
217        adjustspacingstretch 40
218      next
219        classes               \indecentparpassclasses
220        threshold             0.025pt
221        adjustspacing         3
222        adjustspacingstep     1
223        adjustspacingshrink  40
224        adjustspacingstretch 80
225    \relax
226%     \linebreakpasses\plusone
227\stopsetups
228
229% Start with low tolerance and hopefully no hyphens. increase tolerance and
230% decrease extrahyphenpenalty. Last one has a larger threshold, so only kicks in for
231% lines that stick out "much" 31-1-4-0 (but two slightly overfull hboxes)
232
233\startsetups align:pass:test5
234    \pretolerance  50
235    \tolerance    100
236    \parpasses      4
237        threshold             0.025pt
238        tolerance           200
239        extrahyphenpenalty  100
240      next
241        threshold             0.025pt
242        tolerance           400
243        extrahyphenpenalty   50
244      next
245        threshold             0.025pt
246        tolerance           500
247        extrahyphenpenalty   25
248      % emergencystretch      0.25\bodyfontsize
249        emergencyfactor     250
250      next
251        threshold             1pt
252        tolerance          1000
253        extrahyphenpenalty    0
254      % emergencystretch      0.5\bodyfontsize
255        emergencyfactor     500
256    \relax
257%     \linebreakpasses\plusone
258\stopsetups
259
260% another temporary test
261
262\permanent\protected\def\optional#1#2%
263  {\optionalboundary#1\wordboundary#2\wordboundary\optionalboundary\zerocount}
264
265\startsetups align:pass:optional1
266    \pretolerance  75
267    \tolerance    150
268    \parpasses      3
269        classes             \indecentparpassclasses
270        linebreakoptional   0
271        tolerance         150
272    next
273%         callback          \parpasscallback{experiment}
274        classes             \indecentparpassclasses
275        tolerance         200
276        linebreakoptional   0
277      % emergencystretch  .25\bodyfontsize
278        emergencyfactor   250
279    next
280%       threshold           0.025pt
281        classes            \indecentparpassclasses
282        tolerance         200
283        linebreakoptional   0
284      % emergencystretch    0.5\bodyfontsize
285        emergencyfactor   500
286    \relax
287%     \linebreakpasses\plusone
288\stopsetups
289
290\protect \endinput
291