spac-pas.mkxl /size: 3008 b    last modification: 2024-01-16 10:22
1%D \module
2%D   [       file=spac-pas,
3%D        version=2023.06.10,
4%D          title=\CONTEXT\ Spacing Macros,
5%D       subtitle=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\writestatus{loading}{ConTeXt Spacing Macros / Passes}
15
16\registerctxluafile{spac-pas}{autosuffix}
17
18%D Here we set up some nano typography features. We have moved the penalties
19%D that deal with par building here. We also separated them from the page
20%D builder related ones.
21
22\unprotect
23
24% \resetpenalties\orphanpenalties
25
26\integerdef\indecentparpassclasses\numexpr
27      \verylooseparpassclass
28    + \looseparpassclass
29    + \semilooseparpassclass
30    % \decentparpassclass
31    + \semitightparpassclass
32    + \tightparpassclass
33\relax
34
35\integerdef\almostdecentparpassclasses\numexpr
36      \verylooseparpassclass
37    + \looseparpassclass
38    % \semilooseparpassclass
39    % \decentparpassclass
40    % \semitightparpassclass % yes or no
41    + \tightparpassclass
42\relax
43
44\integerdef\looseparpassclasses\numexpr
45      \verylooseparpassclass
46    + \looseparpassclass
47    + \semilooseparpassclass
48\relax
49
50\integerdef\tightparpassclasses\numexpr
51      \semitightparpassclass
52    + \tightparpassclass
53\relax
54
55\appendtoks
56    \ifcase\linebreakpasses\else
57        \linebreakpasses\zerocount
58        \pretolerance   \plushundred
59        \tolerance      \plustwohundred
60    \fi
61\to \everyforgetall
62
63\startsetups align:pass:none
64    \pretolerance   \plushundred
65    \tolerance      \plustwohundred
66    \parpasses      \zerocount
67    \linebreakpasses\zerocount
68  % \lettonothing\currentalignpass
69\stopsetups
70
71% see spac-pas-imp-tests.mkxl
72
73\lettonothing\currentalignpass
74
75\permanent\protected\def\setupalignpass[#1]%
76  {\cdef\tempstring{align:pass:#1}%
77   \ifx\tempstring\currentalignpass\else
78     \linebreakpasses\plusone % none will reset this
79     \let\currentalignpass\tempstring
80     \fastsetup\currentalignpass
81     \relax % to be sure
82   \fi}
83
84\appendtoks
85    \ifcase\linebreakpasses\else
86      \fastsetup\currentalignpass
87    \fi
88\to \everybodyfont
89
90%D This sort of belongs here:
91
92\permanent\protected\def\optionalword#1%
93  {\removeunwantedspaces\wordboundary\discretionary{}{}{#1}}
94
95%D \starttyping
96%D \dostepwiserecurse{80}{100}{1}{\hsize #1mm
97%D     Many readers will skim over formulas on their first reading
98%D     of your exposition. Therefore, your sentences should flow
99%D     smoothly when all but the simplest formulas are replaced by
100%D     \quotation {blah} or some other \optionalword {grunting }noise.
101%D     \page
102%D }
103%D \stoptyping
104
105% Musical timestamp: Archive's Call to Arms & Angels (and Super8) in loop mode
106% (June 2023, weirdly I had missed those releases in 2022).
107
108% \dorecurse{41}{line #1\par}
109% here \singlelinepenalty20000 \updateparagraphpenalties here here
110
111\protect
112