comparison etc/ps-prin1.ps @ 37138:b582e8e39870

Line and paragraph spacing feature. (LineHS, ParagraphHS, EffectUnderline, EffectStrikeou, EffectOverline) (EffectShadow, EffectBox, EffectOutline): New vars. (PSL, S, EF, printZebra, doColumnZebra, doZebra): Code fix. (PHL, LHL): New funs.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 02 Apr 2001 10:38:26 +0000
parents b5a4db21c424
children f7aaa73f592e
comparison
equal deleted inserted replaced
37137:b960119b9c18 37138:b582e8e39870
185 currentpoint pop % -- cur-x 185 currentpoint pop % -- cur-x
186 sub % -- width until eol 186 sub % -- width until eol
187 dobackground 187 dobackground
188 }def 188 }def
189 189
190 /PSL{bg{eolbg}if 0 currentpoint exch pop LineHeight sub moveto}def 190 /LineHS LineHeight LineSpacing add def
191 /ParagraphHS LineHeight ParagraphSpacing add def
192 /PSL{/h exch def bg{eolbg}if 0 currentpoint exch pop h sub moveto}def
191 /PLN{PrintLineNumber{doLineNumber}if}def 193 /PLN{PrintLineNumber{doLineNumber}if}def
192 194
193 /SL{PSL isLineStep pop}def % Soft Linefeed 195 /SL{LineHS PSL isLineStep pop}def % Soft Linefeed
194 196
195 /HL{PSL PLN}def % Hard Linefeed 197 /PHL{ParagraphHS PSL PLN}def % Paragraph Hard Linefeed
198 /LHL{LineHS PSL PLN}def % Hard Linefeed
196 199
197 % Some debug 200 % Some debug
198 /dcp{currentpoint exch 40 string cvs print(, )print =}def 201 /dcp{currentpoint exch 40 string cvs print(, )print =}def
199 /dp{print 2 copy exch 40 string cvs print(, )print =}def 202 /dp{print 2 copy exch 40 string cvs print(, )print =}def
200 203
205 % by the number of spaces to plot 208 % by the number of spaces to plot
206 bg{dup dobackground}if 209 bg{dup dobackground}if
207 0 rmoveto 210 0 rmoveto
208 }def 211 }def
209 212
210 /Effect 0 def 213 /Effect 0 def
211 /EF{/Effect exch def}def 214 /EffectUnderline false def
212 215 /EffectStrikeout false def
213 % stack: string |- -- 216 /EffectOverline false def
217 /EffectShadow false def
218 /EffectBox false def
219 /EffectOutline false def
220
214 % effect: 1 - underline 2 - strikeout 4 - overline 221 % effect: 1 - underline 2 - strikeout 4 - overline
215 % 8 - shadow 16 - box 32 - outline 222 % 8 - shadow 16 - box 32 - outline
223 /EF{
224 /Effect exch def
225 /EffectUnderline Effect 1 and 0 ne def
226 /EffectStrikeout Effect 2 and 0 ne def
227 /EffectOverline Effect 4 and 0 ne def
228 /EffectShadow Effect 8 and 0 ne def
229 /EffectBox Effect 16 and 0 ne def
230 /EffectOutline Effect 32 and 0 ne def
231 }def
232
233 % stack: string |- --
216 /S{ 234 /S{
217 /xx currentpoint dup Descent add/yy exch def 235 /xx currentpoint dup Descent add/yy exch def
218 Ascent add/YY exch def def 236 Ascent add/YY exch def def
219 dup stringwidth pop xx add/XX exch def 237 dup stringwidth pop xx add/XX exch def
220 Effect 8 and 0 ne{ 238 EffectShadow{
221 /yy yy Yshadow add def 239 /yy yy Yshadow add def
222 /XX XX Xshadow add def 240 /XX XX Xshadow add def
223 }if 241 }if
224 bg{ 242 bg{
225 true 243 true
226 Effect 16 and 0 ne 244 EffectBox
227 {SpaceBackground doBox} 245 {SpaceBackground doBox}
228 {xx yy XX YY doRect} 246 {xx yy XX YY doRect}
229 ifelse 247 ifelse
230 }if % background 248 }if % background
231 Effect 16 and 0 ne{false 0 doBox}if % box 249 EffectBox {false 0 doBox}if % box
232 Effect 8 and 0 ne{dup doShadow}if % shadow 250 EffectShadow {dup doShadow}if % shadow
233 Effect 32 and 0 ne 251 EffectOutline
234 {true doOutline} % outline 252 {true doOutline} % outline
235 {show} % normal text 253 {show} % normal text
236 ifelse 254 ifelse
237 Effect 1 and 0 ne{UnderlinePosition Hline}if % underline 255 EffectUnderline{UnderlinePosition Hline}if % underline
238 Effect 2 and 0 ne{StrikeoutPosition Hline}if % strikeout 256 EffectStrikeout{StrikeoutPosition Hline}if % strikeout
239 Effect 4 and 0 ne{OverlinePosition Hline}if % overline 257 EffectOverline {OverlinePosition Hline}if % overline
240 }bind def 258 }bind def
241 259
242 % stack: position |- -- 260 % stack: position |- --
243 /Hline{ 261 /Hline{
244 currentpoint exch pop add dup 262 currentpoint exch pop add dup
349 % stack: -- 367 % stack: --
350 /printZebra{ 368 /printZebra{
351 gsave 369 gsave
352 ZebraColor SetColor 370 ZebraColor SetColor
353 /double-zebra ZebraHeight ZebraHeight add def 371 /double-zebra ZebraHeight ZebraHeight add def
354 /yiter double-zebra LineHeight mul neg def 372 /yiter double-zebra LineHS mul neg def
355 /xiter PrintWidth InterColumn add def 373 /xiter PrintWidth InterColumn add def
356 /zebra-line LinesPrinted def 374 /zebra-line LinesPrinted def
357 NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat 375 NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat
358 grestore 376 grestore
359 }def 377 }def
368 zebra-line double-zebra mod ZebraHeight lt 386 zebra-line double-zebra mod ZebraHeight lt
369 {H doZebra % "black" stripe followed by a "white" stripe 387 {H doZebra % "black" stripe followed by a "white" stripe
370 /lpc lpc ZebraHeight sub def 388 /lpc lpc ZebraHeight sub def
371 H ZebraHeight add} 389 H ZebraHeight add}
372 {H}ifelse % "white" stripe 390 {H}ifelse % "white" stripe
373 LineHeight mul neg 0 exch rmoveto 391 LineHS mul neg 0 exch rmoveto
374 /zebra-line zebra-line LinesPerColumn add def 392 /zebra-line zebra-line LinesPerColumn add def
375 }if 393 }if
394 /zspacing 0 def
376 lpc dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat 395 lpc dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat
377 double-zebra mod dup 0 le{pop} 396 double-zebra mod dup 0 le{pop}
378 {dup ZebraHeight gt ZebraFollow 2 and 0 ne or{pop ZebraHeight}if doZebra}ifelse 397 {dup ZebraHeight gt
398 {pop ZebraHeight}
399 {/zspacing LineSpacing def
400 ZebraFollow 2 and 0 ne{pop ZebraHeight}if}ifelse
401 doZebra}ifelse
379 grestore 402 grestore
380 }def 403 }def
381 404
382 % stack: zebra-height (in lines) |- -- 405 % stack: zebra-height (in lines) |- --
383 /doZebra{ 406 /doZebra{
384 /zh exch 0.05 sub LineHeight mul def 407 /zh exch 0.05 sub LineHS mul zspacing sub def
385 gsave 408 gsave
386 0 LineHeight 0.65 mul rmoveto 409 0 LineHeight 0.65 mul rmoveto
387 PrintWidth 0 rlineto 410 PrintWidth 0 rlineto
388 0 zh neg rlineto 411 0 zh neg rlineto
389 PrintWidth neg 0 rlineto 412 PrintWidth neg 0 rlineto