typo-adj.mkxl /size: 1982 b    last modification: 2024-01-16 10:22
1%D \module
2%D   [       file=typo-adj,
3%D        version=2021.11.02,
4%D          title=\CONTEXT\ Typesetting Macros,
5%D       subtitle=Adjusters,
6%D         author=Hans Hagen,
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% This is preliminary (mostly test) code ... for it to be useful we also need to
15% add some spacing options as well as penalty control. So far I never needed this
16% but who knows.
17
18\writestatus{loading}{ConTeXt Typesetting Macros / Adjusters}
19
20\registerctxluafile{typo-adj}{autosuffix}
21
22% \definesystemattribute[adjuster][public]
23
24% Musical timestamp: the announcement of the new Porcupine Tree album: Closure /
25% Continuation and the related upcoming tour. They're back!
26
27\unprotect
28
29%D \starttyping
30%D \start \showboxes
31%D     \dorecurse{20}{test #1 }
32%D     \insertlinebefore{BEFORE 1}
33%D     \insertlineafter {AFTER  1}
34%D     \dorecurse{20}{test #1 }
35%D     \dorecurse{20}{test #1 }
36%D     \insertlinebefore{BEFORE 2}
37%D     \insertlineafter {AFTER  2}
38%D     \dorecurse{20}{test #1 }
39%D \stop
40%D \stoptyping
41
42\def\typo_adjusters_line#1% no need for speed
43  {\begingroup
44   \dowithnextbox
45      {\ht\nextbox\strutht
46       \dp\nextbox\strutdp
47      %\boxattribute\nextbox \adjusterattribute \plusone
48       \vadjust #1 index \plusone {\box\nextbox}%
49       \endgroup}%
50      \hbox}
51
52\tolerant\def\typo_adjusters_blank#1[#2]% no need for speed
53  {\begingroup
54   \setbox\scratchbox\vbox{\blank[#2]}%
55   \vadjust #1 index \plustwo {\vskip\htdp\scratchbox}%
56   \endgroup}
57
58\permanent\protected\def\insertlinebefore{\typo_adjusters_line{pre}}
59\permanent\protected\def\insertlineafter {\typo_adjusters_line{post}}
60
61\permanent\protected\def\insertblankbefore{\typo_adjusters_blank{pre}}
62\permanent\protected\def\insertblankafter {\typo_adjusters_blank{post}}
63
64\protect \endinput
65