diff --git a/library/POSTSCRIPTSTREAM b/library/POSTSCRIPTSTREAM index 44bdaf819..ab44fd309 100644 --- a/library/POSTSCRIPTSTREAM +++ b/library/POSTSCRIPTSTREAM @@ -1,29 +1,15 @@ (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10) -(FILECREATED "28-Apr-2025 00:17:24" {DSK}matt>Interlisp>medley>library>POSTSCRIPTSTREAM.;14 257549 +(FILECREATED " 5-Jun-2025 16:12:21" {DSK}matt>Interlisp>medley>library>POSTSCRIPTSTREAM.;5 258146 :EDIT-BY "mth" - :CHANGES-TO (FNS \DRAWLINE.PSC POSTSCRIPT.PUTRGBCOLOR \PSC.COLOR.TO.RGB \BLTSHADE.PSC - \DRAWARC.PSC \DRAWCIRCLE.PSC \DRAWCURVE.PSC \DRAWELLIPSE.PSC \DRAWPOLYGON.PSC - \FILLCIRCLE.PSC \FILLPOLYGON.PSC POSTSCRIPT.COLORSTRING POSTSCRIPT.OUTSTR - \DSPCOLOR.PSC POSTSCRIPT.PUTCOLOR \DRAWPOINT.PSC \POSTSCRIPT.CHANGECHARSET - POSTSCRIPT.HARDCOPYW POSTSCRIPT.CLOSESTRING POSTSCRIPT.ENDPAGE - POSTSCRIPT.PUTCOMMAND POSTSCRIPT.SET-FAKE-LANDSCAPE POSTSCRIPT.SHOWACCUM - POSTSCRIPT.STARTPAGE \POSTSCRIPTTAB \PS.BOUTFIXP \PS.SCALEHACK - \SCALEDBITBLT.PSC \SETPOS.PSC \SETXFORM.PSC \STRINGWIDTH.PSC \SWITCHFONTS.PSC - \TERPRI.PSC \CHARWIDTH.PSC \DSPBOTTOMMARGIN.PSC \DSPCLIPPINGREGION.PSC - \DSPFONT.PSC \DSPLEFTMARGIN.PSC \DSPLINEFEED.PSC \DSPPUSHSTATE.PSC - \DSPPOPSTATE.PSC \DSPRESET.PSC \DSPRIGHTMARGIN.PSC \DSPROTATE.PSC - \DSPSCALE.PSC \DSPSCALE2.PSC \DSPSPACEFACTOR.PSC \DSPTOPMARGIN.PSC - \DSPTRANSLATE.PSC \DSPXPOSITION.PSC \DSPYPOSITION.PSC \FIXLINELENGTH.PSC - \MOVETO.PSC \POSTSCRIPT.OUTCHARFN \POSTSCRIPT.PRINTSLUG - \POSTSCRIPT.SPECIALOUTCHARFN \UPDATE.PSC \POSTSCRIPT.ACCENTFN - \POSTSCRIPT.ACCENTPAIR OPENPOSTSCRIPTSTREAM) - (VARS POSTSCRIPTSTREAMCOMS) - (RECORDS \POSTSCRIPTDATA) - - :PREVIOUS-DATE "10-Dec-2024 15:16:36" + :CHANGES-TO (FNS \BLTSHADE.PSC \PSC.COLOR.TO.RGB \DRAWLINE.PSC \DRAWARC.PSC POSTSCRIPTSEND + \TERPRI.PSC POSTSCRIPT.PUTCOMMAND POSTSCRIPT.PUTRGBCOLOR \DSPCOLOR.PSC + \DRAWCIRCLE.PSC \DRAWELLIPSE.PSC \DRAWPOINT.PSC \DRAWPOLYGON.PSC + \FILLCIRCLE.PSC \FILLPOLYGON.PSC POSTSCRIPT.TEDIT \BITBLT.PSC) + + :PREVIOUS-DATE "28-Apr-2025 00:17:24" {DSK}matt>Interlisp>medley>library>POSTSCRIPTSTREAM.;1) @@ -502,47 +488,71 @@ (\POSTSCRIPT.NSHASH *POSTSCRIPT-NS-TRANSLATIONS*]) (POSTSCRIPT.PUTRGBCOLOR - [LAMBDA (STREAM COLOR EOL?) (* ; "Edited 28-Apr-2025 00:02 by mth") + [LAMBDA (STREAM COLOR EOL?) (* ; "Edited 5-Jun-2025 14:06 by mth") + (* ; "Edited 28-Apr-2025 00:02 by mth") (* ; "Edited 26-Apr-2025 17:16 by mth") (AND COLOR (CL:MULTIPLE-VALUE-BIND (RGB GRAY COLORSTR) - (\PSC.COLOR.TO.RGB COLOR) - (POSTSCRIPT.PUTCOMMAND STREAM COLORSTR (OR (AND GRAY " setgray ") - " setrgbcolor ") - (AND EOL? :EOL]) + (\PSC.COLOR.TO.RGB COLOR (fetch (\POSTSCRIPTDATA POSTSCRIPTCOLOR) + of (fetch IMAGEDATA of STREAM))) + (CL:WHEN RGB (* ; "A valid color designation") + (POSTSCRIPT.PUTCOMMAND STREAM COLORSTR (OR (AND GRAY " setgray ") + " setrgbcolor ") + (AND EOL? :EOL))) + + (* ;; "Return the RGB color") + + RGB]) (\PSC.COLOR.TO.RGB - [LAMBDA (COLOR NOERRORFLG?) (* ; "Edited 28-Apr-2025 00:10 by mth") - (* ; "Edited 26-Apr-2025 17:06 by mth") + [LAMBDA (COLOR DEFAULTRGB NOERRORFLG?) (* ; "Edited 5-Jun-2025 16:03 by mth") + (* ; "Edited 31-May-2025 17:20 by mth") + (* ; "Edited 28-Apr-2025 00:10 by mth") (LET (RGB STR) (COND - [(AND (FLOATP COLOR) - (<= 0.0 COLOR 1.0) - (SETQ RGB (FIX (FTIMES COLOR 255))) - (SETQ RGB (LIST RGB RGB RGB)) - (SETQ STR (CL:FORMAT NIL "~F "] - [(SETQ RGB (ENSURE.RGB COLOR NOERRORFLG?)) - (SETQ STR (IF (AND (EQ (CAR RGB) - (CADR RGB)) - (EQ (CAR RGB) - (CADDR RGB))) - THEN - (* ;; "They're all equal, this is gray.") - - (CL:FORMAT NIL "~F " (SETQ COLOR (FQUOTIENT (CAR RGB) - 255.0))) - ELSE (SETQ COLOR NIL) (* ; "Means NOT gray") - (CL:FORMAT NIL "~D ~D ~D " (CAR RGB) - (CADR RGB) - (CADDR RGB] + ((OR (EQ COLOR 0) + (EQ COLOR 1) + (AND (FLOATP COLOR) + (<= 0.0 COLOR 1.0))) + + (* ;; "The SMALLP values 0 and 1 can be checked with EQ") + + (SETQ RGB (FIX (FTIMES COLOR 255))) + (SETQ STR (CL:FORMAT NIL "~F " RGB)) + (SETQ RGB (LIST RGB RGB RGB))) + ([OR (NULL COLOR) + (AND (FIXP COLOR) + (<= 2 COLOR (CONSTANT (MAXIMUMCOLOR 24] + + (* ;; "Ignore any other FIXP that could be a COLORNUMBER") + + (* ;; + "or an RGB encoded as a single FIXP. Just use the DEFAULTRGB which MUST be a valid RGB!") + + (SETQ RGB DEFAULTRGB)) + ((SETQ RGB (ENSURE.RGB COLOR NOERRORFLG?))) (T (* ;; " Shouldn't ever get here.") - (* ;; " ENSURE.RGB above handled the color name or number, RGB, and HLS cases.") + (* ;; " ENSURE.RGB above handled the color name, RGB, and HLS cases.") (* ;; "Depending on NOERRORFLG?, it will give the error for anything else invalid") NIL)) - (CL:VALUES RGB COLOR STR]) + (CL:WHEN RGB + [SETQ STR (OR STR (IF (AND (EQ (CAR RGB) + (CADR RGB)) + (EQ (CAR RGB) + (CADDR RGB))) + THEN + (* ;; "They're all equal, this is gray.") + + (CL:FORMAT NIL "~F " (SETQ COLOR (FQUOTIENT (CAR RGB) + 255.0))) + ELSE (SETQ COLOR NIL) (* ; "Means NOT gray") + (CL:FORMAT NIL "~D ~D ~D " (CAR RGB) + (CADR RGB) + (CADDR RGB]) + (CL:VALUES RGB COLOR STR (NOT (EQUAL RGB DEFAULTRGB]) ) (ADDTOVAR DEFAULTFILETYPELIST (PS . BINARY) @@ -1380,7 +1390,7 @@ (FULLNAME STREAM]) (POSTSCRIPT.TEDIT - [LAMBDA (FILE PFILE) (* ; "Edited 18-Sep-91 18:16 by jds") + [LAMBDA (FILE PFILE) (* ; "Edited 18-Sep-91 18:16 by jds") (* ;; "Make a PS file from a TEdit document. If FILE is a string, make it into a symbol for the file-name. If it's a STREAM, use that stream.") @@ -2193,12 +2203,13 @@ [LAMBDA (SOURCEBITMAP SOURCELEFT SOURCEBOTTOM STREAM DESTINATIONLEFT DESTINATIONBOTTOM WIDTH HEIGHT SOURCETYPE OPERATION TEXTURE CLIPPINGREGION CLIPPEDSOURCELEFT CLIPPEDSOURCEBOTTOM) (* ; "Edited 7-Apr-89 19:53 by TAL") - (\SCALEDBITBLT.PSC SOURCEBITMAP SOURCELEFT SOURCEBOTTOM STREAM DESTINATIONLEFT - DESTINATIONBOTTOM WIDTH HEIGHT SOURCETYPE OPERATION TEXTURE CLIPPINGREGION - CLIPPEDSOURCELEFT CLIPPEDSOURCEBOTTOM 1]) + (\SCALEDBITBLT.PSC SOURCEBITMAP SOURCELEFT SOURCEBOTTOM STREAM DESTINATIONLEFT DESTINATIONBOTTOM + WIDTH HEIGHT SOURCETYPE OPERATION TEXTURE CLIPPINGREGION CLIPPEDSOURCELEFT + CLIPPEDSOURCEBOTTOM 1]) (\BLTSHADE.PSC [LAMBDA (TEXTURE STREAM DESTINATIONLEFT DESTINATIONBOTTOM WIDTH HEIGHT OPERATION CLIPPINGREGION) + (* ; "Edited 5-Jun-2025 16:11 by mth") (* ; "Edited 28-Apr-2025 00:05 by mth") (* ;  "Edited 20-Nov-92 15:12 by sybalsky:mv:envos") @@ -2237,7 +2248,8 @@ (SETQ TEXTUREBM (BITMAPCREATE TEXTUREWIDTH TEXTUREWIDTH 1)) (BITBLT TEXTURE 0 0 TEXTUREBM 0 0 TEXTUREWIDTH TEXTUREWIDTH 'INPUT 'REPLACE)) (T (CL:MULTIPLE-VALUE-BIND (COLOR GRAY COLORSTR) - (\PSC.COLOR.TO.RGB (OR TEXTURE (\DSPCOLOR.PSC STREAM NIL))) + (\PSC.COLOR.TO.RGB TEXTURE (fetch (\POSTSCRIPTDATA POSTSCRIPTCOLOR) + of IMAGEDATA)) (* ;; "Default to the current stream color") @@ -2506,46 +2518,50 @@ (\MOVETO.PSC STREAM CENTERX CENTERY]) (\DRAWLINE.PSC - [LAMBDA (STREAM X1 Y1 X2 Y2 WIDTH OPERATION COLOR DASHING) (* ; "Edited 28-Apr-2025 00:11 by mth") + [LAMBDA (STREAM X1 Y1 X2 Y2 WIDTH OPERATION COLOR DASHING) (* ; "Edited 5-Jun-2025 14:19 by mth") + (* ; "Edited 28-Apr-2025 00:11 by mth") (* ;  "Edited 20-Nov-92 15:12 by sybalsky:mv:envos") (* ;; "DRAWLINE method for postscript streams.") - (LET ((IMAGEDATA (fetch (STREAM IMAGEDATA) of STREAM))) - [COND - ((NOT (NUMBERP WIDTH)) + (CL:WHEN (LESSP X2 X1) - (* ;; "The WIDTH = NIL should have been handled before here, but just in case!") + (* ;; "For Syntelligence, make all lines move from left to right, to defeat a bug in SPARCPrinter PS decoder.") - (SETQ WIDTH (fetch (\POSTSCRIPTDATA POSTSCRIPTSCALE) of IMAGEDATA] - [COND - ((NOT (ZEROP WIDTH)) - (CL:MULTIPLE-VALUE-BIND (RGB GRAY COLORSTR) - (\PSC.COLOR.TO.RGB COLOR T) - (COND - ((LESSP X2 X1) - - (* ;; "For Syntelligence, make all lines move from left to right, to defeat a bug in SPARCPrinter PS decoder.") - - (\DRAWLINE.PSC STREAM X2 Y2 X1 Y1 WIDTH OPERATION COLOR DASHING)) - ((NOT (OR COLOR (LISTP DASHING))) (* ; "Simple case, no dash or color") - (POSTSCRIPT.PUTCOMMAND STREAM X2 " " Y2 " " X1 " " Y1 " " WIDTH " L" :EOL)) - (T (POSTSCRIPT.PUTCOMMAND STREAM X2 " " Y2 " " X1 " " Y1 " " WIDTH " ") - (POSTSCRIPT.PUTCOMMAND STREAM COLORSTR " [") - (POSTSCRIPT.PUTCOMMAND STREAM) - (for D in (LISTP DASHING) do - (* ;; + (CL:PSETQ X1 X2 X2 X1 Y1 Y2 Y2 Y1)) + (LET* ((IMAGEDATA (fetch (STREAM IMAGEDATA) of STREAM)) + (CURRENTCOLOR (fetch (\POSTSCRIPTDATA POSTSCRIPTCOLOR) of IMAGEDATA))) + [COND + ((NOT (NUMBERP WIDTH)) + + (* ;; "The WIDTH = NIL should have been handled before here, but just in case!") + + (SETQ WIDTH (fetch (\POSTSCRIPTDATA POSTSCRIPTSCALE) of IMAGEDATA] + [COND + ((NOT (ZEROP WIDTH)) + (CL:MULTIPLE-VALUE-BIND (RGB GRAY COLORSTR DIFFERENT) + (\PSC.COLOR.TO.RGB COLOR CURRENTCOLOR T) + (COND + ((NOT (OR DIFFERENT (LISTP DASHING)))(* ; + "Simple case, no dash or color change") + (POSTSCRIPT.PUTCOMMAND STREAM X2 " " Y2 " " X1 " " Y1 " " WIDTH " L" :EOL)) + (T (POSTSCRIPT.PUTCOMMAND STREAM X2 " " Y2 " " X1 " " Y1 " " WIDTH " ") + (POSTSCRIPT.PUTCOMMAND STREAM COLORSTR " [") + (POSTSCRIPT.PUTCOMMAND STREAM) + (for D in (LISTP DASHING) do + (* ;;  "Interlisp DASHING is in terms of BRUSH units, so multiply by the brush size.") - (POSTSCRIPT.PUTCOMMAND STREAM (TIMES D WIDTH) - " ")) - (POSTSCRIPT.PUTCOMMAND STREAM "]" (OR (AND GRAY " L1G") - " L1") - :EOL] - (replace (\POSTSCRIPTDATA POSTSCRIPTX) of IMAGEDATA with X2) - (freplace (\POSTSCRIPTDATA POSTSCRIPTY) of IMAGEDATA with Y2) - (freplace (\POSTSCRIPTDATA POSTSCRIPTMOVEFLG) of IMAGEDATA with NIL]) + (POSTSCRIPT.PUTCOMMAND STREAM + (TIMES D WIDTH) + " ")) + (POSTSCRIPT.PUTCOMMAND STREAM "]" (OR (AND GRAY " L1G") + " L1") + :EOL] + (replace (\POSTSCRIPTDATA POSTSCRIPTX) of IMAGEDATA with X2) + (freplace (\POSTSCRIPTDATA POSTSCRIPTY) of IMAGEDATA with Y2) + (freplace (\POSTSCRIPTDATA POSTSCRIPTMOVEFLG) of IMAGEDATA with NIL]) (\DRAWPOINT.PSC [LAMBDA (STREAM X Y BRUSH OPERATION) (* ; "Edited 30-Mar-90 17:53 by Matt Heffron") @@ -2648,7 +2664,8 @@ OLDCLIP]) (\DSPCOLOR.PSC - [LAMBDA (STREAM COLOR) (* ; "Edited 26-Apr-2025 17:03 by mth") + [LAMBDA (STREAM COLOR) (* ; "Edited 4-Jun-2025 23:51 by mth") + (* ; "Edited 26-Apr-2025 17:03 by mth") (* ; "Edited 14-Jan-93 17:14 by jds") (* ;; " Code below adapted from 7-Oct-1989 version by DJVB") @@ -2657,12 +2674,10 @@  " All postscript printers accept color RGB info, though most just pick a gray based on values") (LET* ((PSDATA (fetch IMAGEDATA of STREAM)) - (CURRENT (fetch (\POSTSCRIPTDATA POSTSCRIPTCOLOR) of PSDATA)) - RGB) + (CURRENT (fetch (\POSTSCRIPTDATA POSTSCRIPTCOLOR) of PSDATA))) (if COLOR - then (SETQ RGB (\PSC.COLOR.TO.RGB COLOR)) - (replace (\POSTSCRIPTDATA POSTSCRIPTCOLOR) of PSDATA with RGB) - (POSTSCRIPT.PUTRGBCOLOR STREAM RGB)) + then (replace (\POSTSCRIPTDATA POSTSCRIPTCOLOR) of PSDATA with (POSTSCRIPT.PUTRGBCOLOR + STREAM COLOR))) CURRENT]) (\DSPFONT.PSC @@ -4302,21 +4317,13 @@ (DEFINEQ (POSTSCRIPTSEND + [LAMBDA (HOST FILE PRINTOPTIONS) (* ; "Edited 20-Nov-95 11:29 by ") + (* ; "Edited 20-Nov-95 11:26 by ") - [LAMBDA (HOST FILE PRINTOPTIONS) (* ; "Edited 20-Nov-95 11:29 by ") - - (* ; "Edited 20-Nov-95 11:26 by ") - - - - (* ;; "This is the send function for generic POSTSCRIPT printers. It branches on the architecture-specific function. The theory is that the send method is really a property of the operating system, not a property of specific postscript printers. These functions are contained in separate library files (or defined by user).") - - + (* ;; "This is the send function for generic POSTSCRIPT printers. It branches on the architecture-specific function. The theory is that the send method is really a property of the operating system, not a property of specific postscript printers. These functions are contained in separate library files (or defined by user).") (SELECTQ (MKATOM (UNIX-GETPARM "ARCH")) - (dos (DOSPRINT HOST FILE PRINTOPTIONS)) - (UnixPrint HOST FILE PRINTOPTIONS]) ) @@ -4394,38 +4401,38 @@ (ADDTOVAR LAMA POSTSCRIPT.PUTCOMMAND) ) (DECLARE%: DONTCOPY - (FILEMAP (NIL (23920 33221 (POSTSCRIPT.INIT 23930 . 31022) (POSTSCRIPT.PUTRGBCOLOR 31024 . 31600) ( -\PSC.COLOR.TO.RGB 31602 . 33219)) (34207 68991 (PSCFONT.READFONT 34217 . 36125) (PSCFONT.SPELLFILE -36127 . 36705) (PSCFONT.COERCEFILE 36707 . 38279) (PSCFONTFROMCACHE.SPELLFILE 38281 . 39266) ( -PSCFONTFROMCACHE.COERCEFILE 39268 . 40920) (PSCFONT.WRITEFONT 40922 . 41937) (READ-AFM-FILE 41939 . -47810) (CONVERT-AFM-FILES 47812 . 49024) (POSTSCRIPT.GETFONTID 49026 . 50421) (POSTSCRIPT.FONTCREATE -50423 . 62822) (\POSTSCRIPT.SPECIALFONT.SCALEDWIDTHS 62824 . 65221) (POSTSCRIPT.FONTSAVAILABLE 65223 - . 68989)) (69546 78831 (OPENPOSTSCRIPTSTREAM 69556 . 78497) (CLOSEPOSTSCRIPTSTREAM 78499 . 78829)) ( -78876 84926 (POSTSCRIPT.HARDCOPYW 78886 . 81993) (POSTSCRIPT.TEDIT 81995 . 82475) (POSTSCRIPT.TEXT -82477 . 82768) (POSTSCRIPTFILEP 82770 . 83877) (MAKEEPSFILE 83879 . 84924)) (84927 128501 ( -POSTSCRIPT.BITMAPSCALE 84937 . 87393) (POSTSCRIPT.CLOSESTRING 87395 . 87948) (POSTSCRIPT.ENDPAGE 87950 - . 88841) (POSTSCRIPT.OUTSTR 88843 . 90060) (POSTSCRIPT.PUTBITMAPBYTES 90062 . 98533) ( -POSTSCRIPT.PUTCOMMAND 98535 . 99524) (POSTSCRIPT.SET-FAKE-LANDSCAPE 99526 . 104046) ( -POSTSCRIPT.SHOWACCUM 104048 . 106203) (POSTSCRIPT.STARTPAGE 106205 . 108737) (\POSTSCRIPTTAB 108739 . -109536) (\PS.BOUTFIXP 109538 . 110818) (\PS.SCALEHACK 110820 . 113463) (\PS.SCALEREGION 113465 . -114025) (\SCALEDBITBLT.PSC 114027 . 118337) (\SETPOS.PSC 118339 . 118820) (\SETXFORM.PSC 118822 . -121406) (\STRINGWIDTH.PSC 121408 . 121881) (\SWITCHFONTS.PSC 121883 . 127375) (\TERPRI.PSC 127377 . -128499)) (128536 182026 (\BITBLT.PSC 128546 . 129099) (\BLTSHADE.PSC 129101 . 133566) (\CHARWIDTH.PSC -133568 . 134075) (\CREATECHARSET.PSC 134077 . 135775) (\DRAWARC.PSC 135777 . 138155) (\DRAWCIRCLE.PSC -138157 . 140408) (\DRAWCURVE.PSC 140410 . 144254) (\DRAWELLIPSE.PSC 144256 . 146620) (\DRAWLINE.PSC -146622 . 149058) (\DRAWPOINT.PSC 149060 . 149636) (\DRAWPOLYGON.PSC 149638 . 152767) ( -\DSPBOTTOMMARGIN.PSC 152769 . 153456) (\DSPCLIPPINGREGION.PSC 153458 . 154833) (\DSPCOLOR.PSC 154835 - . 155675) (\DSPFONT.PSC 155677 . 159196) (\DSPLEFTMARGIN.PSC 159198 . 159884) (\DSPLINEFEED.PSC -159886 . 160476) (\DSPPUSHSTATE.PSC 160478 . 161938) (\DSPPOPSTATE.PSC 161940 . 165425) (\DSPRESET.PSC - 165427 . 166092) (\DSPRIGHTMARGIN.PSC 166094 . 166783) (\DSPROTATE.PSC 166785 . 167784) ( -\DSPSCALE.PSC 167786 . 168738) (\DSPSCALE2.PSC 168740 . 169580) (\DSPSPACEFACTOR.PSC 169582 . 170503) -(\DSPTOPMARGIN.PSC 170505 . 171076) (\DSPTRANSLATE.PSC 171078 . 173109) (\DSPXPOSITION.PSC 173111 . -173675) (\DSPYPOSITION.PSC 173677 . 174268) (\FILLCIRCLE.PSC 174270 . 176495) (\FILLPOLYGON.PSC 176497 - . 179734) (\FIXLINELENGTH.PSC 179736 . 181055) (\MOVETO.PSC 181057 . 181827) (\NEWPAGE.PSC 181829 . -182024)) (182082 204105 (\POSTSCRIPT.CHANGECHARSET 182092 . 182829) (\POSTSCRIPT.OUTCHARFN 182831 . -194959) (\POSTSCRIPT.PRINTSLUG 194961 . 196685) (\POSTSCRIPT.SPECIALOUTCHARFN 196687 . 199038) ( -\UPDATE.PSC 199040 . 200286) (\POSTSCRIPT.ACCENTFN 200288 . 201230) (\POSTSCRIPT.ACCENTPAIR 201232 . -204103)) (204203 205848 (\PSC.SPACEDISP 204213 . 204492) (\PSC.SPACEWID 204494 . 205113) (\PSC.SYMBOLS - 205115 . 205846)) (205957 208948 (\POSTSCRIPT.NSHASH 205967 . 208946)) (253722 254436 (POSTSCRIPTSEND - 253732 . 254434))))) + (FILEMAP (NIL (22736 33232 (POSTSCRIPT.INIT 22746 . 29838) (POSTSCRIPT.PUTRGBCOLOR 29840 . 30862) ( +\PSC.COLOR.TO.RGB 30864 . 33230)) (34218 69002 (PSCFONT.READFONT 34228 . 36136) (PSCFONT.SPELLFILE +36138 . 36716) (PSCFONT.COERCEFILE 36718 . 38290) (PSCFONTFROMCACHE.SPELLFILE 38292 . 39277) ( +PSCFONTFROMCACHE.COERCEFILE 39279 . 40931) (PSCFONT.WRITEFONT 40933 . 41948) (READ-AFM-FILE 41950 . +47821) (CONVERT-AFM-FILES 47823 . 49035) (POSTSCRIPT.GETFONTID 49037 . 50432) (POSTSCRIPT.FONTCREATE +50434 . 62833) (\POSTSCRIPT.SPECIALFONT.SCALEDWIDTHS 62835 . 65232) (POSTSCRIPT.FONTSAVAILABLE 65234 + . 69000)) (69557 78842 (OPENPOSTSCRIPTSTREAM 69567 . 78508) (CLOSEPOSTSCRIPTSTREAM 78510 . 78840)) ( +78887 84941 (POSTSCRIPT.HARDCOPYW 78897 . 82004) (POSTSCRIPT.TEDIT 82006 . 82490) (POSTSCRIPT.TEXT +82492 . 82783) (POSTSCRIPTFILEP 82785 . 83892) (MAKEEPSFILE 83894 . 84939)) (84942 128516 ( +POSTSCRIPT.BITMAPSCALE 84952 . 87408) (POSTSCRIPT.CLOSESTRING 87410 . 87963) (POSTSCRIPT.ENDPAGE 87965 + . 88856) (POSTSCRIPT.OUTSTR 88858 . 90075) (POSTSCRIPT.PUTBITMAPBYTES 90077 . 98548) ( +POSTSCRIPT.PUTCOMMAND 98550 . 99539) (POSTSCRIPT.SET-FAKE-LANDSCAPE 99541 . 104061) ( +POSTSCRIPT.SHOWACCUM 104063 . 106218) (POSTSCRIPT.STARTPAGE 106220 . 108752) (\POSTSCRIPTTAB 108754 . +109551) (\PS.BOUTFIXP 109553 . 110833) (\PS.SCALEHACK 110835 . 113478) (\PS.SCALEREGION 113480 . +114040) (\SCALEDBITBLT.PSC 114042 . 118352) (\SETPOS.PSC 118354 . 118835) (\SETXFORM.PSC 118837 . +121421) (\STRINGWIDTH.PSC 121423 . 121896) (\SWITCHFONTS.PSC 121898 . 127390) (\TERPRI.PSC 127392 . +128514)) (128551 182631 (\BITBLT.PSC 128561 . 129113) (\BLTSHADE.PSC 129115 . 133776) (\CHARWIDTH.PSC +133778 . 134285) (\CREATECHARSET.PSC 134287 . 135985) (\DRAWARC.PSC 135987 . 138365) (\DRAWCIRCLE.PSC +138367 . 140618) (\DRAWCURVE.PSC 140620 . 144464) (\DRAWELLIPSE.PSC 144466 . 146830) (\DRAWLINE.PSC +146832 . 149572) (\DRAWPOINT.PSC 149574 . 150150) (\DRAWPOLYGON.PSC 150152 . 153281) ( +\DSPBOTTOMMARGIN.PSC 153283 . 153970) (\DSPCLIPPINGREGION.PSC 153972 . 155347) (\DSPCOLOR.PSC 155349 + . 156280) (\DSPFONT.PSC 156282 . 159801) (\DSPLEFTMARGIN.PSC 159803 . 160489) (\DSPLINEFEED.PSC +160491 . 161081) (\DSPPUSHSTATE.PSC 161083 . 162543) (\DSPPOPSTATE.PSC 162545 . 166030) (\DSPRESET.PSC + 166032 . 166697) (\DSPRIGHTMARGIN.PSC 166699 . 167388) (\DSPROTATE.PSC 167390 . 168389) ( +\DSPSCALE.PSC 168391 . 169343) (\DSPSCALE2.PSC 169345 . 170185) (\DSPSPACEFACTOR.PSC 170187 . 171108) +(\DSPTOPMARGIN.PSC 171110 . 171681) (\DSPTRANSLATE.PSC 171683 . 173714) (\DSPXPOSITION.PSC 173716 . +174280) (\DSPYPOSITION.PSC 174282 . 174873) (\FILLCIRCLE.PSC 174875 . 177100) (\FILLPOLYGON.PSC 177102 + . 180339) (\FIXLINELENGTH.PSC 180341 . 181660) (\MOVETO.PSC 181662 . 182432) (\NEWPAGE.PSC 182434 . +182629)) (182687 204710 (\POSTSCRIPT.CHANGECHARSET 182697 . 183434) (\POSTSCRIPT.OUTCHARFN 183436 . +195564) (\POSTSCRIPT.PRINTSLUG 195566 . 197290) (\POSTSCRIPT.SPECIALOUTCHARFN 197292 . 199643) ( +\UPDATE.PSC 199645 . 200891) (\POSTSCRIPT.ACCENTFN 200893 . 201835) (\POSTSCRIPT.ACCENTPAIR 201837 . +204708)) (204808 206453 (\PSC.SPACEDISP 204818 . 205097) (\PSC.SPACEWID 205099 . 205718) (\PSC.SYMBOLS + 205720 . 206451)) (206562 209553 (\POSTSCRIPT.NSHASH 206572 . 209551)) (254327 255033 (POSTSCRIPTSEND + 254337 . 255031))))) STOP diff --git a/library/POSTSCRIPTSTREAM.LCOM b/library/POSTSCRIPTSTREAM.LCOM index be23d163e..6466f5df9 100644 Binary files a/library/POSTSCRIPTSTREAM.LCOM and b/library/POSTSCRIPTSTREAM.LCOM differ diff --git a/library/POSTSCRIPTSTREAM.TEDIT b/library/POSTSCRIPTSTREAM.TEDIT index 1b1cd053c..3319c7946 100644 --- a/library/POSTSCRIPTSTREAM.TEDIT +++ b/library/POSTSCRIPTSTREAM.TEDIT @@ -12,7 +12,7 @@ POSTSCRIPTSTREAM By: Matt Heffron (then: mheffron@orion.cf.uci.edu, now: heffron@alumni.caltech.edu) INTRODUCTION -The PostScript package defines a set of imageops for printers which understand the PostScript page description language by Adobe. At Beckman we have successfully used TEdit, Sketch, LISTFILES, and HARDCOPYW to an Apple LaserWriter and an AST TurboLaser PS. The PostScript imagestream driver installs itself when it is loaded. All symbols in the PostScript driver are located in the INTERLISP: package. +The PostScriptStream package defines a set of imageops for printers which understand the PostScriptÔ page description language by Adobe. At Beckman we have successfully used TEdit, Sketch, LISTFILES, and HARDCOPYW to an Apple LaserWriter and an AST TurboLaser PS. The PostScriptStream imagestream driver installs itself when it is loaded. All symbols in the PostScriptStream driver are located in the INTERLISP: package. VARIABLES POSTSCRIPT.FONT.ALIST [InitVariable] POSTSCRIPT.FONT.ALIST is an ALIST mapping Xerox Lisp font names into the root names of PostScript font files. It is also used for font family coercions. The default value should be acceptable for any of the fonts which are built into the Apple Laserwriter. @@ -36,40 +36,39 @@ HINT Setting POSTSCRIPT.BITMAP.SCALE to 0.96, instead of 1, will give cleaner BITMAP images on a 300 dpi printer. (This corrects for the 72 ppi imagestream vs. the 75 dpi printer, using 4x4 device dots per bitmap pixel.) Also, values of 0.24, 0.48 and 0.72, instead of 0.25, 0.5 and 0.75, will also give cleaner images for reduced size output. In general, use integer multiples of 0.24 for a 300 dpi printer. POSTSCRIPT.TEXTURE.SCALE [InitVariable] POSTSCRIPT.TEXTURE.SCALE specifies an independent scale for the display of bitmap textures. The value represents the number of device space units per texture unit (bitmap bit). The default value is 4, which represents each bit of the texture as a 4x4 block, so that textures are approximately the same resolution as on the screen (for 300 dpi output devices, such as the Apple Laserwriter). -The PostScript package extends the allowed representations of a texture, beyond 16-bit FIXP and 16x16 bitmap, to ANY square bitmap. (If the bitmap is not square, its longer edge is truncated from the top or right to make it square.) Use this feature with caution, as large bitmap textures, or sizes other than multiples of 16 bits square, require large amounts of storage in the PostScript interpreter (in the printer controller), and can cause limitcheck errors when actually printing. -Anywhere that a texture or color can be used on an imagestream or in the specification of a BRUSH, you can instead give either: a COLOR name, an RGB triple, an HLS triple, or a FLOATP between 0.0 and 1.0 (inclusive) to represent a PostScript halftone gray shade. (For the name, RGB or HLS values, see the file COLOR.TEDIT in the library directory.) (For the single FLOATP value, it will be converted to the corresponding RGB form. 0.0 is black and 1.0 is white. Specifically, the value sets the brightness of the shade.) All forms of the value you specify will be checked for validity. E.g. you can pass 0.33 as the color to DRAWLINE to get a dark gray line. This will be converted to the RGB triple (84 84 84). +The PostScriptStream package extends the allowed representations of a texture, beyond 16-bit FIXP and 16x16 bitmap, to ANY square bitmap. (If the bitmap is not square, its longer edge is truncated from the top or right to make it square.) Use this feature with caution, as large bitmap textures, or sizes other than multiples of 16 bits square, require large amounts of storage in the PostScript interpreter (in the printer controller), and can cause limitcheck errors when actually printing. +Anywhere that a texture or color can be used on an imagestream or in the specification of a BRUSH, you can instead give either: NIL, a COLOR name, an RGB triple, an HLS triple, a SMALLP 0 or 1, or a FLOATP between 0.0 and 1.0 (inclusive). The value NIL means to use the current DSPCOLOR. For the COLOR name, RGB or HLS values, see the file COLOR.TEDIT in the library directory for descriptions of those. Any integer value other than 0 or 1 will be ignored and the current DSPCOLOR will be used. The single SMALLP or FLOATP value cases represent a PostScript gray shade. 0.0 is black and 1.0 is white. Specifically, the value sets the brightness of the shade. E.g. you can pass 0.33 as the color to DRAWLINE to get a dark gray line. This will be converted to the RGB triple (84 84 84). All forms of the value you specify will be checked for validity. POSTSCRIPT.IMAGESIZEFACTOR [InitVariable] POSTSCRIPT.IMAGESIZEFACTOR specifies an independent factor to change the overall size of the printed image. This re-sizing affects the entire printed output (specifically, it superimposes its effects upon those of POSTSCRIPT.BITMAP.SCALE and POSTSCRIPT.TEXTURE.SCALE). Values greater than 1 enlarge the printed image, and values less than 1 reduce it. An invalid POSTSCRIPT.IMAGESIZEFACTOR (i.e. not a positive, non-zero number) will use a value of 1. The BITMAPSCALE function for the POSTSCRIPT printer type does NOT consider the POSTSCRIPT.IMAGESIZEFACTOR when determining the scale factor for a bitmap. MISCELLANEOUS -The SCALE of a PostScript imagestream is 100. This is to allow enough resolution in the width information for fonts to enable TEdit to correctly fill and justify text. -The first time any PostScript imagestream is created (even if only to hardcopy a bitmap or window) the DEFAULTFONT is instantiated (unless a FONTS option was given to the OPENIMAGESTREAM, in which case the initial font for the imagestream will be set to that font, or to the CAR if a list). -The PostScript imagestream method for FILLPOLYGON uses the global variable FILL.WRULE as the default value for the WINDINGNUMBER argument. (This is the same variable which is used by the DISPLAY imagestream method for FILLPOLYGON.) -The PostScript imagestream method for OPENIMAGESTREAM (and, therefore, SEND.FILE.TO.PRINTER), supports an IMAGESIZEFACTOR option to change the size of the printed image. The IMAGESIZEFACTOR re-sizing is combined with the POSTSCRIPT.IMAGESIZEFACTOR to produce an overall re-sizing of the printed image. A HEADING option is also supported to give a running header on each page of output. The value of the HEADING option is printed at the top left of the page, followed by "Page " and the appropriate page number. They are printed in the DEFAULTFONT (unless a FONTS option was given to the OPENIMAGESTREAM, in which case it will be that font, or to the CAR if a list). -The PostScript package is contained in the files: POSTSCRIPTSTREAM.LCOM & PS-SEND.LCOM, with the source in the files: POSTSCRIPTSTREAM & PS-SEND. The module PS-SEND.LCOM is required and will be loaded automatically when POSTSCRIPTSTREAM.LCOM is loaded. It contains the function which is called by SEND.FILE.TO.PRINTER to actually transmit the file to the printer. It is, by its nature, quite site specific, so it is in a separate file to make modifying it for any site relatively simple. System record declarations required to compile POSTSCRIPTSTREAM can be found in EXPORTS.ALL. +The SCALE of a PostScriptStream imagestream is 100. This is to allow enough resolution in the width information for fonts to enable TEdit to correctly fill and justify text. +The first time any PostScriptStream imagestream is created (even if only to hardcopy a bitmap or window) the DEFAULTFONT is instantiated (unless a FONTS option was given to the OPENIMAGESTREAM, in which case the initial font for the imagestream will be set to that font, or to the CAR if a list). +The PostScriptStream imagestream method for FILLPOLYGON uses the global variable FILL.WRULE as the default value for the WINDINGNUMBER argument. (This is the same variable which is used by the DISPLAY imagestream method for FILLPOLYGON.) +The PostScriptStream imagestream method for OPENIMAGESTREAM (and, therefore, SEND.FILE.TO.PRINTER), supports an IMAGESIZEFACTOR option to change the size of the printed image. The IMAGESIZEFACTOR re-sizing is combined with the POSTSCRIPT.IMAGESIZEFACTOR to produce an overall re-sizing of the printed image. A HEADING option is also supported to give a running header on each page of output. The value of the HEADING option is printed at the top left of the page, followed by "Page " and the appropriate page number. They are printed in the DEFAULTFONT (unless a FONTS option was given to the OPENIMAGESTREAM, in which case it will be that font, or to the CAR if a list). I'm pretty sure that the output generated by the PostScript imageops fully conforms to the Adobe Systems Document Structuring Conventions, Version 2.0, January 31, 1987. Including Other PostScript Operations -If you wish to insert your own specific PostScript operations into a PostScript imagestream, you can do so with the following functions: +If you wish to insert your own specific PostScript operations into a PostScriptStream imagestream, you can do so with the following functions: (POSTSCRIPT.OUTSTR STREAM STRING) [Function] -POSTSCRIPT.OUTSTR outputs a string or value to the imagestream. STREAM must be an open PostScript imagestream. STRING is the value to output (STRINGP and LITATOM are most efficient, but any value can be output (its PRIN1 pname is used)). +POSTSCRIPT.OUTSTR outputs a string or value to the imagestream. STREAM must be an open PostScriptStream imagestream. STRING is the value to output (STRINGP and LITATOM are most efficient, but any value can be output (its PRIN1 pname is used)). (POSTSCRIPT.PUTCOMMAND STREAM STRING1 ... STRINGn) [NoSpread Function] POSTSCRIPT.PUTCOMMAND is more general for sequences of commands and values. It calls POSTSCRIPT.OUTSTR repeatedly to output each of the STRINGi arguments to STREAM. (\POSTSCRIPT.OUTCHARFN STREAM CHAR) [Function] -\POSTSCRIPT.OUTCHARFN is used to output the characters forming the text of a PostScript string (e.g. the argument to a show or charpath operator). STREAM is the open PostScript imagestream to output to, and CHAR is the CHARCODE of the character to output. The / (slash), ( and ) (parenthesis) characters will be quoted with /, and characters with ASCII values less than 32 (space) or greater than 126 (tilde) will be output as /nnn (in octal). \POSTSCRIPT.OUTCHARFN will output the ( character to open the string, if necessary. Use POSTSCRIPT.CLOSESTRING (below) to close the string. +\POSTSCRIPT.OUTCHARFN is used to output the characters forming the text of a PostScript string (e.g. the argument to a show or charpath operator). STREAM is the open PostScriptStream imagestream destination for output, and CHAR is the CHARCODE of the character to output. The / (slash), ( and ) (parenthesis) characters will be quoted with /, and characters with ASCII values less than 32 (space) or greater than 126 (tilde) will be output as /nnn (in octal). \POSTSCRIPT.OUTCHARFN will output the ( character to open the string, if necessary. Use POSTSCRIPT.CLOSESTRING (below) to close the string. (POSTSCRIPT.CLOSESTRING STREAM) [Function] -POSTSCRIPT.CLOSESTRING closes a PostScript string (e.g. the argument to a show or charpath operator). STREAM is the open PostScript imagestream. It is important to use POSTSCRIPT.CLOSESTRING to output the ) character to close the string, because it also clears the stream state flag that indicates that a string is in progress (otherwise, the next POSTSCRIPT.PUTCOMMAND would output the commands to close the string and show it). +POSTSCRIPT.CLOSESTRING closes a PostScript string (e.g. the argument to a show or charpath operator). STREAM is the open PostScriptStream imagestream. It is important to use POSTSCRIPT.CLOSESTRING to output the ) character to close the string, because it also clears the stream state flag that indicates that a string is in progress (otherwise, the next POSTSCRIPT.PUTCOMMAND would output the commands to close the string and show it). Warning Do not attempt to create a PostScript font larger than about 600 points, as much of Interlisp's font information is stored in SMALLP integers, and too large a font would overflow the font's height, or the width for any of the wider characters. (I know that 600 points is a ridiculously large limit (about 8.3 inches), but I thought I'd better mention it, or someone might try it!) Changes from the Initial Medley Release -This second Medley release of the PostScript imagestream driver includes some performance enhancements when writing bitmaps to the output, some SUN-specific code (from Will Snow of envos), implementation of the SCALEDBITBLT, DSPROTATE, and DSPTRANSLATE operations, and a lot of performance enhancements (many thanks to Tom Lipkis of Savoir). +This second Medley release of the PostScriptStream imagestream driver includes some performance enhancements when writing bitmaps to the output, some SUN-specific code (from Will Snow of envos), implementation of the SCALEDBITBLT, DSPROTATE, and DSPTRANSLATE operations, and a lot of performance enhancements (many thanks to Tom Lipkis of Savoir). Changes from the Lyric Release -The Medley release of this PostScript imagestream driver changed the default value of POSTSCRIPT.TEXTFILE.LANDSCAPE from T to NIL. It also added the support for the HEADING option. +The Medley release of this PostScriptStream imagestream driver changed the default value of POSTSCRIPT.TEXTFILE.LANDSCAPE from T to NIL. It also added the support for the HEADING option. Known Problems/Limitations -The output generated for a PostScript imagestream is rather brute force. It isn't particularly careful to generate the smallest output file for a given sequence of operations. Specifically, it often generates extra end-of-lines between PostScript operator sequences (this has no effect on the printed output, only on the file size). +The output generated for a PostScriptStream imagestream is rather brute force. It isn't particularly careful to generate the smallest output file for a given sequence of operations. Specifically, it often generates extra end-of-lines between PostScript operator sequences (this has no effect on the printed output, only on the file size). Using BITMAPs or Functions as BRUSH arguments to the curve drawing functions is not supported, nor is using a non-ROUND BRUSH with DRAWCIRCLE or DRAWELLIPSE. -The implementation of DSPROTATE accepts ROTATION argument values of 0 and 90 (any non-NIL, non-zero value is converted to 90). A value of 0 converts the page orientation to Portrait, and 90 converts the page orientation to Landscape. These conversions perform the translations necessary to keep the clipping region on the page. (This may or may not be the right thing to do, but since DSPROTATE is undocumented in what it should do, this is what the PostScript driver does). -There is no support for NS character sets other than 0, and there is no translation of the character code values from NS encoding to PostScript encoding. +The implementation of DSPROTATE accepts ROTATION argument values of 0 and 90 (any non-NIL, non-zero value is converted to 90). A value of 0 converts the page orientation to Portrait, and 90 converts the page orientation to Landscape. These conversions perform the translations necessary to keep the clipping region on the page. (This may or may not be the right thing to do, but since DSPROTATE is undocumented in what it should do, this is what the PostScriptStream driver does). +There is spotty support for NS character sets other than 0, and there is no additional translation of the character code values from NS encoding to PostScript encoding. There is minimal support for color. -\POSTSCRIPT.OUTCHARFN is pretty wimpy in its handling of TAB characters. It just moves to the next multiple of (eight times the average character width of the current font) from the current left margin. +\POSTSCRIPT.OUTCHARFN is pretty wimpy in its handling of TAB characters. It just moves to the next multiple of (eight times the average character width of the current font) from the current left margin. (TEdit does the right thing when generating hardcopy using PostScriptStream.) I haven't yet documented how to build the .PSCFONT files from .AFM files for new fonts that become available.(SEQUENCE NIL NIL (0 0 0 0) ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((HEADING NIL (HEADINGTYPE RUNNINGHEAD) (72 732 540 36) NIL) (TEXT NIL NIL (72 72 468 648) NIL))) (ALTERNATE NIL NIL (0 0 0 0) ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (162 48 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (72 732 540 36) NIL) (TEXT NIL NIL (72 72 468 648) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (162 48 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (72 732 540 36) NIL) (TEXT NIL NIL (72 72 468 648) NIL))))))) 1$1È $7È $È7È $È166’$1È$1È$1ŠŠ8$1ŠŠ8$JÈ$È PAGEHEADING RUNNINGHEAD MODERN @@ -81,6 +80,6 @@ I haven't yet documented how to build the .PSCFONT files from .AFM files for new ÿþMODERN MODERNCLASSICCLASSIC     - HRULE.GETFN HRULE.GETFN HRULE.GETFN   HRULE.GETFN HRULE.GETFN • -ÿ-Lc˜ýŠéÏe©#é¢K©&‰  A*y  ‰  ”62 --f4f gbá~(V¶OžÞš$ÌmDATE:iÖ³33(ázº \ No newline at end of file + HRULE.GETFN HRULE.GETFN HRULE.GETFN   HRULE.GETFN HRULE.GETFN ¨ +ÿ-Lc˜ýŠïÁe¯)﨩&  A0y  ‰  ”F2 +-f4f ghá~(\¼Užä©$mDATE:jº32-ázº \ No newline at end of file