diff options
| author | Kenichi Handa | 2000-01-05 08:14:47 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-01-05 08:14:47 +0000 |
| commit | 48441121b2aa1e626c7423b6fc6f4d37973e6a4e (patch) | |
| tree | fd55c776f94590a8d8629b2613ef71f95ce3b11a | |
| parent | 6ddb893fffa9053e57034c3a9d632f846d15da92 (diff) | |
| download | emacs-48441121b2aa1e626c7423b6fc6f4d37973e6a4e.tar.gz emacs-48441121b2aa1e626c7423b6fc6f4d37973e6a4e.zip | |
New file.
| -rw-r--r-- | etc/ps-prin1.ps | 718 | ||||
| -rw-r--r-- | etc/ps-prin2.ps | 14 | ||||
| -rw-r--r-- | etc/ps-prin3.ps | 14 |
3 files changed, 746 insertions, 0 deletions
diff --git a/etc/ps-prin1.ps b/etc/ps-prin1.ps new file mode 100644 index 00000000000..e3401b1d2b7 --- /dev/null +++ b/etc/ps-prin1.ps | |||
| @@ -0,0 +1,718 @@ | |||
| 1 | % === BEGIN ps-print prologue 1 | ||
| 2 | |||
| 3 | % ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4: | ||
| 4 | /ISOLatin1Encoding where {pop}{ | ||
| 5 | % -- The ISO Latin-1 encoding vector isn't known, so define it. | ||
| 6 | % -- The first half is the same as the standard encoding, | ||
| 7 | % -- except for minus instead of hyphen at code 055. | ||
| 8 | /ISOLatin1Encoding | ||
| 9 | StandardEncoding 0 45 getinterval aload pop | ||
| 10 | /minus | ||
| 11 | StandardEncoding 46 82 getinterval aload pop | ||
| 12 | %*** NOTE: the following are missing in the Adobe documentation, | ||
| 13 | %*** but appear in the displayed table: | ||
| 14 | %*** macron at 0225, dieresis at 0230, cedilla at 0233, space at 0240. | ||
| 15 | % 0200 (128) | ||
| 16 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | ||
| 17 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | ||
| 18 | /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent | ||
| 19 | /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron | ||
| 20 | % 0240 (160) | ||
| 21 | /space /exclamdown /cent /sterling | ||
| 22 | /currency /yen /brokenbar /section | ||
| 23 | /dieresis /copyright /ordfeminine /guillemotleft | ||
| 24 | /logicalnot /hyphen /registered /macron | ||
| 25 | /degree /plusminus /twosuperior /threesuperior | ||
| 26 | /acute /mu /paragraph /periodcentered | ||
| 27 | /cedilla /onesuperior /ordmasculine /guillemotright | ||
| 28 | /onequarter /onehalf /threequarters /questiondown | ||
| 29 | % 0300 (192) | ||
| 30 | /Agrave /Aacute /Acircumflex /Atilde | ||
| 31 | /Adieresis /Aring /AE /Ccedilla | ||
| 32 | /Egrave /Eacute /Ecircumflex /Edieresis | ||
| 33 | /Igrave /Iacute /Icircumflex /Idieresis | ||
| 34 | /Eth /Ntilde /Ograve /Oacute | ||
| 35 | /Ocircumflex /Otilde /Odieresis /multiply | ||
| 36 | /Oslash /Ugrave /Uacute /Ucircumflex | ||
| 37 | /Udieresis /Yacute /Thorn /germandbls | ||
| 38 | % 0340 (224) | ||
| 39 | /agrave /aacute /acircumflex /atilde | ||
| 40 | /adieresis /aring /ae /ccedilla | ||
| 41 | /egrave /eacute /ecircumflex /edieresis | ||
| 42 | /igrave /iacute /icircumflex /idieresis | ||
| 43 | /eth /ntilde /ograve /oacute | ||
| 44 | /ocircumflex /otilde /odieresis /divide | ||
| 45 | /oslash /ugrave /uacute /ucircumflex | ||
| 46 | /udieresis /yacute /thorn /ydieresis | ||
| 47 | 256 packedarray def | ||
| 48 | }ifelse | ||
| 49 | |||
| 50 | /reencodeFontISO{ %def | ||
| 51 | dup | ||
| 52 | length 12 add dict % Make a new font (a new dict the same size | ||
| 53 | % as the old one) with room for our new symbols. | ||
| 54 | |||
| 55 | begin % Make the new font the current dictionary. | ||
| 56 | |||
| 57 | |||
| 58 | {1 index /FID ne | ||
| 59 | {def}{pop pop}ifelse | ||
| 60 | }forall % Copy each of the symbols from the old dictionary | ||
| 61 | % to the new one except for the font ID. | ||
| 62 | |||
| 63 | currentdict /FontType get 0 ne{ | ||
| 64 | /Encoding ISOLatin1Encoding def % Override the encoding with | ||
| 65 | % the ISOLatin1 encoding. | ||
| 66 | }if | ||
| 67 | |||
| 68 | % Use the font's bounding box to determine the ascent, descent, | ||
| 69 | % and overall height; don't forget that these values have to be | ||
| 70 | % transformed using the font's matrix. | ||
| 71 | |||
| 72 | % ^ (x2 y2) | ||
| 73 | % | | | ||
| 74 | % | v | ||
| 75 | % | +----+ - - | ||
| 76 | % | | | ^ | ||
| 77 | % | | | | Ascent (usually > 0) | ||
| 78 | % | | | | | ||
| 79 | % (0 0) -> +--+----+--------> | ||
| 80 | % | | | | ||
| 81 | % | | v Descent (usually < 0) | ||
| 82 | % (x1 y1) --> +----+ - - | ||
| 83 | |||
| 84 | currentdict /FontType get 0 ne{ | ||
| 85 | /FontBBox load aload pop % -- x1 y1 x2 y2 | ||
| 86 | FontMatrix transform /Ascent exch def pop | ||
| 87 | FontMatrix transform /Descent exch def pop | ||
| 88 | }{ | ||
| 89 | /PrimaryFont FDepVector 0 get def | ||
| 90 | PrimaryFont /FontBBox get aload pop | ||
| 91 | PrimaryFont /FontMatrix get transform /Ascent exch def pop | ||
| 92 | PrimaryFont /FontMatrix get transform /Descent exch def pop | ||
| 93 | }ifelse | ||
| 94 | |||
| 95 | /FontHeight Ascent Descent sub def % use `sub' because descent < 0 | ||
| 96 | |||
| 97 | % Define these in case they're not in the FontInfo | ||
| 98 | % (also, here they're easier to get to). | ||
| 99 | /UnderlinePosition Descent 0.70 mul def | ||
| 100 | /OverlinePosition Descent UnderlinePosition sub Ascent add def | ||
| 101 | /StrikeoutPosition Ascent 0.30 mul def | ||
| 102 | /LineThickness FontHeight 0.05 mul def | ||
| 103 | /Xshadow FontHeight 0.08 mul def | ||
| 104 | /Yshadow FontHeight -0.09 mul def | ||
| 105 | /SpaceBackground Descent neg UnderlinePosition add def | ||
| 106 | /XBox Descent neg def | ||
| 107 | /YBox LineThickness 0.7 mul def | ||
| 108 | |||
| 109 | currentdict % Leave the new font on the stack | ||
| 110 | end % Stop using the font as the current dictionary. | ||
| 111 | definefont % Put the font into the font dictionary | ||
| 112 | pop % Discard the returned font. | ||
| 113 | }bind def | ||
| 114 | |||
| 115 | /DefFont{ % Font definition | ||
| 116 | findfont exch scalefont reencodeFontISO | ||
| 117 | }def | ||
| 118 | |||
| 119 | /F{ % Font selection | ||
| 120 | findfont | ||
| 121 | dup /Ascent get /Ascent exch def | ||
| 122 | dup /Descent get /Descent exch def | ||
| 123 | dup /FontHeight get /FontHeight exch def | ||
| 124 | dup /UnderlinePosition get /UnderlinePosition exch def | ||
| 125 | dup /OverlinePosition get /OverlinePosition exch def | ||
| 126 | dup /StrikeoutPosition get /StrikeoutPosition exch def | ||
| 127 | dup /LineThickness get /LineThickness exch def | ||
| 128 | dup /Xshadow get /Xshadow exch def | ||
| 129 | dup /Yshadow get /Yshadow exch def | ||
| 130 | dup /SpaceBackground get /SpaceBackground exch def | ||
| 131 | dup /XBox get /XBox exch def | ||
| 132 | dup /YBox get /YBox exch def | ||
| 133 | setfont | ||
| 134 | }def | ||
| 135 | |||
| 136 | /FG /setrgbcolor load def | ||
| 137 | |||
| 138 | /bg false def | ||
| 139 | /BG{ | ||
| 140 | dup /bg exch def | ||
| 141 | {mark 4 1 roll ]} | ||
| 142 | {[ 1.0 1.0 1.0 ]} | ||
| 143 | ifelse | ||
| 144 | /bgcolor exch def | ||
| 145 | }def | ||
| 146 | |||
| 147 | % B width C | ||
| 148 | % +-----------+ | ||
| 149 | % | Ascent (usually > 0) | ||
| 150 | % A + + | ||
| 151 | % | Descent (usually < 0) | ||
| 152 | % +-----------+ | ||
| 153 | % E width D | ||
| 154 | |||
| 155 | /dobackground{ % width -- | ||
| 156 | currentpoint % -- width x y | ||
| 157 | gsave | ||
| 158 | newpath | ||
| 159 | moveto % A (x y) | ||
| 160 | 0 Ascent rmoveto % B | ||
| 161 | dup 0 rlineto % C | ||
| 162 | 0 Descent Ascent sub rlineto % D | ||
| 163 | neg 0 rlineto % E | ||
| 164 | closepath | ||
| 165 | bgcolor aload pop setrgbcolor | ||
| 166 | fill | ||
| 167 | grestore | ||
| 168 | }def | ||
| 169 | |||
| 170 | /eolbg{ % dobackground until right margin | ||
| 171 | PrintWidth % -- x-eol | ||
| 172 | currentpoint pop % -- cur-x | ||
| 173 | sub % -- width until eol | ||
| 174 | dobackground | ||
| 175 | }def | ||
| 176 | |||
| 177 | /PLN{PrintLineNumber{doLineNumber}if}def | ||
| 178 | |||
| 179 | /SL{ % Soft Linefeed | ||
| 180 | bg{eolbg}if | ||
| 181 | 0 currentpoint exch pop LineHeight sub moveto | ||
| 182 | }def | ||
| 183 | |||
| 184 | /HL{SL PLN}def % Hard Linefeed | ||
| 185 | |||
| 186 | % Some debug | ||
| 187 | /dcp{currentpoint exch 40 string cvs print (, ) print =}def | ||
| 188 | /dp{print 2 copy exch 40 string cvs print (, ) print =}def | ||
| 189 | |||
| 190 | /W{ | ||
| 191 | ( ) stringwidth % Get the width of a space in the current font. | ||
| 192 | pop % Discard the Y component. | ||
| 193 | mul % Multiply the width of a space | ||
| 194 | % by the number of spaces to plot | ||
| 195 | bg{dup dobackground}if | ||
| 196 | 0 rmoveto | ||
| 197 | }def | ||
| 198 | |||
| 199 | /Effect 0 def | ||
| 200 | /EF{/Effect exch def}def | ||
| 201 | |||
| 202 | % stack: string |- -- | ||
| 203 | % effect: 1 - underline 2 - strikeout 4 - overline | ||
| 204 | % 8 - shadow 16 - box 32 - outline | ||
| 205 | /S{ | ||
| 206 | /xx currentpoint dup Descent add /yy exch def | ||
| 207 | Ascent add /YY exch def def | ||
| 208 | dup stringwidth pop xx add /XX exch def | ||
| 209 | Effect 8 and 0 ne{ | ||
| 210 | /yy yy Yshadow add def | ||
| 211 | /XX XX Xshadow add def | ||
| 212 | }if | ||
| 213 | bg{ | ||
| 214 | true | ||
| 215 | Effect 16 and 0 ne | ||
| 216 | {SpaceBackground doBox} | ||
| 217 | {xx yy XX YY doRect} | ||
| 218 | ifelse | ||
| 219 | }if % background | ||
| 220 | Effect 16 and 0 ne{false 0 doBox}if % box | ||
| 221 | Effect 8 and 0 ne{dup doShadow}if % shadow | ||
| 222 | Effect 32 and 0 ne | ||
| 223 | {true doOutline} % outline | ||
| 224 | {show} % normal text | ||
| 225 | ifelse | ||
| 226 | Effect 1 and 0 ne{UnderlinePosition Hline}if % underline | ||
| 227 | Effect 2 and 0 ne{StrikeoutPosition Hline}if % strikeout | ||
| 228 | Effect 4 and 0 ne{OverlinePosition Hline}if % overline | ||
| 229 | }bind def | ||
| 230 | |||
| 231 | % stack: position |- -- | ||
| 232 | /Hline{ | ||
| 233 | currentpoint exch pop add dup | ||
| 234 | gsave | ||
| 235 | newpath | ||
| 236 | xx exch moveto | ||
| 237 | XX exch lineto | ||
| 238 | closepath | ||
| 239 | LineThickness setlinewidth stroke | ||
| 240 | grestore | ||
| 241 | }bind def | ||
| 242 | |||
| 243 | % stack: fill-or-not delta |- -- | ||
| 244 | /doBox{ | ||
| 245 | /dd exch def | ||
| 246 | xx XBox sub dd sub yy YBox sub dd sub | ||
| 247 | XX XBox add dd add YY YBox add dd add | ||
| 248 | doRect | ||
| 249 | }bind def | ||
| 250 | |||
| 251 | % stack: fill-or-not lower-x lower-y upper-x upper-y |- -- | ||
| 252 | /doRect{ | ||
| 253 | /rYY exch def | ||
| 254 | /rXX exch def | ||
| 255 | /ryy exch def | ||
| 256 | /rxx exch def | ||
| 257 | gsave | ||
| 258 | newpath | ||
| 259 | rXX rYY moveto | ||
| 260 | rxx rYY lineto | ||
| 261 | rxx ryy lineto | ||
| 262 | rXX ryy lineto | ||
| 263 | closepath | ||
| 264 | % top of stack: fill-or-not | ||
| 265 | {FillBgColor} | ||
| 266 | {LineThickness setlinewidth stroke} | ||
| 267 | ifelse | ||
| 268 | grestore | ||
| 269 | }bind def | ||
| 270 | |||
| 271 | % stack: string |- -- | ||
| 272 | /doShadow{ | ||
| 273 | gsave | ||
| 274 | Xshadow Yshadow rmoveto | ||
| 275 | false doOutline | ||
| 276 | grestore | ||
| 277 | }bind def | ||
| 278 | |||
| 279 | /st 1 string def | ||
| 280 | |||
| 281 | % stack: string fill-or-not |- -- | ||
| 282 | /doOutline{ | ||
| 283 | /-fillp- exch def | ||
| 284 | /-ox- currentpoint /-oy- exch def def | ||
| 285 | gsave | ||
| 286 | LineThickness setlinewidth | ||
| 287 | {st 0 3 -1 roll put | ||
| 288 | st dup true charpath | ||
| 289 | -fillp- {gsave FillBgColor grestore}if | ||
| 290 | stroke stringwidth | ||
| 291 | -oy- add /-oy- exch def | ||
| 292 | -ox- add /-ox- exch def | ||
| 293 | -ox- -oy- moveto | ||
| 294 | }forall | ||
| 295 | grestore | ||
| 296 | -ox- -oy- moveto | ||
| 297 | }bind def | ||
| 298 | |||
| 299 | % stack: -- | ||
| 300 | /FillBgColor{bgcolor aload pop setrgbcolor fill}bind def | ||
| 301 | |||
| 302 | /L0 6 /Times-Italic DefFont | ||
| 303 | |||
| 304 | % stack: -- | ||
| 305 | /doLineNumber{ | ||
| 306 | /LineNumber where | ||
| 307 | { | ||
| 308 | pop | ||
| 309 | currentfont | ||
| 310 | gsave | ||
| 311 | 0.0 0.0 0.0 setrgbcolor | ||
| 312 | /L0 findfont setfont | ||
| 313 | LineNumber Lines ge | ||
| 314 | {(end )} | ||
| 315 | {LineNumber 6 string cvs ( ) strcat} | ||
| 316 | ifelse | ||
| 317 | dup stringwidth pop neg 0 rmoveto | ||
| 318 | show | ||
| 319 | grestore | ||
| 320 | setfont | ||
| 321 | /LineNumber LineNumber 1 add def | ||
| 322 | }if | ||
| 323 | }def | ||
| 324 | |||
| 325 | % stack: -- | ||
| 326 | /printZebra{ | ||
| 327 | gsave | ||
| 328 | ZebraGray setgray | ||
| 329 | /double-zebra ZebraHeight ZebraHeight add def | ||
| 330 | /yiter double-zebra LineHeight mul neg def | ||
| 331 | /xiter PrintWidth InterColumn add def | ||
| 332 | NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat | ||
| 333 | grestore | ||
| 334 | }def | ||
| 335 | |||
| 336 | % stack: lines-per-column |- -- | ||
| 337 | /doColumnZebra{ | ||
| 338 | gsave | ||
| 339 | dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat | ||
| 340 | double-zebra mod | ||
| 341 | dup 0 le{pop}{dup ZebraHeight gt {pop ZebraHeight}if doZebra}ifelse | ||
| 342 | grestore | ||
| 343 | }def | ||
| 344 | |||
| 345 | % stack: zebra-height (in lines) |- -- | ||
| 346 | /doZebra{ | ||
| 347 | /zh exch 0.05 sub LineHeight mul def | ||
| 348 | gsave | ||
| 349 | 0 LineHeight 0.65 mul rmoveto | ||
| 350 | PrintWidth 0 rlineto | ||
| 351 | 0 zh neg rlineto | ||
| 352 | PrintWidth neg 0 rlineto | ||
| 353 | 0 zh rlineto | ||
| 354 | fill | ||
| 355 | grestore | ||
| 356 | }def | ||
| 357 | |||
| 358 | % tx ty rotation xscale yscale xpos ypos BeginBackImage | ||
| 359 | /BeginBackImage{ | ||
| 360 | /-save-image- save def | ||
| 361 | /showpage{}def | ||
| 362 | translate | ||
| 363 | scale | ||
| 364 | rotate | ||
| 365 | translate | ||
| 366 | }def | ||
| 367 | |||
| 368 | /EndBackImage{-save-image- restore}def | ||
| 369 | |||
| 370 | % string fontsize fontname rotation gray xpos ypos ShowBackText | ||
| 371 | /ShowBackText{ | ||
| 372 | gsave | ||
| 373 | translate | ||
| 374 | setgray | ||
| 375 | rotate | ||
| 376 | findfont exch dup /-offset- exch -0.25 mul def scalefont setfont | ||
| 377 | 0 -offset- moveto | ||
| 378 | /-saveLineThickness- LineThickness def | ||
| 379 | /LineThickness 1 def | ||
| 380 | false doOutline | ||
| 381 | /LineThickness -saveLineThickness- def | ||
| 382 | grestore | ||
| 383 | }def | ||
| 384 | |||
| 385 | /BeginDoc{ | ||
| 386 | % ---- Remember space width of the normal text font `f0'. | ||
| 387 | /SpaceWidth /f0 findfont setfont ( ) stringwidth pop def | ||
| 388 | % ---- save the state of the document (useful for ghostscript!) | ||
| 389 | /docState save def | ||
| 390 | % ---- [andrewi] set PageSize based on chosen dimensions | ||
| 391 | UseSetpagedevice{ | ||
| 392 | 0 | ||
| 393 | {<< /PageSize [PageWidth LandscapePageHeight] >> setpagedevice} | ||
| 394 | CheckConfig | ||
| 395 | }{ | ||
| 396 | LandscapeMode{ | ||
| 397 | % ---- translate to bottom-right corner of Portrait page | ||
| 398 | LandscapePageHeight 0 translate | ||
| 399 | 90 rotate | ||
| 400 | }if | ||
| 401 | }ifelse | ||
| 402 | % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7 | ||
| 403 | /JackGhostscript where{pop 1 27.7 29.7 div scale}if | ||
| 404 | % ---- N-Up printing | ||
| 405 | N-Up 1 gt{ | ||
| 406 | % ---- landscape | ||
| 407 | N-Up-Landscape{ | ||
| 408 | PageWidth 0 translate | ||
| 409 | 90 rotate | ||
| 410 | }if | ||
| 411 | N-Up-Margin dup translate | ||
| 412 | % ---- scale | ||
| 413 | LandscapeMode{ | ||
| 414 | /HH PageWidth def | ||
| 415 | /WW LandscapePageHeight def | ||
| 416 | }{ | ||
| 417 | /HH LandscapePageHeight def | ||
| 418 | /WW PageWidth def | ||
| 419 | }ifelse | ||
| 420 | WW N-Up-Margin sub N-Up-Margin sub | ||
| 421 | N-Up-Landscape | ||
| 422 | {N-Up-Lines div HH}{N-Up-Columns N-Up-Missing add div WW}ifelse | ||
| 423 | div dup scale | ||
| 424 | 0 N-Up-Repeat 1 sub LandscapePageHeight mul translate | ||
| 425 | % ---- go to start position in page matrix | ||
| 426 | N-Up-XStart N-Up-Missing 0.5 mul | ||
| 427 | LandscapeMode{ | ||
| 428 | LandscapePageHeight mul N-Up-YStart add | ||
| 429 | }{ | ||
| 430 | PageWidth mul add N-Up-YStart | ||
| 431 | }ifelse | ||
| 432 | translate | ||
| 433 | }if | ||
| 434 | /ColumnWidth PrintWidth InterColumn add def | ||
| 435 | % ---- translate to lower left corner of TEXT | ||
| 436 | LeftMargin BottomMargin translate | ||
| 437 | % ---- define where printing will start | ||
| 438 | /f0 F % this installs Ascent | ||
| 439 | /PrintStartY PrintHeight Ascent sub def | ||
| 440 | /ColumnIndex 1 def | ||
| 441 | /N-Up-Counter N-Up-End 1 sub def | ||
| 442 | SkipFirstPage{save showpage restore}if | ||
| 443 | }def | ||
| 444 | |||
| 445 | /EndDoc{ | ||
| 446 | % ---- restore the state of the document (useful for ghostscript!) | ||
| 447 | docState restore | ||
| 448 | }def | ||
| 449 | |||
| 450 | /BeginDSCPage{ | ||
| 451 | % ---- when 1st column, save the state of the page | ||
| 452 | ColumnIndex 1 eq{ | ||
| 453 | /pageState save def | ||
| 454 | }if | ||
| 455 | % ---- save the state of the column | ||
| 456 | /columnState save def | ||
| 457 | }def | ||
| 458 | |||
| 459 | /PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def | ||
| 460 | |||
| 461 | /BeginPage{ | ||
| 462 | % ---- when 1st column, print all background effects | ||
| 463 | ColumnIndex 1 eq{ | ||
| 464 | 0 PrintStartY moveto % move to where printing will start | ||
| 465 | Zebra {printZebra}if | ||
| 466 | printGlobalBackground | ||
| 467 | printLocalBackground | ||
| 468 | }if | ||
| 469 | PrintHeader{ | ||
| 470 | PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{ | ||
| 471 | PrintHeaderFrame{HeaderFrame}if | ||
| 472 | HeaderText | ||
| 473 | }if | ||
| 474 | }if | ||
| 475 | 0 PrintStartY moveto % move to where printing will start | ||
| 476 | PLN | ||
| 477 | }def | ||
| 478 | |||
| 479 | /EndPage{bg{eolbg}if}def | ||
| 480 | |||
| 481 | /EndDSCPage{ | ||
| 482 | ColumnIndex NumberOfColumns eq{ | ||
| 483 | % ---- restore the state of the page | ||
| 484 | pageState restore | ||
| 485 | /ColumnIndex 1 def | ||
| 486 | % ---- N-up printing | ||
| 487 | N-Up 1 gt{ | ||
| 488 | N-Up-Counter 0 gt{ | ||
| 489 | % ---- Next page on same row | ||
| 490 | /N-Up-Counter N-Up-Counter 1 sub def | ||
| 491 | N-Up-XColumn N-Up-YColumn | ||
| 492 | }{ | ||
| 493 | % ---- Next page on next line | ||
| 494 | /N-Up-Counter N-Up-End 1 sub def | ||
| 495 | N-Up-XLine N-Up-YLine | ||
| 496 | }ifelse | ||
| 497 | translate | ||
| 498 | }if | ||
| 499 | }{ % else | ||
| 500 | % ---- restore the state of the current column | ||
| 501 | columnState restore | ||
| 502 | % ---- and translate to the next column | ||
| 503 | ColumnWidth 0 translate | ||
| 504 | /ColumnIndex ColumnIndex 1 add def | ||
| 505 | }ifelse | ||
| 506 | }def | ||
| 507 | |||
| 508 | % stack: number-of-pages-per-sheet |- -- | ||
| 509 | /BeginSheet{ | ||
| 510 | /sheetState save def | ||
| 511 | /pages-per-sheet exch def | ||
| 512 | % ---- N-up printing | ||
| 513 | N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{ | ||
| 514 | % ---- page border | ||
| 515 | gsave | ||
| 516 | 0 setgray | ||
| 517 | LeftMargin neg BottomMargin neg moveto | ||
| 518 | N-Up-Repeat | ||
| 519 | {N-Up-End | ||
| 520 | {gsave | ||
| 521 | PageWidth 0 rlineto | ||
| 522 | 0 LandscapePageHeight rlineto | ||
| 523 | PageWidth neg 0 rlineto | ||
| 524 | closepath stroke | ||
| 525 | grestore | ||
| 526 | /pages-per-sheet pages-per-sheet 1 sub def | ||
| 527 | pages-per-sheet 0 le{exit}if | ||
| 528 | N-Up-XColumn N-Up-YColumn rmoveto | ||
| 529 | }repeat | ||
| 530 | pages-per-sheet 0 le{exit}if | ||
| 531 | N-Up-XLine N-Up-XColumn sub N-Up-YLine rmoveto | ||
| 532 | }repeat | ||
| 533 | grestore | ||
| 534 | }if | ||
| 535 | }def | ||
| 536 | |||
| 537 | /EndSheet{ | ||
| 538 | showpage | ||
| 539 | sheetState restore | ||
| 540 | }def | ||
| 541 | |||
| 542 | /SetHeaderLines{ % nb-lines -- | ||
| 543 | /HeaderLines exch def | ||
| 544 | % ---- bottom up | ||
| 545 | HeaderPad | ||
| 546 | HeaderLines 1 sub HeaderLineHeight mul add | ||
| 547 | HeaderTitleLineHeight add | ||
| 548 | HeaderPad add | ||
| 549 | /HeaderHeight exch def | ||
| 550 | }def | ||
| 551 | |||
| 552 | % |---------| | ||
| 553 | % | tm | | ||
| 554 | % |---------| | ||
| 555 | % | header | | ||
| 556 | % |-+-------| <-- (x y) | ||
| 557 | % | ho | | ||
| 558 | % |---------| | ||
| 559 | % | text | | ||
| 560 | % |-+-------| <-- (0 0) | ||
| 561 | % | bm | | ||
| 562 | % |---------| | ||
| 563 | |||
| 564 | /HeaderFrameStart{ % -- x y | ||
| 565 | 0 PrintHeight HeaderOffset add | ||
| 566 | }def | ||
| 567 | |||
| 568 | /HeaderFramePath{ | ||
| 569 | PrintHeaderWidth 0 rlineto | ||
| 570 | 0 HeaderHeight rlineto | ||
| 571 | PrintHeaderWidth neg 0 rlineto | ||
| 572 | 0 HeaderHeight neg rlineto | ||
| 573 | }def | ||
| 574 | |||
| 575 | /HeaderFrame{ | ||
| 576 | gsave | ||
| 577 | 0.4 setlinewidth | ||
| 578 | % ---- fill a black rectangle (the shadow of the next one) | ||
| 579 | HeaderFrameStart moveto | ||
| 580 | 1 -1 rmoveto | ||
| 581 | HeaderFramePath | ||
| 582 | 0 setgray fill | ||
| 583 | % ---- do the next rectangle ... | ||
| 584 | HeaderFrameStart moveto | ||
| 585 | HeaderFramePath | ||
| 586 | gsave 0.9 setgray fill grestore % filled with grey | ||
| 587 | gsave 0 setgray stroke grestore % drawn with black | ||
| 588 | grestore | ||
| 589 | }def | ||
| 590 | |||
| 591 | /HeaderStart{ | ||
| 592 | HeaderFrameStart | ||
| 593 | exch HeaderPad add exch % horizontal pad | ||
| 594 | % ---- bottom up | ||
| 595 | HeaderPad add % vertical pad | ||
| 596 | HeaderDescent sub | ||
| 597 | HeaderLineHeight HeaderLines 1 sub mul add | ||
| 598 | }def | ||
| 599 | |||
| 600 | /strcat{ | ||
| 601 | dup length 3 -1 roll dup length dup 4 -1 roll add string dup | ||
| 602 | 0 5 -1 roll putinterval | ||
| 603 | dup 4 2 roll exch putinterval | ||
| 604 | }def | ||
| 605 | |||
| 606 | /pagenumberstring{ | ||
| 607 | PageNumber 32 string cvs | ||
| 608 | ShowNofN{ | ||
| 609 | (/) strcat | ||
| 610 | PageCount 32 string cvs strcat | ||
| 611 | }if | ||
| 612 | }def | ||
| 613 | |||
| 614 | /HeaderText{ | ||
| 615 | HeaderStart moveto | ||
| 616 | |||
| 617 | HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines | ||
| 618 | |||
| 619 | % ---- hack: `PN 1 and' == `PN 2 modulo' | ||
| 620 | |||
| 621 | % ---- if even page number and duplex, then exchange left and right | ||
| 622 | PageNumber 1 and 0 eq DuplexValue and{exch}if | ||
| 623 | |||
| 624 | { % ---- process the left lines | ||
| 625 | aload pop | ||
| 626 | exch F | ||
| 627 | gsave | ||
| 628 | dup xcheck{exec}if | ||
| 629 | show | ||
| 630 | grestore | ||
| 631 | 0 HeaderLineHeight neg rmoveto | ||
| 632 | }forall | ||
| 633 | |||
| 634 | HeaderStart moveto | ||
| 635 | |||
| 636 | { % ---- process the right lines | ||
| 637 | aload pop | ||
| 638 | exch F | ||
| 639 | gsave | ||
| 640 | dup xcheck{exec}if | ||
| 641 | dup stringwidth pop | ||
| 642 | PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto | ||
| 643 | show | ||
| 644 | grestore | ||
| 645 | 0 HeaderLineHeight neg rmoveto | ||
| 646 | }forall | ||
| 647 | }def | ||
| 648 | |||
| 649 | /ReportFontInfo{ | ||
| 650 | 2 copy | ||
| 651 | /t0 3 1 roll DefFont | ||
| 652 | /t0 F | ||
| 653 | /lh FontHeight def | ||
| 654 | /sw ( ) stringwidth pop def | ||
| 655 | /aw (01234567890abcdefghijklmnopqrstuvwxyz) dup length exch | ||
| 656 | stringwidth pop exch div def | ||
| 657 | /t1 12 /Helvetica-Oblique DefFont | ||
| 658 | /t1 F | ||
| 659 | gsave | ||
| 660 | (languagelevel = ) show | ||
| 661 | gs_languagelevel 32 string cvs show | ||
| 662 | grestore | ||
| 663 | 0 FontHeight neg rmoveto | ||
| 664 | gsave | ||
| 665 | (For ) show | ||
| 666 | 128 string cvs show | ||
| 667 | ( ) show | ||
| 668 | 32 string cvs show | ||
| 669 | ( point, the line height is ) show | ||
| 670 | lh 32 string cvs show | ||
| 671 | (, the space width is ) show | ||
| 672 | sw 32 string cvs show | ||
| 673 | (,) show | ||
| 674 | grestore | ||
| 675 | 0 FontHeight neg rmoveto | ||
| 676 | gsave | ||
| 677 | (and a crude estimate of average character width is ) show | ||
| 678 | aw 32 string cvs show | ||
| 679 | (.) show | ||
| 680 | grestore | ||
| 681 | 0 FontHeight neg rmoveto | ||
| 682 | }def | ||
| 683 | |||
| 684 | /cm{ % cm to point | ||
| 685 | 72 mul 2.54 div | ||
| 686 | }def | ||
| 687 | |||
| 688 | /ReportAllFontInfo{ | ||
| 689 | FontDirectory | ||
| 690 | { % key = font name value = font dictionary | ||
| 691 | pop 10 exch ReportFontInfo | ||
| 692 | }forall | ||
| 693 | }def | ||
| 694 | |||
| 695 | % 3 cm 20 cm moveto 10 /Courier ReportFontInfo showpage | ||
| 696 | % 3 cm 20 cm moveto ReportAllFontInfo showpage | ||
| 697 | |||
| 698 | /ErrorMessages | ||
| 699 | [(This PostScript printer is not configured with this document page size.) | ||
| 700 | (Duplex printing is not supported on this PostScript printer.)]def | ||
| 701 | |||
| 702 | % stack: error-index proc |- -- | ||
| 703 | /CheckConfig{ | ||
| 704 | stopped{ | ||
| 705 | 1 cm LandscapePageHeight 0.5 mul moveto | ||
| 706 | /Courier findfont 10 scalefont setfont | ||
| 707 | gsave | ||
| 708 | (ps-print error:) show | ||
| 709 | grestore | ||
| 710 | 0 -10 rmoveto | ||
| 711 | ErrorMessages exch get show | ||
| 712 | showpage | ||
| 713 | $error /newerror false put | ||
| 714 | stop | ||
| 715 | }if | ||
| 716 | }bind def | ||
| 717 | |||
| 718 | % === END ps-print prologue 1 | ||
diff --git a/etc/ps-prin2.ps b/etc/ps-prin2.ps new file mode 100644 index 00000000000..e2685a972eb --- /dev/null +++ b/etc/ps-prin2.ps | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | % === BEGIN ps-print prologue 2 | ||
| 2 | |||
| 3 | % ---- These lines must be kept together because... | ||
| 4 | |||
| 5 | /h0 F | ||
| 6 | /HeaderTitleLineHeight FontHeight def | ||
| 7 | |||
| 8 | /h1 F | ||
| 9 | /HeaderLineHeight FontHeight def | ||
| 10 | /HeaderDescent Descent def | ||
| 11 | |||
| 12 | % ---- ...because `F' has a side-effect on `FontHeight' and `Descent' | ||
| 13 | |||
| 14 | % === END ps-print prologue 2 | ||
diff --git a/etc/ps-prin3.ps b/etc/ps-prin3.ps new file mode 100644 index 00000000000..c1da3503a78 --- /dev/null +++ b/etc/ps-prin3.ps | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | % === BEGIN ps-print prologue 3 | ||
| 2 | |||
| 3 | % --- duplex feature verification | ||
| 4 | 1 | ||
| 5 | UseSetpagedevice { | ||
| 6 | {<< /Duplex DuplexValue /Tumble TumbleValue >> setpagedevice} | ||
| 7 | }{ | ||
| 8 | {statusdict begin | ||
| 9 | DuplexValue setduplexmode TumbleValue settumble | ||
| 10 | end} | ||
| 11 | }ifelse | ||
| 12 | CheckConfig | ||
| 13 | |||
| 14 | % === END ps-print prologue 3 | ||