From 13f7391e4a38634221f4a63da9f58f58473e77b0 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 15 May 2004 23:45:13 +0000 Subject: More files! --- postscript/prologues/Default.enc | 343 ++++++++++++++++++++++++ postscript/prologues/Latin1.enc | 299 +++++++++++++++++++++ postscript/prologues/Nroundpage.ps | 11 + postscript/prologues/UTF.enc | 332 +++++++++++++++++++++++ postscript/prologues/aps.ps | 127 +++++++++ postscript/prologues/banner.ps | 40 +++ postscript/prologues/baseline.ps | 156 +++++++++++ postscript/prologues/color.ps | 65 +++++ postscript/prologues/cropmarks.ps | 131 ++++++++++ postscript/prologues/dpost.ps | 197 ++++++++++++++ postscript/prologues/draw.ps | 76 ++++++ postscript/prologues/duplex.ps | 4 + postscript/prologues/fatcourier.ps | 26 ++ postscript/prologues/forms.ps | 213 +++++++++++++++ postscript/prologues/grabit.ps | 522 +++++++++++++++++++++++++++++++++++++ postscript/prologues/hardcopy.ps | 196 ++++++++++++++ postscript/prologues/hp4simx.ps | 5 + postscript/prologues/patch.err.ps | 67 +++++ postscript/prologues/patch.xon.ps | 41 +++ postscript/prologues/pjw.char.ps | 142 ++++++++++ postscript/prologues/postdmd.ps | 124 +++++++++ postscript/prologues/postgif.ps | 104 ++++++++ postscript/prologues/postp9bit.ps | 86 ++++++ postscript/prologues/postprint.ps | 75 ++++++ postscript/prologues/posttek.ps | 106 ++++++++ postscript/prologues/printfont.ps | 321 +++++++++++++++++++++++ postscript/prologues/ps.requests | 16 ++ postscript/prologues/roundpage.ps | 30 +++ postscript/prologues/set_ip.ps | 30 +++ postscript/prologues/shade.ps | 52 ++++ postscript/prologues/unbind.ps | 28 ++ 31 files changed, 3965 insertions(+) create mode 100644 postscript/prologues/Default.enc create mode 100644 postscript/prologues/Latin1.enc create mode 100644 postscript/prologues/Nroundpage.ps create mode 100644 postscript/prologues/UTF.enc create mode 100644 postscript/prologues/aps.ps create mode 100644 postscript/prologues/banner.ps create mode 100644 postscript/prologues/baseline.ps create mode 100644 postscript/prologues/color.ps create mode 100644 postscript/prologues/cropmarks.ps create mode 100644 postscript/prologues/dpost.ps create mode 100644 postscript/prologues/draw.ps create mode 100644 postscript/prologues/duplex.ps create mode 100644 postscript/prologues/fatcourier.ps create mode 100644 postscript/prologues/forms.ps create mode 100644 postscript/prologues/grabit.ps create mode 100644 postscript/prologues/hardcopy.ps create mode 100644 postscript/prologues/hp4simx.ps create mode 100644 postscript/prologues/patch.err.ps create mode 100644 postscript/prologues/patch.xon.ps create mode 100644 postscript/prologues/pjw.char.ps create mode 100644 postscript/prologues/postdmd.ps create mode 100644 postscript/prologues/postgif.ps create mode 100644 postscript/prologues/postp9bit.ps create mode 100644 postscript/prologues/postprint.ps create mode 100644 postscript/prologues/posttek.ps create mode 100644 postscript/prologues/printfont.ps create mode 100644 postscript/prologues/ps.requests create mode 100644 postscript/prologues/roundpage.ps create mode 100644 postscript/prologues/set_ip.ps create mode 100644 postscript/prologues/shade.ps create mode 100644 postscript/prologues/unbind.ps (limited to 'postscript/prologues') diff --git a/postscript/prologues/Default.enc b/postscript/prologues/Default.enc new file mode 100644 index 00000000..e1f8c241 --- /dev/null +++ b/postscript/prologues/Default.enc @@ -0,0 +1,343 @@ +% +% Encoding vector, operator and procedure redefinitions for Plan 9 UTF +% encoding. Prologues are expected to take steps to ensure operator +% redefinitions given here are actually used. Current implementation +% assumes UTF byte streams that represent ASCII or Latin1 text. +% + +/UTFLatin1Encoding [ + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /space + /exclam + /quotedbl + /numbersign + /dollar + /percent + /ampersand + /quoteright + /parenleft + /parenright + /asterisk + /plus + /comma + /minus + /period + /slash + /zero + /one + /two + /three + /four + /five + /six + /seven + /eight + /nine + /colon + /semicolon + /less + /equal + /greater + /question + /at + /A + /B + /C + /D + /E + /F + /G + /H + /I + /J + /K + /L + /M + /N + /O + /P + /Q + /R + /S + /T + /U + /V + /W + /X + /Y + /Z + /bracketleft + /backslash + /bracketright + /asciicircum + /underscore + /quoteleft + /a + /b + /c + /d + /e + /f + /g + /h + /i + /j + /k + /l + /m + /n + /o + /p + /q + /r + /s + /t + /u + /v + /w + /x + /y + /z + /braceleft + /bar + /braceright + /asciitilde + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /dotlessi + /grave + /acute + /circumflex + /tilde + /macron + /breve + /dotaccent + /dieresis + /.notdef + /ring + /cedilla + /.notdef + /hungarumlaut + /ogonek + /caron + /space + /exclamdown + /cent + /sterling + /currency + /yen + /brokenbar + /section + /dieresis + /copyright + /ordfeminine + /guillemotleft + /logicalnot + /hyphen + /registered + /macron + /degree + /plusminus + /twosuperior + /threesuperior + /acute + /mu + /paragraph + /periodcentered + /cedilla + /onesuperior + /ordmasculine + /guillemotright + /onequarter + /onehalf + /threequarters + /questiondown + /Agrave + /Aacute + /Acircumflex + /Atilde + /Adieresis + /Aring + /AE + /Ccedilla + /Egrave + /Eacute + /Ecircumflex + /Edieresis + /Igrave + /Iacute + /Icircumflex + /Idieresis + /Eth + /Ntilde + /Ograve + /Oacute + /Ocircumflex + /Otilde + /Odieresis + /multiply + /Oslash + /Ugrave + /Uacute + /Ucircumflex + /Udieresis + /Yacute + /Thorn + /germandbls + /agrave + /aacute + /acircumflex + /atilde + /adieresis + /aring + /ae + /ccedilla + /egrave + /eacute + /ecircumflex + /edieresis + /igrave + /iacute + /icircumflex + /idieresis + /eth + /ntilde + /ograve + /oacute + /ocircumflex + /otilde + /odieresis + /divide + /oslash + /ugrave + /uacute + /ucircumflex + /udieresis + /yacute + /thorn + /ydieresis +] def + +/NewFontDirectory FontDirectory maxlength dict def + +% +% Apparently no guarantee findfont is defined in systemdict so the obvious +% +% systemdict /findfont get exec +% +% can generate an error. So far the only exception is a VT600 (version 48.0). +% + +userdict /@RealFindfont known not { + userdict begin + /@RealFindfont systemdict begin /findfont load end def + end +} if + +/findfont { + dup NewFontDirectory exch known not { + dup + %dup systemdict /findfont get exec % not always in systemdict + dup userdict /@RealFindfont get exec + dup /Encoding get StandardEncoding eq { + dup length 1 add dict begin + {1 index /FID ne {def}{pop pop} ifelse} forall + /Encoding UTFLatin1Encoding def + /Metrics 1 dict def + Metrics /.notdef 0 put + currentdict + end + /DummyFontName exch definefont + } if + NewFontDirectory 3 1 roll put + } if + NewFontDirectory exch get +} bind def + +% +% UTF string decoding for ASCII and Latin1 only: +% +% C2 XX => 00 XX +% C3 XX => XX+40 00 +% +% Two passes through each string with search is undoubtedly faster than +% PostScript that examines each byte. +% + +/UTFstring { + dup { + (\302) search { + pop + 0 0 put + }{pop exit} ifelse + } loop + dup { + (\303) search { + pop + 1 index 0 get 16#40 add 0 exch put + dup length 0 gt {dup 0 0 put} if + }{pop exit} ifelse + } loop +} bind def + +/ashow {mark 4 1 roll UTFstring //ashow cvx exec cleartomark} bind def +/awidthshow {mark 7 1 roll UTFstring //awidthshow cvx exec cleartomark} bind def +/show {mark exch UTFstring //show cvx exec cleartomark} bind def +/stringwidth {UTFstring //stringwidth cvx exec} bind def +/widthshow {mark 5 1 roll UTFstring //widthshow cvx exec cleartomark} bind def + +% +% kshow is harder - stack can't change because of the procedure. +% + +/kshow dup load type /operatortype eq + {{UTFstring kshow} bind} + {{UTFstring //kshow cvx exec} bind} +ifelse def + diff --git a/postscript/prologues/Latin1.enc b/postscript/prologues/Latin1.enc new file mode 100644 index 00000000..1e6e60b1 --- /dev/null +++ b/postscript/prologues/Latin1.enc @@ -0,0 +1,299 @@ +% +% Encoding vector and redefinition of findfont for the ISO Latin1 standard. +% The 18 characters missing from ROM based fonts on older printers are noted +% below. +% + +/ISOLatin1Encoding [ + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /space + /exclam + /quotedbl + /numbersign + /dollar + /percent + /ampersand + /quoteright + /parenleft + /parenright + /asterisk + /plus + /comma + /minus + /period + /slash + /zero + /one + /two + /three + /four + /five + /six + /seven + /eight + /nine + /colon + /semicolon + /less + /equal + /greater + /question + /at + /A + /B + /C + /D + /E + /F + /G + /H + /I + /J + /K + /L + /M + /N + /O + /P + /Q + /R + /S + /T + /U + /V + /W + /X + /Y + /Z + /bracketleft + /backslash + /bracketright + /asciicircum + /underscore + /quoteleft + /a + /b + /c + /d + /e + /f + /g + /h + /i + /j + /k + /l + /m + /n + /o + /p + /q + /r + /s + /t + /u + /v + /w + /x + /y + /z + /braceleft + /bar + /braceright + /asciitilde + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /dotlessi + /grave + /acute + /circumflex + /tilde + /macron + /breve + /dotaccent + /dieresis + /.notdef + /ring + /cedilla + /.notdef + /hungarumlaut + /ogonek + /caron + /space + /exclamdown + /cent + /sterling + /currency + /yen + /brokenbar % missing + /section + /dieresis + /copyright + /ordfeminine + /guillemotleft + /logicalnot + /hyphen + /registered + /macron + /degree % missing + /plusminus % missing + /twosuperior % missing + /threesuperior % missing + /acute + /mu % missing + /paragraph + /periodcentered + /cedilla + /onesuperior % missing + /ordmasculine + /guillemotright + /onequarter % missing + /onehalf % missing + /threequarters % missing + /questiondown + /Agrave + /Aacute + /Acircumflex + /Atilde + /Adieresis + /Aring + /AE + /Ccedilla + /Egrave + /Eacute + /Ecircumflex + /Edieresis + /Igrave + /Iacute + /Icircumflex + /Idieresis + /Eth % missing + /Ntilde + /Ograve + /Oacute + /Ocircumflex + /Otilde + /Odieresis + /multiply % missing + /Oslash + /Ugrave + /Uacute + /Ucircumflex + /Udieresis + /Yacute % missing + /Thorn % missing + /germandbls + /agrave + /aacute + /acircumflex + /atilde + /adieresis + /aring + /ae + /ccedilla + /egrave + /eacute + /ecircumflex + /edieresis + /igrave + /iacute + /icircumflex + /idieresis + /eth % missing + /ntilde + /ograve + /oacute + /ocircumflex + /otilde + /odieresis + /divide % missing + /oslash + /ugrave + /uacute + /ucircumflex + /udieresis + /yacute % missing + /thorn % missing + /ydieresis +] def + +/NewFontDirectory FontDirectory maxlength dict def + +% +% Apparently no guarantee findfont is defined in systemdict so the obvious +% +% systemdict /findfont get exec +% +% can generate an error. So far the only exception is a VT600 (version 48.0). +% + +userdict /@RealFindfont known not { + userdict begin + /@RealFindfont systemdict begin /findfont load end def + end +} if + +/findfont { + dup NewFontDirectory exch known not { + dup + %dup systemdict /findfont get exec % not always in systemdict + dup userdict /@RealFindfont get exec + dup /Encoding get StandardEncoding eq { + dup length dict begin + {1 index /FID ne {def}{pop pop} ifelse} forall + /Encoding ISOLatin1Encoding def + currentdict + end + /DummyFontName exch definefont + } if + NewFontDirectory 3 1 roll put + } if + NewFontDirectory exch get +} bind def + diff --git a/postscript/prologues/Nroundpage.ps b/postscript/prologues/Nroundpage.ps new file mode 100644 index 00000000..44a67a6d --- /dev/null +++ b/postscript/prologues/Nroundpage.ps @@ -0,0 +1,11 @@ +% +% A version of roundpage.ps that assumes a symmetric clipping path. Thanks +% to Matthijs Melchior for the suggestion. +% + +/roundpagebbox { + pagebbox dup 0 get pagebbox 2 get add 2 exch put + pagebbox dup 1 get pagebbox 3 get add 3 exch put + pagebbox 0 0 put + pagebbox 1 0 put +} bind def diff --git a/postscript/prologues/UTF.enc b/postscript/prologues/UTF.enc new file mode 100644 index 00000000..234764e3 --- /dev/null +++ b/postscript/prologues/UTF.enc @@ -0,0 +1,332 @@ +% +% Encoding vector, operator and procedure redefinitions for Plan 9 UTF +% encoding. Prologues are expected to take steps to ensure operator +% redefinitions given here are actually used. Current implementation +% assumes UTF byte streams that represent ASCII or Latin1 text. +% + +/UTFLatin1Encoding [ + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /space + /exclam + /quotedbl + /numbersign + /dollar + /percent + /ampersand + /quoteright + /parenleft + /parenright + /asterisk + /plus + /comma + /minus + /period + /slash + /zero + /one + /two + /three + /four + /five + /six + /seven + /eight + /nine + /colon + /semicolon + /less + /equal + /greater + /question + /at + /A + /B + /C + /D + /E + /F + /G + /H + /I + /J + /K + /L + /M + /N + /O + /P + /Q + /R + /S + /T + /U + /V + /W + /X + /Y + /Z + /bracketleft + /backslash + /bracketright + /asciicircum + /underscore + /quoteleft + /a + /b + /c + /d + /e + /f + /g + /h + /i + /j + /k + /l + /m + /n + /o + /p + /q + /r + /s + /t + /u + /v + /w + /x + /y + /z + /braceleft + /bar + /braceright + /asciitilde + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /.notdef + /dotlessi + /grave + /acute + /circumflex + /tilde + /macron + /breve + /dotaccent + /dieresis + /.notdef + /ring + /cedilla + /.notdef + /hungarumlaut + /ogonek + /caron + /.notdef % was space + /exclamdown + /cent + /sterling + /currency + /yen + /brokenbar + /section + /dieresis + /copyright + /ordfeminine + /guillemotleft + /logicalnot + /hyphen + /registered + /macron + /degree + /plusminus + /twosuperior + /threesuperior + /acute + /mu + /paragraph + /periodcentered + /cedilla + /onesuperior + /ordmasculine + /guillemotright + /onequarter + /onehalf + /threequarters + /questiondown + /Agrave + /Aacute + /Acircumflex + /Atilde + /Adieresis + /Aring + /AE + /Ccedilla + /Egrave + /Eacute + /Ecircumflex + /Edieresis + /Igrave + /Iacute + /Icircumflex + /Idieresis + /Eth + /Ntilde + /Ograve + /Oacute + /Ocircumflex + /Otilde + /Odieresis + /multiply + /Oslash + /Ugrave + /Uacute + /Ucircumflex + /Udieresis + /Yacute + /Thorn + /germandbls + /agrave + /aacute + /acircumflex + /atilde + /adieresis + /aring + /ae + /ccedilla + /egrave + /eacute + /ecircumflex + /edieresis + /igrave + /iacute + /icircumflex + /idieresis + /eth + /ntilde + /ograve + /oacute + /ocircumflex + /otilde + /odieresis + /divide + /oslash + /ugrave + /uacute + /ucircumflex + /udieresis + /yacute + /thorn + /ydieresis +] def + +/NewFontDirectory FontDirectory maxlength dict def + +% +% Apparently no guarantee findfont is defined in systemdict so the obvious +% +% systemdict /findfont get exec +% +% can generate an error. So far the only exception is a VT600 (version 48.0). +% + +userdict /@RealFindfont known not { + userdict begin + /@RealFindfont systemdict begin /findfont load end def + end +} if + +/findfont { + dup NewFontDirectory exch known not { + dup + %dup systemdict /findfont get exec % not always in systemdict + dup userdict /@RealFindfont get exec + dup /Encoding get StandardEncoding eq { + dup length 1 add dict begin + {1 index /FID ne {def}{pop pop} ifelse} forall + /Encoding UTFLatin1Encoding def + /Metrics 1 dict def + Metrics /.notdef 0 put + currentdict + end + /DummyFontName exch definefont + } if + NewFontDirectory 3 1 roll put + } if + NewFontDirectory exch get +} bind def + +% +% Assume A0, except for A0A0 which is replaced by 20A0, can be ignored. +% Works with ASCII or Latin1 because A0 has been re-encoded as a zero +% width non-printing character. +% + +/UTFstring { + dup { + (\240\240) search { + pop + 0 16#20 put + }{pop exit} ifelse + } loop +} bind def + +/ashow {mark 4 1 roll UTFstring //ashow cvx exec cleartomark} bind def +/awidthshow {mark 7 1 roll UTFstring //awidthshow cvx exec cleartomark} bind def +/show {mark exch UTFstring //show cvx exec cleartomark} bind def +/stringwidth {UTFstring //stringwidth cvx exec} bind def +/widthshow {mark 5 1 roll UTFstring //widthshow cvx exec cleartomark} bind def + +% +% kshow is harder - stack can't change because of the procedure. +% + +/kshow dup load type /operatortype eq + {{UTFstring kshow} bind} + {{UTFstring //kshow cvx exec} bind} +ifelse def + diff --git a/postscript/prologues/aps.ps b/postscript/prologues/aps.ps new file mode 100644 index 00000000..9ba0d309 --- /dev/null +++ b/postscript/prologues/aps.ps @@ -0,0 +1,127 @@ +% +% Tune things up so Linotronic output looks more like the APS-5. Pull this file +% into dpost output using the -C option. To get the best looking output run dpost +% with the -e2 option and use special font files that look like the APS tables but +% have character codes (ie. the fourth column in the width tables) appropriate for +% PostScript fonts. Widths in these tables must be for APS fonts! +% +% Start with fat versions of the stroked Courier and Courier-Oblique fonts - from +% Johnathan Shopiro. +% + +/newdict /Courier findfont length dict def +/Courier findfont { + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +newdict /StrokeWidth 65 put +/Courier newdict definefont pop + +/newdict /Courier-Oblique findfont length dict def +/Courier-Oblique findfont { + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +newdict /StrokeWidth 65 put +/Courier-Oblique newdict definefont pop + +% +% Scaled down versions of the Helvetica font family. +% + +/newdict /Helvetica findfont length dict def +/Helvetica findfont { + 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Helvetica newdict definefont pop + +/newdict /Helvetica-Oblique findfont length dict def +/Helvetica-Oblique findfont { + 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Helvetica-Oblique newdict definefont pop + +/newdict /Helvetica-Bold findfont length dict def +/Helvetica-Bold findfont { + 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Helvetica-Bold newdict definefont pop + +/newdict /Helvetica-BoldOblique findfont length dict def +/Helvetica-BoldOblique findfont { + 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Helvetica-BoldOblique newdict definefont pop + +% +% Scaled up versions of the Times font family. +% + +/newdict /Times-Roman findfont length dict def +/Times-Roman findfont { + 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Times-Roman newdict definefont pop + +/newdict /Times-Italic findfont length dict def +/Times-Italic findfont { + 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Times-Italic newdict definefont pop + +/newdict /Times-Bold findfont length dict def +/Times-Bold findfont { + 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Times-Bold newdict definefont pop + +/newdict /Times-BoldItalic findfont length dict def +/Times-BoldItalic findfont { + 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if + + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +/Times-BoldItalic newdict definefont pop + diff --git a/postscript/prologues/banner.ps b/postscript/prologues/banner.ps new file mode 100644 index 00000000..d5637416 --- /dev/null +++ b/postscript/prologues/banner.ps @@ -0,0 +1,40 @@ +% +% Simple program to print a banner page +% + +/banner { + /saveobj save def + erasepage initgraphics + + /#copies 1 def + /inch {72 mul} bind def + /pagebbox [clippath pathbbox newpath] def + + /font /Helvetica def + /size 20 def + /height pagebbox 3 get def + /width pagebbox 2 get .09 mul def + + .92 setgray + pagebbox 0 get pagebbox 1 get moveto + width 0 rlineto 0 height rlineto width neg 0 rlineto closepath eofill + pagebbox 2 get pagebbox 1 get moveto + width neg 0 rlineto 0 height rlineto width 0 rlineto closepath eofill + 0 setgray + + font findfont size scalefont setfont + /linesp size size .15 mul add neg def + /tab (Destination) stringwidth pop 1.5 mul def + /nextline {0 0 moveto show tab 0 moveto show 0 linesp translate} def + + pagebbox 0 get 1.5 width mul add pagebbox 3 get 2.0 width mul sub translate + (Bin) nextline + (Name) nextline + (Owner) nextline + (File) nextline + (Account) nextline + (Destination) nextline + (Spooldate) nextline + showpage + saveobj restore +} bind def diff --git a/postscript/prologues/baseline.ps b/postscript/prologues/baseline.ps new file mode 100644 index 00000000..470047c9 --- /dev/null +++ b/postscript/prologues/baseline.ps @@ -0,0 +1,156 @@ +% +% Stuff used to draw or set text along a baseline specified by parametric equations +% for x and y. +% + +/left -1 def +/center 0 def +/right 1 def + +/baselinedict 50 dict def + +/newbaseline { + baselinedict begin + /g' exch bind def + /f' exch bind def + /g exch bind def + /f exch bind def + + counttomark 2 eq {/hoffset exch def} if + /res exch def + + /t 0 def + /s 0 def + /voffset false def + cleartomark + end +} bind def + +/drawfunnytext { + baselinedict begin + /t exch def + /mode exch def + /str exch def + + mode left eq { + /leftstring emptystring def + /rightstring str def + } if + + mode right eq { + /leftstring str reversestring def + /rightstring emptystring def + } if + + mode center eq { + str splitstring + /rightstring exch def + /leftstring exch reversestring def + } if + + gsave currentpoint translate leftstring left t baselineshow grestore + gsave currentpoint translate rightstring right t baselineshow grestore + + /t 0 def + /s 0 def + /voffset false def + cleartomark + end +} bind def + +/setfunnytext { + baselinedict begin + /vpos exch def + /hpos exch def + /str exch def + + voffset vpos ne { + /voffset vpos def + /t 0 def + /s hoffset def + } if + + gsave + hoffset voffset translate + 0 0 moveto + /ds hpos s sub def + /dt ds t f' dup mul t g' dup mul add sqrt res mul div def + /s s ds add def + /t t dt add def + str right t baselineshow + grestore + end +} bind def + +baselinedict begin + +/f {} bind def +/g {pop 0} bind def +/f' {pop 1} bind def +/g' {pop 0} bind def + +/s 0 def +/t 0 def +/res 72 def + +/onecharstring ( ) def +/emptystring () def + +/baselineshow { + /t exch def + /mode exch def + /str exch def + + gsave + t f res mul t g res mul translate + 0 0 moveto + t g' t f' atan rotate + { + mode right eq {pop} if + grestore gsave + onecharstring 0 3 -1 roll put onecharstring stringwidth pop + /ds exch mode mul def + /dt ds t f' dup mul t g' dup mul add sqrt res mul div def + /t t dt add def + /s s ds add def + t f res mul t g res mul translate + 0 0 moveto + t g' t f' atan rotate + mode left eq {pop} if + } str kshow + grestore +} bind def + +/reversestring { + /str1 exch def + + /str2 str1 length string def + /i 0 def + /n str1 length 1 sub def + + { + str1 n get str2 exch i exch put + /i i 1 add def + /n n 1 sub def + n 0 lt {exit} if + } loop + str2 +} bind def + +/splitstring { + /str1 exch def + + /len str1 stringwidth pop def + /s 0 def + /n 0 def + str1 length { + str1 n get onecharstring exch 0 exch put + /s onecharstring stringwidth pop s add def + s len 2 div ge {exit} if + /n n 1 add def + } repeat + str1 0 n 1 add getinterval + str1 n str1 length n sub getinterval +} bind def + +end diff --git a/postscript/prologues/color.ps b/postscript/prologues/color.ps new file mode 100644 index 00000000..e304cc3a --- /dev/null +++ b/postscript/prologues/color.ps @@ -0,0 +1,65 @@ +% +% Color and reverse video support for dpost. A call made to setcolor with two +% arguments implies reverse video printing. +% + +/rgb {setrgbcolor} bind def +/hsb {sethsbcolor} bind def + +/colordict 50 dict dup begin + /red { 1 0 0 } def + /green { 0 1 0 } def + /blue { 0 0 1 } def + /cyan { 0 1 1 } def + /magenta { 1 0 1 } def + /yellow { 1 1 0 } def + /white { 1 1 1 } def + /black { 0 0 0 } def +end def + +/setcolor { + counttomark 1 eq { + dup colordict exch known not {pop /black} if + colordict exch get exec setrgbcolor + } if + counttomark 2 eq { + /backcolor exch def + /textcolor exch def + colordict backcolor known not colordict textcolor known not or { + /backcolor colordict /black get def + /textcolor colordict /white get def + } if + /backcolor colordict backcolor get def + /textcolor colordict textcolor get def + /dY1 0 def + /dY2 0 def + textcolor exec setrgbcolor + } if +} bind def + +/drawrvbox { + /x2 exch def + /x1 exch def + + currentpoint dup + /y1 exch def + /y2 exch def pop + + dY1 0 eq dY2 0 eq and { + currentfont /FontBBox get aload pop + currentfont /FontMatrix get dtransform /dY2 exch def pop + currentfont /FontMatrix get dtransform /dY1 exch def pop + } if + + /y1 y1 dY1 add def + /y2 y2 dY2 add def + + backcolor exec setrgbcolor + newpath + x1 y1 moveto + x2 y1 lineto + x2 y2 lineto + x1 y2 lineto + closepath fill + textcolor exec setrgbcolor +} bind def diff --git a/postscript/prologues/cropmarks.ps b/postscript/prologues/cropmarks.ps new file mode 100644 index 00000000..256891a9 --- /dev/null +++ b/postscript/prologues/cropmarks.ps @@ -0,0 +1,131 @@ +% +% Center pages, based on pageheight and pagewidth, and redefine showpage +% to put cropmarks at each corner. Device dependent code to expand the +% paper size goes in procedure expandpagesize. Currently only supports +% a Linotronic 200P typesetter using 12 inch wide paper. You'll have to +% add code to expandpagesize to support different typesetters or even a +% 200P that's running differently. +% + +/CropmarkDict 40 dict dup begin + +/expandpage true def +/magnification 1 def +/pageheight 11.0 def +/pagewidth 8.5 def +/scaletofit false def +/scaling 1 def + +/marklength .3 def % inches +/markstart .125 def % inches +/markend .04 def % inches +/marklinewidth .25 def % points + +/inch {72 mul} def +/min {2 copy gt {exch} if pop} def +/max {2 copy lt {exch} if pop} def + +/setup { + /markspace markstart marklength add markend add inch marklinewidth add def + /totalheight pageheight inch markspace 2 mul add def + /totalwidth pagewidth inch markspace 2 mul add def + + pagedimensions + checkpagesize + /scaling getscaling def + xcenter ycenter translate + scaling scaling scale + pagewidth inch 2 div neg pageheight inch 2 div neg translate + clippage +} def + +/pagedimensions { + clippath pathbbox newpath + 4 -1 roll exch 4 1 roll 4 copy + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def +} def + +/checkpagesize { + height totalheight lt width totalwidth lt or expandpage and { + expandpagesize + pagedimensions + } if +} def + +/expandpagesize { % device dependent code + /Product statusdict begin /product where {pop product}{()} ifelse end def + + Product (Linotype) eq { % Linotronic 200P and other models? + statusdict /setpageparams known { + /maxwidth 12.0 inch def % 12 inch wide paper? + totalheight maxwidth le { + totalheight + totalwidth + maxwidth totalheight sub 2 div + 0 + }{ + totalwidth maxwidth min + totalheight + maxwidth totalwidth maxwidth min sub 2 div + 1 + } ifelse + statusdict /setpageparams get exec + } if + } if +} def + +/getscaling { + scaletofit + {height totalheight div width totalwidth div min 1 min} + {1} + ifelse +} def + +/clippage { + newpath + 0 0 moveto + pagewidth inch 0 rlineto + 0 pageheight inch rlineto + pagewidth neg inch 0 rlineto + closepath clip + newpath +} def + +/cropmark { + gsave + translate + rotate + marklinewidth dup translate + 0 0 transform round exch round exch itransform translate + markstart inch 0 moveto marklength inch 0 rlineto stroke + 0 markstart inch moveto 0 marklength inch rlineto stroke + grestore +} bind def + +/@PreviousShowpage /showpage load def + +end def + +% +% Cropmarks - in the default coordinate system. +% + +/showpage { + gsave + CropmarkDict begin + initgraphics + marklinewidth setlinewidth + xcenter ycenter translate + scaling scaling scale + 0 pagewidth inch 2 div pageheight inch 2 div cropmark + 90 pagewidth inch neg 2 div pageheight inch 2 div cropmark + 180 pagewidth inch neg 2 div pageheight inch 2 div neg cropmark + 270 pagewidth inch 2 div pageheight inch 2 div neg cropmark + @PreviousShowpage + end + grestore +} bind def + diff --git a/postscript/prologues/dpost.ps b/postscript/prologues/dpost.ps new file mode 100644 index 00000000..31f98b29 --- /dev/null +++ b/postscript/prologues/dpost.ps @@ -0,0 +1,197 @@ +% +% Version 3.3.2 prologue for troff files. +% + +/#copies 1 store +/aspectratio 1 def +/formsperpage 1 def +/landscape false def +/linewidth .3 def +/magnification 1 def +/margin 0 def +/orientation 0 def +/resolution 720 def +/rotation 1 def +/xoffset 0 def +/yoffset 0 def + +/roundpage true def +/useclippath true def +/pagebbox [0 0 612 792] def + +/R /Times-Roman def +/I /Times-Italic def +/B /Times-Bold def +/BI /Times-BoldItalic def +/H /Helvetica def +/HI /Helvetica-Oblique def +/HB /Helvetica-Bold def +/HX /Helvetica-BoldOblique def +/CW /Courier def +/CO /Courier def +/CI /Courier-Oblique def +/CB /Courier-Bold def +/CX /Courier-BoldOblique def +/PA /Palatino-Roman def +/PI /Palatino-Italic def +/PB /Palatino-Bold def +/PX /Palatino-BoldItalic def +/Hr /Helvetica-Narrow def +/Hi /Helvetica-Narrow-Oblique def +/Hb /Helvetica-Narrow-Bold def +/Hx /Helvetica-Narrow-BoldOblique def +/KR /Bookman-Light def +/KI /Bookman-LightItalic def +/KB /Bookman-Demi def +/KX /Bookman-DemiItalic def +/AR /AvantGarde-Book def +/AI /AvantGarde-BookOblique def +/AB /AvantGarde-Demi def +/AX /AvantGarde-DemiOblique def +/NR /NewCenturySchlbk-Roman def +/NI /NewCenturySchlbk-Italic def +/NB /NewCenturySchlbk-Bold def +/NX /NewCenturySchlbk-BoldItalic def +/ZD /ZapfDingbats def +/ZI /ZapfChancery-MediumItalic def +/S /S def +/S1 /S1 def +/GR /Symbol def + +/inch {72 mul} bind def +/min {2 copy gt {exch} if pop} bind def + +/setup { + counttomark 2 idiv {def} repeat pop + + landscape {/orientation 90 orientation add def} if + /scaling 72 resolution div def + linewidth setlinewidth + 1 setlinecap + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + width 2 div neg height 2 div translate + xoffset inch yoffset inch neg translate + margin 2 div dup neg translate + magnification dup aspectratio mul scale + scaling scaling scale + + addmetrics + 0 0 moveto +} def + +/pagedimensions { + useclippath userdict /gotpagebbox known not and { + /pagebbox [clippath pathbbox newpath] def + roundpage currentdict /roundpagebbox known and {roundpagebbox} if + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def + userdict /gotpagebbox true put +} def + +/addmetrics { + /Symbol /S null Sdefs cf + /Times-Roman /S1 StandardEncoding dup length array copy S1defs cf +} def + +/pagesetup { + /page exch def + currentdict /pagedict known currentdict page known and { + page load pagedict exch get cvx exec + } if +} def + +/decodingdefs [ + {counttomark 2 idiv {y moveto show} repeat} + {neg /y exch def counttomark 2 idiv {y moveto show} repeat} + {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} + {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} + {counttomark 2 idiv {y moveto show} repeat} + {neg setfunnytext} +] def + +/setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def + +/w {neg moveto show} bind def +/m {neg dup /y exch def moveto} bind def +/done {/lastpage where {pop lastpage} if} def + +/f { + dup /font exch def findfont exch + dup /ptsize exch def scaling div dup /size exch def scalefont setfont + linewidth ptsize mul scaling 10 mul div setlinewidth + /spacewidth ( ) stringwidth pop def +} bind def + +/changefont { + /fontheight exch def + /fontslant exch def + currentfont [ + 1 0 + fontheight ptsize div fontslant sin mul fontslant cos div + fontheight ptsize div + 0 0 + ] makefont setfont +} bind def + +/sf {f} bind def + +/cf { + dup length 2 idiv + /entries exch def + /chtab exch def + /newencoding exch def + /newfont exch def + + findfont dup length 1 add dict + /newdict exch def + {1 index /FID ne {newdict 3 1 roll put}{pop pop} ifelse} forall + + newencoding type /arraytype eq {newdict /Encoding newencoding put} if + + newdict /Metrics entries dict put + newdict /Metrics get + begin + chtab aload pop + 1 1 entries {pop def} for + newfont newdict definefont pop + end +} bind def + +% +% A few arrays used to adjust reference points and character widths in some +% of the printer resident fonts. If square roots are too high try changing +% the lines describing /radical and /radicalex to, +% +% /radical [0 -75 550 0] +% /radicalex [-50 -75 500 0] +% +% Move braceleftbt a bit - default PostScript character is off a bit. +% + +/Sdefs [ + /bracketlefttp [201 500] + /bracketleftbt [201 500] + /bracketrighttp [-81 380] + /bracketrightbt [-83 380] + /braceleftbt [203 490] + /bracketrightex [220 -125 500 0] + /radical [0 0 550 0] + /radicalex [-50 0 500 0] + /parenleftex [-20 -170 0 0] + /integral [100 -50 500 0] + /infinity [10 -75 730 0] +] def + +/S1defs [ + /underscore [0 80 500 0] + /endash [7 90 650 0] +] def diff --git a/postscript/prologues/draw.ps b/postscript/prologues/draw.ps new file mode 100644 index 00000000..a991c11b --- /dev/null +++ b/postscript/prologues/draw.ps @@ -0,0 +1,76 @@ +% +% Version 3.3.2 drawing procedures for dpost. Automatically pulled in when +% needed. +% + +/inpath false def +/savematrix matrix def + +/Dl { + inpath + {neg lineto pop pop} + {newpath neg moveto neg lineto stroke} + ifelse +} bind def + +/De { + /y1 exch 2 div def + /x1 exch 2 div def + /savematrix savematrix currentmatrix def + neg exch x1 add exch translate + x1 y1 scale + 0 0 1 0 360 + inpath + {1 0 moveto arc savematrix setmatrix} + {newpath arc savematrix setmatrix stroke} + ifelse +} bind def + +/Da { + /dy2 exch def + /dx2 exch def + /dy1 exch def + /dx1 exch def + dy1 add neg exch dx1 add exch + dx1 dx1 mul dy1 dy1 mul add sqrt + dy1 dx1 neg atan + dy2 neg dx2 atan + inpath + {arc} + {newpath arc stroke} + ifelse +} bind def + +/DA { + /dy2 exch def + /dx2 exch def + /dy1 exch def + /dx1 exch def + dy1 add neg exch dx1 add exch + dx1 dx1 mul dy1 dy1 mul add sqrt + dy1 dx1 neg atan + dy2 neg dx2 atan + inpath + {arcn} + {newpath arcn stroke} + ifelse +} bind def + +/Ds { + /y2 exch def + /x2 exch def + /y1 exch def + /x1 exch def + /y0 exch def + /x0 exch def + x0 5 x1 mul add 6 div + y0 5 y1 mul add -6 div + x2 5 x1 mul add 6 div + y2 5 y1 mul add -6 div + x1 x2 add 2 div + y1 y2 add -2 div + inpath + {curveto} + {newpath x0 x1 add 2 div y0 y1 add -2 div moveto curveto stroke} + ifelse +} bind def diff --git a/postscript/prologues/duplex.ps b/postscript/prologues/duplex.ps new file mode 100644 index 00000000..99397cb5 --- /dev/null +++ b/postscript/prologues/duplex.ps @@ -0,0 +1,4 @@ +%!PS-Adobe-3.0 +statusdict /setduplexmode known { + statusdict begin true setduplexmode end +} if diff --git a/postscript/prologues/fatcourier.ps b/postscript/prologues/fatcourier.ps new file mode 100644 index 00000000..11d71881 --- /dev/null +++ b/postscript/prologues/fatcourier.ps @@ -0,0 +1,26 @@ +% +% Fat versions of the stroked Courier and Courier-Oblique - from Johnathan Shopiro. +% Can be selectively pulled in using the -C option that's available with all the +% PostScript translators or permanently added to any of the prologues. Helps on +% Linotronic typesetters, where Courier and Courier-Oblique are too light! +% + +/newdict /Courier findfont length 1 add dict def +/Courier findfont { + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +newdict /StrokeWidth 60 put +/Courier newdict definefont pop + +/newdict /Courier-Oblique findfont length 1 add dict def +/Courier-Oblique findfont { + 1 index /FID ne + {newdict 3 1 roll put} + {pop pop} + ifelse +} forall +newdict /StrokeWidth 60 put +/Courier-Oblique newdict definefont pop diff --git a/postscript/prologues/forms.ps b/postscript/prologues/forms.ps new file mode 100644 index 00000000..a96fcdae --- /dev/null +++ b/postscript/prologues/forms.ps @@ -0,0 +1,213 @@ +% +% Procedures that let you print any number of pages on each sheet of paper. It's +% far from perfect and won't handle everything (eg. it's not recursive), but should +% be good enough for now. Assumes the default page coordinate system has been set +% up before setupforms is called. lastpage makes certain the last page is printed, +% and should be called immediately after the %%Trailer comment. +% +% Three lines of code needed for page image clipping have been commented out for +% now. It works, but can really slow things down on some versions of PostScript. +% Uncomment them if you want to clip pages. +% + +/setupforms { + /formsperpage exch def + + /currentform 0 def + /slop 5 def + /min {2 copy gt {exch} if pop} def + +% +% Save the current environment so the real showpage can be restored when we're all +% done. Occasionally helps when a banner page is included with the job. +% + + /saveobj save def + +% +% Number of rows and columns we'll need - may exchange them later. +% + + /columns formsperpage sqrt ceiling cvi def + /rows formsperpage columns div ceiling cvi def + +% +% Slop leaves a little room around the edge so page images can be outlined and have +% the borders show up. Distance is in default coordinates, so we need to figure out +% how it maps into user coordinates. +% + + 6 array defaultmatrix + 6 array currentmatrix + 6 array invertmatrix + 6 array concatmatrix + /tempmatrix exch def + + 0 slop tempmatrix dtransform dup mul exch dup mul add sqrt + /slop exch def + +% +% Determine how big the image area is, using the clipping path bounding box minus +% a little and leave the coordinates of the lower left corner of the clipping path +% on the stack. Also temporarily set the size of each page (ie. formheight and +% formwidth) from the clipping path - just in case old software uses this stuff. +% Only works for coordinate systems that have been rotated by a multiple of 90 +% degrees. +% + + newpath clippath pathbbox + 2 index sub dup /formheight exch def slop 2 mul sub /pageheight exch def + 2 index sub dup /formwidth exch def slop 2 mul sub /pagewidth exch def + +% +% New translators all store the size of each page in default coordinates in the +% pagebbox array and it can be different than the size determined by the clipping +% path. If we can find pagebbox use it to set the real dimensions of each page. +% Leaves the coordinates of the lower left corner on the stack, (either from +% pagebbox or clippath) so four numbers are there when we're done. +% + + userdict /gotpagebbox known userdict /pagebbox known and { + newpath + pagebbox 0 get pagebbox 1 get tempmatrix transform moveto + pagebbox 0 get pagebbox 3 get tempmatrix transform lineto + pagebbox 2 get pagebbox 3 get tempmatrix transform lineto + pagebbox 2 get pagebbox 1 get tempmatrix transform lineto + closepath pathbbox + 2 index sub /formheight exch def + 2 index sub /formwidth exch def + } {2 copy} ifelse + +% +% Top two numbers are the displacement from the job's origin to the lower left +% corner of each page image when we finish setting up the new coordinate system. +% + + /ycorner exch def + /xcorner exch def + +% +% The two numbers left on the stack are the coordinates of the lower left corner +% of the clipping path. Go there and then up a bit so page images can be outlined. +% + + translate + slop slop translate + +% +% If the page is wider than high we may be able to do better if we exchange rows +% and columns. Won't make a difference in the current orientation or if rows and +% columns are the same. +% + + pagewidth pageheight gt { + rows columns /rows exch def /columns exch def + } if + +% +% Find the orientation and scaling that makes things as large as possible. More +% than what's really needed. First calculation essentially finds the minimum of +% 1/rows and 1/columns. +% + + pagewidth formwidth columns mul div pageheight formheight rows mul div min + pageheight formwidth columns mul div pagewidth formheight rows mul div min + + 2 copy lt { + rotation 1 eq { + landscape { + 0 pageheight translate + -90 rotate + }{ + pagewidth 0 translate + 90 rotate + } ifelse + }{ + landscape { + pagewidth 0 translate + 90 rotate + }{ + 0 pageheight translate + -90 rotate + } ifelse + } ifelse + pagewidth pageheight /pagewidth exch def /pageheight exch def + exch + } if + +% +% Second number from the top is the best choice. Scale so everything will fit on +% the current page, go back to the original origin, and then get ready for the +% first page - which goes in the upper left corner. +% + + pop dup dup scale + xcorner neg ycorner neg translate + 0 rows 1 sub formheight mul translate + +% +% Try to center everything on the page - scaling we used is on top of the stack. +% + + dup pagewidth exch div formwidth columns mul sub 2 div + exch pageheight exch div formheight rows mul sub 2 div translate + +% +% Redefine showpage. +% + + /!PreForms~showpage~ /showpage load def % save current showpage + + /showpage { + saveobj restore +% initclip + formsperpage 1 gt { + gsave .1 setlinewidth outlineform stroke grestore + } if + formwidth 0 translate + /currentform currentform 1 add def + currentform columns mod 0 eq { + columns formwidth mul neg formheight neg translate + } if + currentform formsperpage mod 0 eq { + gsave !PreForms~showpage~ grestore + currentform columns mod formwidth mul neg + formsperpage columns idiv formheight mul translate + /currentform 0 def + } if +% outlineform clip newpath + /saveobj save def + } bind def + + /outlineform { + newpath + xcorner ycorner moveto + formwidth 0 rlineto + 0 formheight rlineto + formwidth neg 0 rlineto + closepath + } bind def + + /lastpage { + formsperpage 1 gt { + currentform 0 ne { + /saveobj save def + 0 1 formsperpage currentform sub formsperpage mod { + pop showpage + } for + saveobj restore + } if + saveobj restore + saveobj restore + } if + } def + +% +% Clip the first page image and save the environment we just set up, including +% the redefined showpage. +% + +% outlineform clip + newpath + /saveobj save def +} def diff --git a/postscript/prologues/grabit.ps b/postscript/prologues/grabit.ps new file mode 100644 index 00000000..dab313c5 --- /dev/null +++ b/postscript/prologues/grabit.ps @@ -0,0 +1,522 @@ +% +% Dump a PostScript object, occasionally in a form that can be sent back +% through the interpreter. Similiar to Adobe's == procedure, but output +% is usually easier to read. No binding so operators like rcheck and exec +% can be conviently redefined. +% + +/GrabitDict 100 dict dup begin + +/recursive true def +/scratchstring 200 string def +/slowdown 100 def + +/column 0 def +/lastcolumn 80 def +/level 0 def +/multiline 100 array def +/nextname 0 def +/arraylength 0 def +/lengthonly false def + +/GrabitSetup { + counttomark {OmitNames exch true put} repeat pop + 0 0 moveto % for hardcopy output +} def + +/OmitNames 30 dict def % ignore these names +/OtherDicts 200 dict def % unrecognized dictionaries + +% +% All strings returned to the host go through Print. First pass through an +% array has lengthonly set to true. +% + +/Print { + dup type /stringtype ne {scratchstring cvs} if + lengthonly { + length arraylength add /arraylength exch def + }{ + dup length column add /column exch def + print flush + slowdown {1 pop} repeat + } ifelse +} def + +/Indent {level {( ) Print} repeat} def +/Newline {(\n) Print lengthonly not {/column 0 def} if} def + +/NextLevel {/level level 1 add def multiline level 0 put} def +/LastLevel {/level level 1 sub def} def + +% +% Make a unique name for each unrecognized dictionary and remember the name +% and dictionary in OtherDicts. +% + +/Register { + dup type /dicttype eq { + /nextname nextname 1 add def + dup (UnknownDict ) dup + (UnknownDict) length nextname ( ) cvs putinterval + 0 (UnknownDict) length nextname ( ) cvs length add getinterval cvn + exch OtherDicts 3 1 roll put + } if +} def + +% +% Replace array or dictionary values by known names. Lookups are in the +% standard PostScript dictionaries and in OtherDicts. If found replace +% the value by the name and make it executable so nametype omits the +% leading /. +% + +/Replace { + false + 1 index type /dicttype eq {pop true} if + 1 index type /arraytype eq 2 index xcheck not and {pop true} if + { + false + [userdict systemdict statusdict serverdict OtherDicts] { + { + 3 index eq + {exch pop exch pop cvx true exit} + {pop} + ifelse + } forall + dup {exit} if + } forall + pop + } if +} def + +% +% Simple type handlers. In some cases (e.g. savetype) what's returned can't +% be sent back through the interpreter. +% + +/booleantype {{(true )}{(false )} ifelse Print} def +/marktype {pop (mark ) Print} def +/nulltype {pop (null ) Print} def +/integertype {Print ( ) Print} def +/realtype {Print ( ) Print} def +/filetype {pop (-file- ) Print} def +/fonttype {pop (-fontID- ) Print} def +/savetype {pop (-saveobj- ) Print} def + +% +% Special formatting for operators is enabled if the flag in multiline +% (for the current level) is set to 1. In that case each operator, after +% being printed, is looked up in OperatorDict. If found the value is used +% as an index into the OperatorProcs array and the object at that index +% is retrieved and executed. Currently only used to choose the operators +% that end a line. +% + +/operatortype { + dup Print ( ) Print + multiline level get 1 eq { + scratchstring cvs cvn dup OperatorDict exch known { + OperatorDict exch get + OperatorProcs exch get exec + }{ + pop + column lastcolumn gt {Newline Indent} if + } ifelse + }{pop} ifelse +} def + +% +% Executable names are passed to operatortype. Non-executable names get a +% leading /. +% + +/nametype { + dup xcheck { + operatortype + }{ + (/) Print Print ( ) Print + } ifelse +} def + +% +% Arrays are processed in two passes. The first computes the length of the +% string returned to the host without any special formatting. If it extends +% past the last column special formatting is enabled by setting a flag in +% array multiline. Arrays are processed in a for loop so the last element +% easily recognized. At that point special fortmatting is disabled. +% + +/packedarraytype {arraytype} def + +/arraytype { + NextLevel + lengthonly not { + /lengthonly true def + /arraylength 0 def + dup dup type exec + arraylength 20 gt arraylength column add lastcolumn gt and { + multiline level 1 put + } if + /lengthonly false def + } if + + dup rcheck not { + (-array- ) Print pop + }{ + dup xcheck {({)}{([)} ifelse Print + multiline level get 0 ne {Newline Indent}{( ) Print} ifelse + 0 1 2 index length 1 sub { + 2 copy exch length 1 sub eq multiline level get 1 eq and { + multiline level 2 put + } if + 2 copy get exch pop + dup type /dicttype eq { + Replace + dup type /dicttype eq { + dup Register Replace + recursive { + 2 copy cvlit + /def load 3 1 roll + count 3 roll + } if + exch pop + } if + } if + dup type exec + dup xcheck not multiline level get 1 eq and { + 0 index type /arraytype eq + 1 index type /packedarray eq or + 1 index type /stringtype eq or {Newline Indent} if + } if + } for + multiline level get 0 ne {Newline LastLevel Indent NextLevel} if + xcheck {(} )}{(] )} ifelse Print + } ifelse + LastLevel +} def + +% +% Dictionary handler. Try to replace the value by a name before processing +% the dictionary. +% + +/dicttype { + dup + rcheck not { + (-dictionary- ) Print pop + }{ + dup maxlength Print ( dict dup begin) Print Newline + NextLevel + { + 1 index OmitNames exch known { + pop pop + }{ + Indent + Replace % arrays and dicts by known names + Register % new dictionaries in OtherDicts + exch + cvlit dup type exec % key first - force a / + dup type exec % then the value + (def) Print Newline + } ifelse + } forall + LastLevel + Indent + (end ) Print + } ifelse +} def + +% +% Strings containing characters not in AsciiDict are returned in hex. All +% others are ASCII strings and use AsciiDict for character mapping. +% + +/onecharstring ( ) def +/twocharstring ( ) def + +/stringtype { + dup + rcheck not { + (-string- ) Print + }{ + /hexit false def + dup { + onecharstring 0 3 -1 roll put + AsciiDict onecharstring cvn known not { + /hexit true def exit + } if + } forall + + hexit {(<)}{(\()} ifelse Print + 0 1 2 index length 1 sub { + 2 copy 1 getinterval exch pop + hexit { + 0 get /n exch def + n -4 bitshift 16#F and 16 twocharstring cvrs pop + n 16#F and twocharstring 1 1 getinterval 16 exch cvrs pop + twocharstring + }{cvn AsciiDict exch get} ifelse + Print + column lastcolumn gt { + hexit not {(\\) Print} if + Newline + } if + } for + hexit {(> )}{(\) )} ifelse Print + } ifelse + pop +} def + +% +% ASCII characters and replacement strings. Ensures the returned string will +% reproduce the original when passed through the scanner. Strings containing +% characters not in this list should be returned as hex strings. +% + +/AsciiDict 128 dict dup begin + (\n) cvn (\\n) def + (\r) cvn (\\r) def + (\t) cvn (\\t) def + (\b) cvn (\\b) def + (\f) cvn (\\f) def + ( ) cvn ( ) def + (!) cvn (!) def + (") cvn (") def + (#) cvn (#) def + ($) cvn ($) def + (%) cvn (\\%) def + (&) cvn (&) def + (') cvn (') def + (\() cvn (\\\() def + (\)) cvn (\\\)) def + (*) cvn (*) def + (+) cvn (+) def + (,) cvn (,) def + (-) cvn (-) def + (.) cvn (.) def + (/) cvn (/) def + (0) cvn (0) def + (1) cvn (1) def + (2) cvn (2) def + (3) cvn (3) def + (4) cvn (4) def + (5) cvn (5) def + (6) cvn (6) def + (7) cvn (7) def + (8) cvn (8) def + (9) cvn (9) def + (:) cvn (:) def + (;) cvn (;) def + (<) cvn (<) def + (=) cvn (=) def + (>) cvn (>) def + (?) cvn (?) def + (@) cvn (@) def + (A) cvn (A) def + (B) cvn (B) def + (C) cvn (C) def + (D) cvn (D) def + (E) cvn (E) def + (F) cvn (F) def + (G) cvn (G) def + (H) cvn (H) def + (I) cvn (I) def + (J) cvn (J) def + (K) cvn (K) def + (L) cvn (L) def + (M) cvn (M) def + (N) cvn (N) def + (O) cvn (O) def + (P) cvn (P) def + (Q) cvn (Q) def + (R) cvn (R) def + (S) cvn (S) def + (T) cvn (T) def + (U) cvn (U) def + (V) cvn (V) def + (W) cvn (W) def + (X) cvn (X) def + (Y) cvn (Y) def + (Z) cvn (Z) def + ([) cvn ([) def + (\\) cvn (\\\\) def + (]) cvn (]) def + (^) cvn (^) def + (_) cvn (_) def + (`) cvn (`) def + (a) cvn (a) def + (b) cvn (b) def + (c) cvn (c) def + (d) cvn (d) def + (e) cvn (e) def + (f) cvn (f) def + (g) cvn (g) def + (h) cvn (h) def + (i) cvn (i) def + (j) cvn (j) def + (k) cvn (k) def + (l) cvn (l) def + (m) cvn (m) def + (n) cvn (n) def + (o) cvn (o) def + (p) cvn (p) def + (q) cvn (q) def + (r) cvn (r) def + (s) cvn (s) def + (t) cvn (t) def + (u) cvn (u) def + (v) cvn (v) def + (w) cvn (w) def + (x) cvn (x) def + (y) cvn (y) def + (z) cvn (z) def + ({) cvn ({) def + (|) cvn (|) def + (}) cvn (}) def + (~) cvn (~) def +end def + +% +% OperatorDict can help format procedure listings. The value assigned to each +% name is used as an index into the OperatorProcs array. The procedure at that +% index is fetched and executed after the named operator is printed. What's in +% OperatorDict is a matter of taste rather than correctness. The default list +% represents our choice of which of Adobe's operators should end a line. +% + +/OperatorProcs [{} {Newline Indent}] def + +/OperatorDict 250 dict def + +OperatorDict /arc 1 put +OperatorDict /arcn 1 put +OperatorDict /ashow 1 put +OperatorDict /awidthshow 1 put +OperatorDict /banddevice 1 put +OperatorDict /begin 1 put +OperatorDict /charpath 1 put +OperatorDict /clear 1 put +OperatorDict /cleardictstack 1 put +OperatorDict /cleartomark 1 put +OperatorDict /clip 1 put +OperatorDict /clippath 1 put +OperatorDict /closefile 1 put +OperatorDict /closepath 1 put +OperatorDict /concat 1 put +OperatorDict /copypage 1 put +OperatorDict /curveto 1 put +OperatorDict /def 1 put +OperatorDict /end 1 put +OperatorDict /eoclip 1 put +OperatorDict /eofill 1 put +OperatorDict /erasepage 1 put +OperatorDict /exec 1 put +OperatorDict /exit 1 put +OperatorDict /fill 1 put +OperatorDict /flattenpath 1 put +OperatorDict /flush 1 put +OperatorDict /flushfile 1 put +OperatorDict /for 1 put +OperatorDict /forall 1 put +OperatorDict /framedevice 1 put +OperatorDict /grestore 1 put +OperatorDict /grestoreall 1 put +OperatorDict /gsave 1 put +OperatorDict /handleerror 1 put +OperatorDict /if 1 put +OperatorDict /ifelse 1 put +OperatorDict /image 1 put +OperatorDict /imagemask 1 put +OperatorDict /initclip 1 put +OperatorDict /initgraphics 1 put +OperatorDict /initmatrix 1 put +OperatorDict /kshow 1 put +OperatorDict /lineto 1 put +OperatorDict /loop 1 put +OperatorDict /moveto 1 put +OperatorDict /newpath 1 put +OperatorDict /nulldevice 1 put +OperatorDict /pathforall 1 put +OperatorDict /print 1 put +OperatorDict /prompt 1 put +OperatorDict /put 1 put +OperatorDict /putinterval 1 put +OperatorDict /quit 1 put +OperatorDict /rcurveto 1 put +OperatorDict /renderbands 1 put +OperatorDict /repeat 1 put +OperatorDict /resetfile 1 put +OperatorDict /restore 1 put +OperatorDict /reversepath 1 put +OperatorDict /rlineto 1 put +OperatorDict /rmoveto 1 put +OperatorDict /rotate 1 put +OperatorDict /run 1 put +OperatorDict /scale 1 put +OperatorDict /setcachedevice 1 put +OperatorDict /setcachelimit 1 put +OperatorDict /setcacheparams 1 put +OperatorDict /setcharwidth 1 put +OperatorDict /setdash 1 put +OperatorDict /setdefaulttimeouts 1 put +OperatorDict /setdostartpage 1 put +OperatorDict /seteescratch 1 put +OperatorDict /setflat 1 put +OperatorDict /setfont 1 put +OperatorDict /setgray 1 put +OperatorDict /sethsbcolor 1 put +OperatorDict /setidlefonts 1 put +OperatorDict /setjobtimeout 1 put +OperatorDict /setlinecap 1 put +OperatorDict /setlinejoin 1 put +OperatorDict /setlinewidth 1 put +OperatorDict /setmargins 1 put +OperatorDict /setmatrix 1 put +OperatorDict /setmiterlimit 1 put +OperatorDict /setpacking 1 put +OperatorDict /setpagetype 1 put +OperatorDict /setprintname 1 put +OperatorDict /setrgbcolor 1 put +OperatorDict /setsccbatch 1 put +OperatorDict /setsccinteractive 1 put +OperatorDict /setscreen 1 put +OperatorDict /settransfer 1 put +OperatorDict /show 1 put +OperatorDict /showpage 1 put +OperatorDict /start 1 put +OperatorDict /stop 1 put +OperatorDict /store 1 put +OperatorDict /stroke 1 put +OperatorDict /strokepath 1 put +OperatorDict /translate 1 put +OperatorDict /widthshow 1 put +OperatorDict /write 1 put +OperatorDict /writehexstring 1 put +OperatorDict /writestring 1 put + +end def + +% +% Put an object on the stack and call Grabit. Output continues until stack +% is empty. For example, +% +% /letter load Grabit +% +% prints a listing of the letter procedure. +% + +/Grabit { + /saveobj save def + GrabitDict begin + { + count 0 eq {exit} if + count {dup type exec} repeat + (\n) print flush + } loop + end + currentpoint % for hardcopy output + saveobj restore + moveto +} def + diff --git a/postscript/prologues/hardcopy.ps b/postscript/prologues/hardcopy.ps new file mode 100644 index 00000000..65eb24df --- /dev/null +++ b/postscript/prologues/hardcopy.ps @@ -0,0 +1,196 @@ +% +% Redefiniton of the PostScript file output operators so results go to paper. +% Complicated and slow, but the implementation doesn't place many demands on +% included PostScript. About all that's required is gentle treatment of the +% graphics state between write calls. +% + +/#copies 1 store +/aspectratio 1 def +/font /Courier def +/formsperpage 1 def +/landscape false def +/magnification 1 def +/orientation 0 def +/pointsize 10 def +/rotation 1 def +/xoffset .1 def +/yoffset .1 def + +/roundpage true def +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} def +/min {2 copy gt {exch} if pop} def + +/HardcopySetup { + landscape {/orientation 90 orientation add def} if + font findfont 1 1.1 div scalefont setfont + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + width 2 div neg height 2 div translate + xoffset inch yoffset inch neg translate + pointsize 1.1 mul dup scale + magnification dup aspectratio mul scale + height width div 1 min dup scale + 0 -1 translate + 0 0 moveto +} def + +/pagedimensions { + useclippath { + /pagebbox [clippath pathbbox newpath] def + roundpage currentdict /roundpagebbox known and {roundpagebbox} if + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def +} def + +% +% Unbind the operators in an executable array or packedarray. Leaves the +% unbound array or the original object on the stack. +% + +/Unbind { + 0 index xcheck + 1 index type /arraytype eq + 2 index type /packedarraytype eq or and { + dup length array copy cvx + dup 0 exch { + dup type /operatortype eq { + ( ) cvs cvn cvx + } if + + dup type /dicttype eq { + dup maxlength dict exch { + Unbind + 3 copy put pop pop + } forall + } if + + 0 index xcheck + 1 index type /arraytype eq + 2 index type /packedarraytype eq or and { + Unbind + } if + + 3 copy put pop + 1 add + } forall + pop + } if +} def + +% +% New write operator - don't bind the definition! Expands tabs and backspaces, +% wraps long lines, and starts a new page whenever necessary. The code that +% handles newlines assumes lines are separated by one vertical unit. +% + +/write { + true exch + + %%case '\b': + dup 8#10 eq { + ( ) stringwidth pop neg 0 rmoveto + currentpoint pop 0 lt { + currentpoint exch pop 0 exch moveto + } if + exch pop false exch + } if + + %%case '\t': + dup 8#11 eq { + currentpoint pop ( ) stringwidth pop div round cvi + 8 mod 8 exch sub { + 2 index 8#40 write + } repeat + exch pop false exch + } if + + %%case '\n': + dup 8#12 eq { + currentpoint 0 exch 1 sub moveto pop + + gsave clippath pathbbox pop pop exch pop grestore + currentpoint exch pop 1 sub ge { + 2 index 8#14 write + } if + exch pop false exch + } if + + %%case '\f': + dup 8#14 eq { + gsave showpage grestore + 0 0 moveto + exch pop false exch + } if + + %%case '\r': + dup 8#15 eq { + currentpoint 0 exch moveto pop + exch pop false exch + } if + + %%case EOF: + dup -1 eq { + currentpoint 0 ne exch 0 ne or { + 2 index 8#14 write + } if + exch pop false exch + } if + + %%default: + exch { + dup + gsave clippath pathbbox pop 3 1 roll pop pop grestore + ( ) stringwidth pop currentpoint pop add le { + 2 index 8#12 write + } if + ( ) dup 0 4 -1 roll put show + } if + + pop % the character + pop % and file object +} def + +% +% All the other file output operators call our redefined write operator. +% + +/print { + (%stdout) (w) file exch {1 index exch write} forall + pop +} def + +/writestring { + {1 index exch write} forall + pop +} def + +/writehexstring { + (0123456789ABCDEF) 3 1 roll { + dup + 3 index exch -4 bitshift 16#F and get 2 index exch write + 2 index exch 16#F and get 1 index exch write + } forall + pop pop +} def + +% +% Unbind and redefine the remaining file output procedures. +% + +/= dup load Unbind def +/== dup load Unbind def +/stack dup load Unbind def +/pstack dup load Unbind def + diff --git a/postscript/prologues/hp4simx.ps b/postscript/prologues/hp4simx.ps new file mode 100644 index 00000000..6275509c --- /dev/null +++ b/postscript/prologues/hp4simx.ps @@ -0,0 +1,5 @@ +%!PS-Adobe-3.0 +serverdict begin 0 exitserver +statusdict begin + 1 setdefaultpapertray +end diff --git a/postscript/prologues/patch.err.ps b/postscript/prologues/patch.err.ps new file mode 100644 index 00000000..f9f2fabb --- /dev/null +++ b/postscript/prologues/patch.err.ps @@ -0,0 +1,67 @@ +%!PS-Adobe +% lib/ehandler.ps -- Downloaded Error Break-page handler +% Copyright (c) 1984, 1985, 1986 Adobe Systems Incorporated. +% All Rights Reserved. + +0000 % serverloop password +/$brkpage where +{pop pop(Error Handler in place - not loaded again\n)print flush stop} +{dup serverdict begin statusdict begin checkpassword + {(Error Handler downloaded.\n)print flush exitserver} + {pop(Bad Password on loading error handler!!!\n)print flush stop}ifelse +}ifelse +/$brkpage 64 dict def $brkpage begin +/prnt + {dup type/stringtype ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def + currentpoint/toy exch def/tox exch def 1 setgray newpath + tox toy 2 sub moveto 0 ty rlineto tx 0 rlineto 0 ty neg rlineto + closepath fill tox toy moveto 0 setgray show}bind def +/nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def +/=={/cp 0 def typeprint nl}def +/typeprint{dup type dup currentdict exch known + {exec}{unknowntype}ifelse}readonly def +/lmargin 72 def/rmargin 72 def +/tprint{dup length cp add rmargin gt{nl/cp 0 def}if + dup length cp add/cp exch def prnt}readonly def +/cvsprint{=string cvs tprint( )tprint}readonly def +/unknowntype{exch pop cvlit(??)tprint cvsprint}readonly def +/integertype{cvsprint}readonly def +/realtype{cvsprint}readonly def +/booleantype{cvsprint}readonly def +/operatortype{(//)tprint cvsprint}readonly def +/marktype{pop(-mark- )tprint}readonly def +/dicttype{pop(-dictionary- )tprint}readonly def +/nulltype{pop(-null- )tprint}readonly def +/filetype{pop(-filestream- )tprint}readonly def +/savetype{pop(-savelevel- )tprint}readonly def +/fonttype{pop(-fontid- )tprint}readonly def +/nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def +/stringtype + {dup rcheck{(\()tprint tprint(\))tprint}{pop(-string- )tprint}ifelse + }readonly def +/arraytype + {dup rcheck{dup xcheck + {({)tprint{typeprint}forall(})tprint} + {([)tprint{typeprint}forall(])tprint}ifelse}{pop(-array- )tprint}ifelse + }readonly def +/packedarraytype + {dup rcheck{dup xcheck + {({)tprint{typeprint}forall(})tprint} + {([)tprint{typeprint}forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse + }readonly def +/courier/Courier findfont 10 scalefont def +/OLDhandleerror errordict /handleerror get def +end %$brkpage +errordict/handleerror + {<< /PageSize [612 792] /ImagingBBox null >> setpagedevice + systemdict begin $error begin $brkpage begin newerror + {/newerror false store + vmstatus pop pop 0 ne{grestoreall}if initgraphics courier setfont + lmargin 720 moveto(ERROR: )prnt errorname prnt + nl(OFFENDING COMMAND: )prnt/command load prnt + $error/ostack + known{nl nl(STACK:)prnt nl nl $error/ostack get aload length{==}repeat}if + systemdict/showpage get exec + /newerror true store/OLDhandleerror load end end end exec}{end end end} + ifelse} +dup 0 systemdict put dup 4 $brkpage put bind readonly put diff --git a/postscript/prologues/patch.xon.ps b/postscript/prologues/patch.xon.ps new file mode 100644 index 00000000..cc9fde1f --- /dev/null +++ b/postscript/prologues/patch.xon.ps @@ -0,0 +1,41 @@ +%! +0000000000 % the exitserver password + +version (23.0) ne + {(Patch not installed -- wrong printer type or version) = stop} if +statusdict /Patch1Installed known + {(Patch already installed -- not installed again) = stop} if +serverdict begin exitserver +statusdict /Patch1Installed true put +currentfile eexec +ce1b9f428ac69e75cc47a554265ae625851e0154ac649ad44c1c34e4c60a0493 +a80212a3bd61248f8859cb1252a7320775a6d4ec524bcbf5771aceb8f61ea2fb +48fcb3df8da0f105be40f697239ef0976f92c1d41e915a7389200a3e896cd955 +d197ff27f22a617c85bce7ed59ef1a6062d01d0fdee5b4e7d298997638497cc6 +a2d56a0eacc195795949f515bbbda9cfe899e43ad257da93f3144797b00dbb81 +8a41b4fa56a0295c25e693864084cbb5d63834f1d94a46816d4a2cbe005cc57c +38491a6a34cfbdef303ed8731dbbe84dc6f8e1e790f3d89360d063639c8411fd +89ad7c53d1b9732bd0942bc36257208d24792ea7c66790b6104c3a2b794a1460 +c476ffdb5552f428f457b47319cccb0c9980036402eaca80c0b5e0ccb5f579df +09cc6f382b536aa64da7152356c377a5b708a378e855a7ec3eccd848d5508dbf +5c7bd28c2899e9cfd7f4ff3d7ddc08006cce42b2d8c59ef64af8ec74a2f9d23f +e8d4d03ba1e2686138fffc2af9c662c994ec8065a32144ba9ac5002623b39012 +521eb49cd829c3506af2895bf275367eb4d31908b14f3b1e0abfaca2f98eb9d8 +8d84ac8271ef44def53d8207ce9653d598fe8046120f223bfca0b5c74a54f70b +eb5a0bc09d8e79742048b875864a3b489eb91c09b701f506e994271a6640f78a +d131f1eef3c96e546f7273fb3533799a6470be2ed3b8f2e211bf9f9f209edbd2 +36c19d4b0b3f28ab16c39faa17070699543c212c76081961c949ebd32ada3c93 +ccdc56c2c940a2061bc11794a0159cc37255aa8c8e7e08d78f204161f1eccb7d +ad3313b737e921b7df1fe794e9a7fc2226702ee555ceb8e803a20ebeaa440a40 +9e1f1a72412586e3071292b10e938e7f386b8e6516758633bab57223e071b1de +8c4b73cafababc0af7bc902e8763a2817861591d7ee98f85bc28ad0ea4d13660 +d3256aa293df1959b7b57b13edee653cfdda2fafe0698898dc5e371ca4c5b72b +b92750d0eea5e74955712b06958663f424a46cf75a797590f0d2a36842fe07e3 +db459215dab6e461a4c3fbb40ee2499af3fe4b13790de87e11afde6aadd12e77 +d84d8076146d797269c9188d8fb725898aee284e62c472e0e7b585ef3fed434c +000b0bb70ad6806e840cfe872ec3f28782dd08b70d29c2da2187e2dc0f13dfc0 +89f75344e3dad78a1c9b909fc72bdd92421afdc8b80850ff0d43605edfd9be56 +d81cb17250ce7208354548f6ccc62366e8196d4adeb2d24fd5ce47bb6295fa72 +c361197cafacbd51efd36dfa59c6f8e6cab8915a8043d609eb64726de86080d2 +4118cc69e01eab0f4ef1f364c815f306d5f43420cf7c9316e5ee69c7183dd8d2 +805a9dfe6abb33c46d3a212d5c6b6fd68418eef971 diff --git a/postscript/prologues/pjw.char.ps b/postscript/prologues/pjw.char.ps new file mode 100644 index 00000000..55308618 --- /dev/null +++ b/postscript/prologues/pjw.char.ps @@ -0,0 +1,142 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%BoundingBox: 1 -1 199 258 +%%Creator: MetaPost +%%CreationDate: 1994.06.28:1046 +/pjw1 { +37 211 moveto +37 206 lineto +41 206 lineto +43 212 lineto +44 212 46 212 46 210 curveto +41 198 35 186 35 174 curveto +50 174 66 175 81 173 curveto +81 171 lineto +61 171 lineto +61 170 lineto +86 170 lineto +88 168 89 166 90 164 curveto +101 164 111 169 122 172 curveto +139 172 lineto +125 194 115 219 93 233 curveto +87 234 80 236 74 235 curveto +64 229 54 224 46 217 curveto +45 217 44 217 44 218 curveto +61 242 lineto +67 248 72 258 82 258 curveto +94 257 107 256 119 254 curveto +134 247 147 239 161 231 curveto +180 231 lineto +180 226 174 228 171 226 curveto +178 220 185 214 192 207 curveto +189 207 187 207 187 205 curveto +190 205 193 204 196 203 curveto +198 193 202 181 193 181 curveto +193 177 198 175 198 171 curveto +196 171 194 171 194 169 curveto +195 165 196 161 198 157 curveto +194 147 193 135 184 130 curveto +180 130 lineto +169 107 lineto +171 103 176 104 180 104 curveto +180 93 176 81 166 76 curveto +162 76 157 77 155 80 curveto +153 80 152 80 151 80 curveto +151 71 lineto +155 71 lineto +155 68 153 65 152 63 curveto +145 62 lineto +141 47 144 31 144 15 curveto +141 0 lineto +124 0 107 -1 90 1 curveto +72 36 lineto +86 48 105 49 122 54 curveto +122 54 lineto +110 61 97 65 84 69 curveto +81 71 78 73 78 76 curveto +86 77 93 77 101 77 curveto +106 79 113 79 113 84 curveto +95 86 77 87 59 89 curveto +59 92 61 95 64 95 curveto +69 88 80 92 89 92 curveto +95 92 104 90 104 96 curveto +93 97 lineto +87 103 82 109 77 115 curveto +89 116 101 117 113 118 curveto +99 154 lineto +90 154 87 144 82 138 curveto +77 132 73 124 66 120 curveto +63 120 59 119 59 122 curveto +62 123 66 123 66 126 curveto +58 126 50 127 42 128 curveto +34 137 lineto +34 140 34 144 31 144 curveto +30 135 31 125 31 116 curveto +25 116 22 122 19 127 curveto +16 131 15 136 12 139 curveto +5 139 15 127 9 127 curveto +3 133 3 142 1 150 curveto +1 158 6 166 9 173 curveto +18 186 25 199 35 211 curveto +closepath +} bind def + +/pjw2 { +27 112 moveto +40 75 lineto +40 74 38 73 37 73 curveto +25 87 lineto +17 112 lineto +closepath +43 154 moveto +43 167 lineto +41 167 38 167 39 169 curveto +57 171 lineto +74 167 lineto +74 166 73 165 72 165 curveto +64 164 56 162 49 158 curveto +48 154 45 149 49 149 curveto +51 151 53 152 55 154 curveto +87 153 lineto +87 144 80 136 74 129 curveto +64 128 53 126 43 129 curveto +37 135 lineto +37 138 36 141 36 145 curveto +40 145 lineto +41 148 42 151 43 154 curveto closepath +108 145 moveto +119 145 130 143 141 140 curveto +146 134 155 129 149 126 curveto +138 124 126 123 116 129 curveto +113 134 108 139 108 145 curveto +closepath +114 96 moveto +116 103 118 110 121 117 curveto +128 117 134 112 139 107 curveto +139 101 137 96 132 93 curveto +closepath +134 162 moveto +115 162 lineto +115 162 115 163 115 164 curveto +134 164 lineto +closepath +117 73 moveto +115 78 121 81 125 85 curveto +129 85 lineto +130 83 131 81 131 79 curveto +128 74 lineto +124 74 121 73 117 73 curveto closepath +141 119 moveto +134 119 126 117 126 123 curveto +131 123 136 122 141 121 curveto +closepath +} bind def + +/pw { +%% pop +gsave +pointsize .0022 mul dup scale +currentpoint translate + pjw1 pjw2 eofill +grestore +6 0 rmoveto +} bind def diff --git a/postscript/prologues/postdmd.ps b/postscript/prologues/postdmd.ps new file mode 100644 index 00000000..fa312af0 --- /dev/null +++ b/postscript/prologues/postdmd.ps @@ -0,0 +1,124 @@ +% +% Version 3.3.2 prologue for DMD bitmap files. +% + +/#copies 1 store +/aspectratio 1 def +/formsperpage 1 def +/landscape false def +/magnification 1 def +/margin 0 def +/orientation 0 def +/rotation 1 def +/screenres 100 def +/xoffset 0 def +/yoffset 0 def + +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} bind def +/min {2 copy gt {exch} if pop} bind def + +/setup { + counttomark 2 idiv {def} repeat pop + + landscape {/orientation 90 orientation add def} if + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + xoffset inch yoffset inch translate + magnification dup aspectratio mul scale + + /height height margin sub def + /width width margin sub def +} def + +/pagedimensions { + useclippath { + /pagebbox [clippath pathbbox newpath] def + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def + userdict /gotpagebbox true put +} def + +/pagesetup {/page exch def} bind def + +/bitmap { + /scanlines exch def + /scanlength exch def + /flip exch def + /v8format exch def + + /bytelength scanlength 8 idiv def + /picstr bytelength string def + /lpicstr bytelength string def + /bytelength bytelength 1 sub def + + gsave + +% First the overall scaling. + + height scanlines div width scanlength div min + 72 screenres div min + dup scale + +% Followed by the one for the unit square. + + scanlength neg 2 div scanlines neg 2 div translate + scanlength scanlines scale + v8format {getv8bitmap} {getbitmap} ifelse + grestore +} bind def + +/getbitmap { + scanlength scanlines flip [scanlength 0 0 scanlines neg 0 scanlines] { + 0 { + currentfile token pop dup + 0 eq {pop pop exit} if + /charcount exch def + picstr 1 index charcount getinterval + /repl exch def + currentfile repl readhexstring pop pop + charcount add + currentfile token pop { + picstr 1 index repl putinterval + charcount add + } repeat + } loop + picstr + } imagemask +} bind def + +/getv8bitmap { + scanlength scanlines flip not [scanlength 0 0 scanlines neg 0 scanlines] { + 0 { + currentfile token pop dup + 0 eq {pop pop exit} if + /charcount exch def + picstr 1 index charcount getinterval + /repl exch def + currentfile repl readhexstring pop pop + charcount add + currentfile token pop { + picstr 1 index repl putinterval + charcount add + } repeat + } loop + 0 0 picstr { + exch lpicstr exch get xor + lpicstr exch 2 index exch put + 1 add dup + } forall + pop pop lpicstr + } imagemask +} bind def + +/done {/lastpage where {pop lastpage} if} def diff --git a/postscript/prologues/postgif.ps b/postscript/prologues/postgif.ps new file mode 100644 index 00000000..9827857f --- /dev/null +++ b/postscript/prologues/postgif.ps @@ -0,0 +1,104 @@ +% +% Version 3.3.2 prologue for GIF pixmap files. +% + +/#copies 1 store +/aspectratio 1 def +/formsperpage 1 def +/landscape false def +/magnification 1 def +/margin 0 def +/orientation 0 def +/rotation 1 def +/xoffset 0 def +/yoffset 0 def + +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} bind def +/min {2 copy gt {exch} if pop} bind def + +/setup { + counttomark 2 idiv {def} repeat pop + + landscape {/orientation 90 orientation add def} if + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + xoffset inch yoffset inch translate + magnification dup aspectratio mul scale + + /height height margin sub def + /width width margin sub def +} def + +/pagedimensions { + useclippath { + /pagebbox [clippath pathbbox newpath] def + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def + userdict /gotpagebbox true put +} def + +/pagesetup {/page exch def} bind def + +/done {/lastpage where {pop lastpage} if} def + +/alignment false def + +/gifscreen { % scrwidth scrheight $ + 2 copy + + alignment { + 100 dup dtransform exch 100 exch div abs exch 100 exch div abs + 2 copy scale + /height exch height exch div def + /width exch width exch div def + } if + + height exch div exch width exch div + 2 copy lt { pop } { exch pop } ifelse + + alignment { cvi } if + + dup scale + + neg 2 div exch neg 2 div exch translate +} def + +/gifimage { % gray imagewidth imageheight xorigin yorigin $ + translate + 2 copy scale + /imageheight exch def + /imagewidth exch def + /gray exch def + imagewidth imageheight 8 [imagewidth 0 0 imageheight neg 0 imageheight] + gray { + { currentfile codestr readhexstring pop } image + } { + /colorimage where { + pop + /picstr imagewidth 3 mul string def + { currentfile codestr readhexstring pop pop + 0 1 imagewidth 1 sub { + picstr exch dup 3 mul exch colortbl exch codestr exch get + 3 mul 3 getinterval putinterval + } for picstr + } false 3 colorimage + } { + { currentfile codestr readhexstring pop pop + 0 1 imagewidth 1 sub { + codestr exch dup graytbl exch codestr exch get get put + } for codestr + } image + } ifelse + } ifelse +} def diff --git a/postscript/prologues/postp9bit.ps b/postscript/prologues/postp9bit.ps new file mode 100644 index 00000000..ee646331 --- /dev/null +++ b/postscript/prologues/postp9bit.ps @@ -0,0 +1,86 @@ +% +% Version 3.3 prologue for plan9 bitmap files. +% + +/#copies 1 store +/aspectratio 1 def +/formsperpage 1 def +/landscape false def +/magnification 1 def +/margin 0 def +/orientation 0 def +/rotation 1 def +/screenres 100 def +/xoffset 0 def +/yoffset 0 def + +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} bind def +/min {2 copy gt {exch} if pop} bind def + +/setup { + counttomark 2 idiv {def} repeat pop + + landscape {/orientation 90 orientation add def} if + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + xoffset inch yoffset inch translate + magnification dup aspectratio mul scale + + /height height margin sub def + /width width margin sub def +} def + +/pagedimensions { + useclippath { + /pagebbox [clippath pathbbox newpath] def + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def + userdict /gotpagebbox true put +} def + +/pagesetup {/page exch def} bind def + +/bitmap { + /scanlines exch def + /scanlength exch def + /bitspersample exch def +%% /v8format exch def + + /bytelength scanlength bitspersample mult 7 add 8 idiv def + /picstr bytelength string def + /lpicstr bytelength string def +%% /bytelength bytelength 1 sub def + + gsave + +% First the overall scaling. + + height scanlines div width scanlength div min + 72 screenres div min + dup scale + +% Followed by the one for the unit square. + + scanlength neg 2 div scanlines neg 2 div translate + scanlength scanlines scale + getp9bitmap + grestore +} bind def + +/getp9bitmap { + scanlength scanlines bitspersample [scanlength 0 0 scanlines neg 0 scanlines] { + currentfile picstr readhexstring pop} image +} bind def + +/done {/lastpage where {pop lastpage} if} def diff --git a/postscript/prologues/postprint.ps b/postscript/prologues/postprint.ps new file mode 100644 index 00000000..315b5639 --- /dev/null +++ b/postscript/prologues/postprint.ps @@ -0,0 +1,75 @@ +% +% Version 3.3.2 prologue for text files. +% + +/#copies 1 store +/aspectratio 1 def +/font /Courier def +/formsperpage 1 def +/landscape false def +/magnification 1 def +/margin 10 def +/orientation 0 def +/pointsize 10 def +/rotation 1 def +/xoffset .25 def +/yoffset .25 def + +/roundpage true def +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} bind def +/min {2 copy gt {exch} if pop} bind def + +/show {show} bind def % so later references don't bind +/stringwidth {stringwidth} bind def + +/setup { + counttomark 2 idiv {def} repeat pop + + landscape {/orientation 90 orientation add def} if + font findfont pointsize scalefont setfont + /charwidth (M) stringwidth pop def + /linespace pointsize pointsize .10 mul add neg def + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + width 2 div neg height 2 div translate + xoffset inch yoffset inch neg translate + margin 2 div dup neg translate + magnification dup aspectratio mul scale + height width div 1 min dup scale + 0 linespace translate +} def + +/pagedimensions { + useclippath userdict /gotpagebbox known not and { + /pagebbox [clippath pathbbox newpath] def + roundpage currentdict /roundpagebbox known and {roundpagebbox} if + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def + userdict /gotpagebbox true put +} def + +/pagesetup {/page exch def 0 0 moveto 0} bind def + +/L { + counttomark 2 idiv {charwidth mul currentpoint exch pop moveto show} repeat + linespace add dup 0 exch moveto +} bind def + +/l {show linespace add dup 0 exch moveto} bind def + +/LL { + counttomark 2 idiv {charwidth mul currentpoint exch pop moveto show} repeat +} bind def + +/done {/lastpage where {pop lastpage} if} def diff --git a/postscript/prologues/posttek.ps b/postscript/prologues/posttek.ps new file mode 100644 index 00000000..ee2428ce --- /dev/null +++ b/postscript/prologues/posttek.ps @@ -0,0 +1,106 @@ +% +% Version 3.3.2 prologue for tektronix 4014 files. +% + +/#copies 1 store +/aspectratio 1 def +/fixlinewidth true def +/font /Courier def +/formsperpage 1 def +/landscape true def +/linewidth 0 def +/magnification 1 def +/margin 10 def +/orientation 0 def +/rotation 1 def +/screenheight 3120 def +/screenwidth 4150 def +/spotsize 1 def +/xoffset 0 def +/yoffset 0 def + +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} bind def +/min {2 copy gt {exch} if pop} bind def + +/kshow {kshow} bind def % so later references don't bind + +/setup { + counttomark 2 idiv {def} repeat pop + + landscape {/orientation 90 orientation add def} if + + pagedimensions + /scaling + height margin sub screenheight div + width margin sub screenwidth div + min def + xcenter ycenter translate + orientation rotation mul rotate + xoffset inch yoffset inch translate + magnification dup aspectratio mul scale + scaling scaling scale + screenwidth 2 div neg screenheight 2 div neg translate + + tietodevicespace + linewidth scaling div setlinewidth + 1 setlinecap + newpath +} def + +/pagedimensions { + useclippath { + /pagebbox [clippath pathbbox newpath] def + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def + userdict /gotpagebbox true put +} def + +/pagesetup {/page exch def} bind def + +/tietodevicespace { + fixlinewidth linewidth 0 gt and linewidth 1 lt and { + /moveto { + 2 copy /Y exch def /X exch def + transform round exch round exch itransform + moveto + } bind def + /lineto { + 2 copy /Y exch def /X exch def + transform round exch round exch itransform + lineto + } bind def + /rlineto {Y add exch X add exch lineto} bind def + /v V 0 get bind def + } if +} def + +/V [{moveto counttomark 2 idiv {rlineto} repeat stroke}] def +/v V 0 get bind def +/p {newpath spotsize 0 360 arc fill} bind def + +/l {{scaling div} forall counttomark array astore 0 setdash} bind def +/w {linewidth 0 eq {.3} {linewidth} ifelse mul linewidth add scaling div setlinewidth} bind def +/i {3 mul 4 sub -100 div mul .5 add /spotsize exch def} bind def + +/f {/charwidth exch def font findfont charwidth .6 div scalefont setfont} bind def + +/t { + 3 1 roll moveto + currentpoint { + pop pop + exch charwidth add exch + moveto currentpoint + } 4 -1 roll kshow + pop pop +} bind def + +/done {/lastpage where {pop lastpage} if} def diff --git a/postscript/prologues/printfont.ps b/postscript/prologues/printfont.ps new file mode 100644 index 00000000..7a881a4d --- /dev/null +++ b/postscript/prologues/printfont.ps @@ -0,0 +1,321 @@ +% +% Formatted font dump. Assumes all fonts include valid FontBBox arrays. +% + +/#copies 1 store +/aspectratio 1 def +/landscape false def +/magnification 1 def +/margin 10 def +/orientation 0 def +/rotation 1 def +/xoffset 0 def +/yoffset 0 def + +/axescount 0 def +/charwidth false def +/graynotdef 0.85 def +/hireslinewidth 0.2 def +/longnames false def +/maxsize 6.0 def +/minsize 4.5 def +/numbercell true def +/radix 16 def +/labelfont /Helvetica def +/labelspace 36 def +/zerocell 0 def + +/roundpage true def +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} def +/min {2 copy gt {exch} if pop} def +/max {2 copy lt {exch} if pop} def + +/LLx {0 get} bind def +/LLy {1 get} bind def +/URx {2 get} bind def +/URy {3 get} bind def +/BBoxHeight {dup URy exch LLy sub} bind def +/BBoxWidth {dup URx exch LLx sub} bind def + +/setup { + /graylevels [1 0 0] def + /scratchstring 512 string def + /Product statusdict begin /product where {pop product}{(Unknown)} ifelse end def + /Resolution 0 72 dtransform dup mul exch dup mul add sqrt cvi def + /Version /version where {pop version}{(???)} ifelse def + + landscape {/orientation 90 orientation add def} if + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + width 2 div neg height 2 div translate + xoffset inch yoffset inch neg translate + margin dup neg translate + 0 labelspace .75 mul neg translate + magnification dup aspectratio mul scale + 0 0 transform round exch round exch itransform translate + + currentdict /linewidth known not { + /linewidth Resolution 400 le {0}{hireslinewidth} ifelse def + } if +} def + +/pagedimensions { + useclippath { + /pagebbox [clippath pathbbox newpath] def + roundpage currentdict /roundpagebbox known and {roundpagebbox} if + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def +} def + +/CharSetup { + /chcode exch def + /chname Encoding chcode get def + /chstring ( ) dup 0 chcode put def + /chknown true def + + graylevels 0 1 put % initial cell fill + graylevels 1 0 put % cell text + graylevels 2 0 put % cell border + + FontDict /CharStrings known { + FontDict /CharStrings get chname known not { + /chknown false def + graylevels 0 0 put + graylevels 1 1 put + } if + } if + + chname /.notdef eq { + /chknown false def + graylevels 0 graynotdef put + graylevels 1 graynotdef put + } if + + /chwid chknown + {FontDict 1 scalefont setfont chstring stringwidth pop} + {0} + ifelse def +} bind def + +/CellSetup { + /gridwidth width margin 2 mul sub def + /gridheight height labelspace sub margin 2 mul sub def + /cellwidth gridwidth radix div def + /cellheight gridheight Entries radix div ceiling div def + + cellwidth cellheight dtransform truncate exch truncate exch idtransform + /cellheight exch def + /cellwidth exch def + + labelfont findfont 1 scalefont setfont + /LabelBBox currentfont /FontBBox get TransformBBox def + + LabelBBox 2 0 Encoding { + scratchstring cvs stringwidth pop + 2 copy lt {exch} if + pop + } forall put + + /CellLabelSize + cellheight .20 mul cellwidth .90 mul LabelBBox BestFit + minsize max + maxsize min + def + zerocell CellOrigin cellheight add neg exch neg exch translate +} bind def + +/FontSetup { + FontName findfont 1 scalefont setfont + /BBox currentfont /FontBBox get TransformBBox def + /PointSize cellheight .5 mul cellwidth .8 mul BBox BestFit def + BBox {PointSize mul} forall BBox astore pop + + /xorigin cellwidth BBox BBoxWidth sub 2 div BBox LLx sub def + /yorigin cellheight BBox BBoxHeight sub 2 div BBox LLy sub def +} bind def + +/BestFit { + /bbox exch def + bbox BBoxWidth div exch + bbox BBoxHeight div min +} bind def + +/TransformBBox { % font bbox to user space + aload pop + currentfont /FontMatrix get dtransform 4 2 roll + currentfont /FontMatrix get dtransform 4 2 roll + 4 array astore % should build user space bbox if all zeros +} bind def + +/CellOrigin { + dup + exch radix mod cellwidth mul + exch radix idiv 1 add neg cellheight mul +} bind def + +/CellOutline { + newpath + CellOrigin moveto + cellwidth 0 rlineto + 0 cellheight rlineto + cellwidth neg 0 rlineto + closepath +} bind def + +/LabelCell { + gsave + chcode CellOrigin translate + linewidth .5 mul setlinewidth + labelfont findfont CellLabelSize scalefont setfont + + numbercell { + cellwidth .025 mul cellheight .05 mul moveto + chcode radix scratchstring cvrs show + } if + + charwidth chknown and { + /wid chwid 0.0005 add scratchstring cvs 0 5 getinterval def + cellwidth wid stringwidth pop 1.10 mul sub cellheight .05 mul moveto + wid show + } if + + longnames chknown not or { + cellwidth .025 mul + cellheight LabelBBox URy CellLabelSize mul sub .05 sub moveto + Encoding chcode get scratchstring cvs show + } if + + axescount 1 ge chknown and { % gsave/grestore if not last + newpath + xorigin yorigin translate + + BBox LLx 0 moveto % baseline + BBox URx 0 lineto stroke + + axescount 2 ge { % vertical through current origin + 0 BBox LLy moveto + 0 BBox URy lineto stroke + } if + + axescount 3 ge { % vertical through next origin + chwid PointSize mul BBox LLy + dtransform round exch round exch idtransform moveto + 0 BBox BBoxHeight rlineto stroke + %chwid PointSize mul BBox URy lineto stroke + } if + } if + grestore +} bind def + +/PlaceChar { + FontName findfont PointSize scalefont setfont + chcode CellOrigin moveto + xorigin yorigin rmoveto + ( ) dup 0 chcode put show +} bind def + +/LabelPage { + labelfont findfont labelspace .75 mul .75 mul 18 min scalefont setfont + 0 labelspace .75 mul .25 mul moveto + FontName scratchstring cvs show + + labelfont findfont labelspace .25 mul .75 mul 9 min scalefont setfont + 0 gridheight neg moveto + 0 labelspace .25 mul .75 mul neg rmoveto + Product show ( Version ) show Version show + ( \() show Resolution scratchstring cvs show (dpi\)) show + + gridwidth gridheight neg moveto + 0 labelspace .25 mul .75 mul neg rmoveto + (size=, ) stringwidth pop neg 0 rmoveto + PointSize cvi scratchstring cvs stringwidth pop neg 0 rmoveto + (gray=, ) stringwidth pop neg 0 rmoveto + graynotdef scratchstring cvs stringwidth pop neg 0 rmoveto + (linewidth=) stringwidth pop neg 0 rmoveto + linewidth scratchstring cvs stringwidth pop neg 0 rmoveto + (size=) show PointSize cvi scratchstring cvs show (, ) show + (gray=) show graynotdef scratchstring cvs show (, ) show + (linewidth=) show linewidth scratchstring cvs show +} bind def + +% +% Formatted dump of the encoded characters in a single font. +% + +/PrintFont { + /saveobj save def + /FontName exch def + /FontDict FontName findfont def + /Encoding FontDict /Encoding get def + /Entries Encoding length def + + CellSetup + FontSetup + LabelPage + zerocell 1 Entries 1 sub { + CharSetup + graylevels 0 get setgray + chcode CellOutline fill + graylevels 1 get setgray + LabelCell + PlaceChar + graylevels 2 get setgray + linewidth setlinewidth + chcode CellOutline stroke + } for + showpage + saveobj restore +} bind def + +% +% Dump of all ROM and disk fonts - in alphabetical order. +% + +/AllFonts { + /AllFontNames FontDirectory maxlength array def + AllFontNames 0 0 put + + FontDirectory {pop AllFontNames Insert} forall + + /filenameforall where { + pop + (fonts/*) + {(fonts/) search pop pop pop AllFontNames Insert} + 200 string + filenameforall + } if + + 1 1 AllFontNames 0 get { + AllFontNames exch get cvn PrintFont + } for +} bind def + +/Insert { % name in a sorted list + /List exch def + /Name exch 128 string cvs def + + /Slot 1 def + List 0 get { + Name List Slot get le {exit} if + /Slot Slot 1 add def + } repeat + + List 0 get -1 Slot { + dup List exch get + List 3 1 roll exch 1 add exch put + } for + List Slot Name put + List 0 List 0 get 1 add put +} bind def + diff --git a/postscript/prologues/ps.requests b/postscript/prologues/ps.requests new file mode 100644 index 00000000..59e2a571 --- /dev/null +++ b/postscript/prologues/ps.requests @@ -0,0 +1,16 @@ +% +% Keywords begin with an @ in the first column. The value follows on the next +% line and includes everything up to next keyword line, except for comments +% which are lines that begin with % in the first column. +% + +@manualfeed + statusdict begin + /manualfeedtimeout 300 def + /manualfeed true def + end + +@ledgertray + statusdict begin + ledgertray + end diff --git a/postscript/prologues/roundpage.ps b/postscript/prologues/roundpage.ps new file mode 100644 index 00000000..68d2d443 --- /dev/null +++ b/postscript/prologues/roundpage.ps @@ -0,0 +1,30 @@ +% +% Tries to round clipping path dimensions, as stored in array pagebbox, so they +% match one of the known sizes in the papersizes array. Lower left coordinates +% are always set to 0. +% + +/roundpagebbox { + 7 dict begin + /papersizes [8.5 inch 11 inch 14 inch 17 inch] def + + /mappapersize { + /val exch def + /slop .5 inch def + /diff slop def + /j 0 def + 0 1 papersizes length 1 sub { + /i exch def + papersizes i get val sub abs + dup diff le {/diff exch def /j i def} {pop} ifelse + } for + diff slop lt {papersizes j get} {val} ifelse + } def + + pagebbox 0 0 put + pagebbox 1 0 put + pagebbox dup 2 get mappapersize 2 exch put + pagebbox dup 3 get mappapersize 3 exch put + end +} bind def + diff --git a/postscript/prologues/set_ip.ps b/postscript/prologues/set_ip.ps new file mode 100644 index 00000000..55c2e12d --- /dev/null +++ b/postscript/prologues/set_ip.ps @@ -0,0 +1,30 @@ +%!PS-Adobe-3.0 +%% This file changes the IP Address on the Xante Accel-a-Writer + +%%Setting the IP Address will restart the printer!! + +%%Set The IP Address +%(%IP%) <> setdevparams +%(%IP%) <> setdevparams +%(%IP%) <> setdevparams +%(%IP%) <> setdevparams +%serverdict begin 0 exitserver +%systemdict /quit get exec + + +%% Print out the IP address +%%To print out the current IP Address, comment out the +%%above commands under Set The IP Address with a percent +%%sign. Uncomment the lines below by removing the leading % sign. + +/Courier findfont 24 scalefont setfont +(%IP%) currentdevparams +72 72 moveto +/IPAddress get show +72 144 moveto +/NetworkMask get show +72 216 moveto +/BroadcastAddress get show +72 288 moveto +/GatewayAddress get show +showpage \ No newline at end of file diff --git a/postscript/prologues/shade.ps b/postscript/prologues/shade.ps new file mode 100644 index 00000000..47e31679 --- /dev/null +++ b/postscript/prologues/shade.ps @@ -0,0 +1,52 @@ +% +% Shading support - primarily for ASCII file translators. +% + +/grays [0.98 0.9 0.75 0.6] def + +/setshade { + /level exch def + level 0 le { + /textgray 0 def + /backgray 1 def + }{ + /backgray level grays length gt + {/textgray 1 def 0} + {/textgray 0 def grays level 1 sub get} + ifelse def + } ifelse + textgray setgray + /dY1 0 def + /dY2 0 def +} bind def + +/drawrvbox { + /x2 exch charwidth mul def + /x1 exch charwidth mul def + + x1 x2 lt { + dup % expects y on top + /y1 exch linespace mul def + /y2 y1 def + + dY1 0 eq dY2 0 eq and { + currentfont /FontBBox get aload pop + 160 sub + currentfont /FontMatrix get dtransform /dY2 exch def pop + 100 add + currentfont /FontMatrix get dtransform /dY1 exch def pop + } if + + /y1 y1 dY1 add def + /y2 y2 dY2 add def + + backgray setgray + newpath + x1 y1 moveto + x2 y1 lineto + x2 y2 lineto + x1 y2 lineto + closepath fill + } if + textgray setgray +} bind def diff --git a/postscript/prologues/unbind.ps b/postscript/prologues/unbind.ps new file mode 100644 index 00000000..98e6283e --- /dev/null +++ b/postscript/prologues/unbind.ps @@ -0,0 +1,28 @@ +% +% Unbind the operators in an executable array or packedarray. Leaves the +% unbound array or the original object on the stack. +% + +/unbind { + 0 index xcheck + 1 index type /arraytype eq + 2 index type /packedarraytype eq or and { + dup length array copy cvx + dup 0 exch { + dup type /operatortype eq { + ( ) cvs cvn cvx + } if + + 0 index xcheck + 1 index type /arraytype eq + 2 index type /packedarraytype eq or and { + unbind + } if + + 3 copy put pop + 1 add + } forall + pop + } if +} def + -- cgit v1.2.3