Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!decwrl!adobe!gelphman From: gelphman@adobe.COM (David Gelphman) Newsgroups: comp.lang.postscript Subject: Re: The One Page Processor, a PostScript word processor. Keywords: PostScript, word processor, good software, free Message-ID: <1502@adobe.UUCP> Date: 2 Dec 89 21:33:13 GMT References: <1989Nov29.131039.22368@sgzh.uucp> Reply-To: gelphman@adobe.UUCP (David Gelphman) Organization: Adobe Systems Incorporated, Mountain View Lines: 70 In article <1989Nov29.131039.22368@sgzh.uucp> Bruno Pape, P.O. Box 368, Thomaston CT, 06787, USA writes: >Have at it. If your running UNIX here is a shell script you could use. > >% >% Checks to see if on a color PostScript device. >% A real lousy test. A product name with Color, color, or >% COLOR in it means a color device? I hope. >% > >statusdict begin product end >(Color) search >{ > pop pop pop def_colors >}{ > (color) search > { > pop pop pop def_colors > }{ > (COLOR) search > { > pop pop pop def_colors > }{ > pop no_colors > } ifelse > } ifelse >} ifelse This approach of testing for color is STRONGLY discouraged. The best way to test for extensions or functionality is to look directly for the feature for which you are interested. In this case, 'setrgbcolor' is a standard part of the language and has been in all implementations including the original Apple LaserWriter printer. If used on a black and white output device, the rgb color is mapped into the NTSC gray equivalent. Applications which wish to apply rgb color to line art and text can do so by using setrgbcolor on all PostScript output devices. The 'setcmykcolor' operator today exists only in color output devices but one can expect it to exist in future b&w devices. If you need to use this operator then it is a simple matter to test for the functionality and emulate it if it isn't available. For example: /setcmykcolor where {% yes it is known pop % pop the dict found }{ % no it isn't /setcmykcolor % c m y k {% pick your favorite strategy for mapping cmyk % to rgb...here is the way Adobe Illustrator does it 1 sub 4 1 roll 3 { 3 index add neg dup 0 lt { pop 0 } if 3 1 roll } repeat setrgbcolor pop } bind def }ifelse % see the Color Extensions document on the file server for more detail % about mappings between rgbcolor space and cmykcolor space Once 'setcmykcolor' has been conditionally defined as above you can use it with impunity. There is no need to check for product strings, etc to use specific operators...test for the operators themselves. David Gelphman Adobe Systems Incorporated