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