1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Spacing Macros Fillers}
15
16\unprotect
17
18
19
20
21
22
23
24\installcorenamespace{filler}
25\installcorenamespace{filleralternative}
26\installcorenamespace{fillerleadermethod}
27
28\installcommandhandler \??filler {filler} \??filler
29
30\aliased\let\setupfillers\setupfiller
31
32\permanent\protected\def\checkedfiller#1
33 {\ifcsname\namedfillerhash{#1}\s!parent\endcsname
34 \filler[#1]
35 \expandafter\gobbleoneargument
36 \else
37 \expandafter\firstofoneargument
38 \fi{#1}}
39
40\permanent\tolerant\protected\def\filler[#1]
41 {\removeunwantedspaces
42 \begingroup
43 \cdef\currentfiller{#1}
44 \usefillerstyleandcolor\c!style\c!color
45 \scratchdimen{\fillerparameter\c!leftmargin}
46 \ifzeropt\scratchdimen\else
47 \hskip\scratchdimen
48 \fi
49 \fillerparameter\c!left\relax
50 \expandnamespaceparameter\??filleralternative\fillerparameter\c!alternative\s!unknown\relax
51 \fillerparameter\c!right\relax
52 \scratchdimen\fillerparameter\c!rightmargin\relax
53 \ifzeropt\scratchdimen\else
54 \hskip\scratchdimen
55 \fi
56 \endgroup
57 \ignorespaces}
58
59
60
61
62
63
64
65
66
67
68
69
70
71\permanent\tolerant\protected\def\fillupto[#1]#:#2
72 {\removeunwantedspaces
73 \begingroup
74 \cdef\currentfiller{#1}
75 \scratchdimen{\fillerparameter\c!rightmargindistance}
76 \ifzeropt\scratchdimen\else
77 \parfillskip \scratchdimen\s!plus \plusone\s!fil\relax
78 \fi
79 \filler[#1]
80 \ifempty{#2}\else
81 \hbox{#2}
82 \fi
83 \par
84 \endgroup
85 \ignorespaces}
86
87\defcsname\??filleralternative\s!unknown\endcsname
88 {}
89
90\defcsname\??filleralternative\v!symbol\endcsname
91 {\expandnamespaceparameter\??fillerleadermethod\fillerparameter\c!method\v!local
92 \ifdim{\fillerparameter\c!offset}>\zeropoint
93 \simplealignedspreadbox
94 {2\dimexpr\fillerparameter\c!offset\relax}
95 {\fillerparameter\c!align}
96 {\fillerparameter\c!symbol}
97 \else
98 \simplealignedbox
99 {\fillerparameter\c!width}
100 {\fillerparameter\c!align}
101 {\fillerparameter\c!symbol}
102 \fi
103 \hfill}
104
105\defcsname\??filleralternative\v!stretch\endcsname
106 {\hfill}
107
108\defcsname\??filleralternative\v!space\endcsname
109 {\hskip\glueexpr\fillerparameter\c!distance\relax\relax}
110
111\defcsname\??filleralternative\v!rule\endcsname
112 {\expandnamespaceparameter\??fillerleadermethod\fillerparameter\c!method\v!local
113 \hrule
114 \s!height{\fillerparameter\c!height}
115 \s!depth {\fillerparameter\c!depth}
116 \hfill}
117
118\letcsname\??fillerleadermethod\s!local \endcsname\normalleaders
119\letcsname\??fillerleadermethod\v!global\endcsname\normalgleaders
120\letcsname\??fillerleadermethod\v!middle\endcsname\normalcleaders
121\letcsname\??fillerleadermethod\v!broad \endcsname\normalxleaders
122
123\setupfillers
124 [\c!width=\emwidth,
125 \c!symbol=.,
126 \c!distance=\emwidth,
127 \c!offset=\zeropoint,
128 \c!align=\v!middle,
129 \c!height=.1\exheight,
130 \c!depth=\zeropoint,
131 \c!leftmargin=\zeropoint,
132 \c!rightmargin=\zeropoint,
133 \c!rightmargindistance=\zeropoint,
134 \c!alternative=\v!symbol,
135 \c!method=\s!local]
136
137\definefiller
138 [\v!sym]
139 [\c!method=\v!global,
140 \c!width=.5\emwidth,
141 \c!leftmargin=.5\emwidth,
142 \c!rightmargin=.5\emwidth]
143
144\definefiller
145 [\v!symbol]
146 [\c!method=\v!global,
147 \c!offset=.125\emwidth,
148 \c!leftmargin=.5\emwidth,
149 \c!rightmargin=.5\emwidth]
150
151\definefiller
152 [\v!rule]
153 [\c!alternative=\v!rule,
154 \c!leftmargin=.5\emwidth,
155 \c!rightmargin=.5\emwidth]
156
157\definefiller
158 [\v!width]
159 [\c!alternative=\v!stretch]
160
161\definefiller
162 [\v!space]
163 [\c!alternative=\v!space,
164 \c!distance=3\emwidth]
165
166
167
168\definefiller
169 [dotfill]
170 [\c!symbol=\textperiod,
171 \c!style=\v!normal,
172 \c!method=\v!middle,
173 \c!width=.5\emwidth,
174 \c!leftmargin=.2\emwidth,
175 \c!rightmargin=.2\emwidth]
176
177
178
179
180
181
182
183\permanent\protected\def\dotfill{\filler[dotfill]}
184
185
186
187\protect \endinput
188
189
190
191
192
193
194
195
196
197
198
199 |