diff options
author | Till Kamppeter <till.kamppeter@gmail.com> | 2022-02-20 00:01:56 +0100 |
---|---|---|
committer | Till Kamppeter <till.kamppeter@gmail.com> | 2022-02-20 00:01:56 +0100 |
commit | d56ebbd30ded81354936bc7d4b1caab73d5e0d6d (patch) | |
tree | c21b292625ecbdcdcd91a6667072cdbb5a7a04b4 /cups | |
parent | 01794d95ce7b947d483f06cae8de0affd2451392 (diff) | |
download | ghostpdl-d56ebbd30ded81354936bc7d4b1caab73d5e0d6d.tar.gz |
"cups" output device: Support for Apple Raster (URF) output
Apple Raster (aka URF) output: With -sDEVICE=appleraster or
-sDEVICE=urf (instead of -sDEVICE=cups) the output is in the Apple
Raster format and not in CUPS Raster format.
The format is used by Apple's AirPrint which allows printing from iOS
devices. Due to this practically all modern printers understand this
format and so providing it allows easy, driverless printing.
Before, in order to output Apple Raster, the gstoraster filter of
cups-filters had used the "cups" output device of Ghostscript to
produce CUPS Raster and after that the rastertopwg filter of CUPS had
to turn this into Apple Raster. With this commit a future version of
cups-filters can let gstoraster (the ghostscript() filter function)
directly output Apple Raster and this way save one filter step.
Outputting Apple Raster instead of PWG Raster (which we could already
do via -sDEVICE=pwgraster) is trivial. One has only to tell the
cupsRasterOpen() function of libcups to write Apple Raster headers
instead of PWG Raster headers by a simple flag, so this commit
consists mainly of the definition of the output device names
"appleraster" and "urf" and make the output device set said flag when
one of these device names is used.
I have defined two device names for exactly the same thing, as I am
not really sure which one is the better or if one could cause any
problems. We could remove one later if needed. The output is
absolutely identical for both.
Apple Raster support was introduced to libcups in CUPS 2.2.2, so the
CUPS 2.2 API does not contain it necessarily, therefore the 2.3 CUPS
API is the minimum requirement by the ./configure script to build
Ghostscript with Apple Raster/URF output support.
The libcups which is included with the Ghostscript source is too old,
and when you build with it (--with-local-cups) you will not get Apple
Raster support. But remember that this build option is only for
development and debugging and not for production.
The commit also contains a bug fix: devs.mak hard-coded -I./cups/libs/
in the compilation command line of gdevcups.c, making always the
included cups/raster.h being used instead of the system's one and so
always having a too old cups/raster.h which suggests that Apple Raster
is not supported. This I have fixed by removing the -I./cups/libs/,
--with-local-cups works also without.
Diffstat (limited to 'cups')
-rw-r--r-- | cups/gdevcups.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cups/gdevcups.c b/cups/gdevcups.c index a9dbc1424..e3c3c46c3 100644 --- a/cups/gdevcups.c +++ b/cups/gdevcups.c @@ -461,6 +461,12 @@ cups_initialize_device_procs(gx_device *dev) gx_device_cups gs_cups_device = { gs_xxx_device("cups", "") }; gx_device_cups gs_pwgraster_device = { gs_xxx_device("pwgraster", "PwgRaster") }; +#if defined(CUPS_RASTER_HAVE_APPLERASTER) +gx_device_cups gs_appleraster_device = { gs_xxx_device("appleraster", + "PwgRaster") }; +gx_device_cups gs_urf_device = { gs_xxx_device("urf", + "PwgRaster") }; +#endif /* * Local functions... @@ -2947,7 +2953,14 @@ cups_print_pages(gx_device_printer *pdev, #if defined(CUPS_RASTER_HAVE_PWGRASTER) (strcasecmp(cups->header.MediaClass, "PwgRaster") == 0 ? +#if defined(CUPS_RASTER_HAVE_APPLERASTER) + (!strcmp(cups->dname, "appleraster") || + !strcmp(cups->dname, "urf") ? + CUPS_RASTER_WRITE_APPLE : + CUPS_RASTER_WRITE_PWG) : +#else CUPS_RASTER_WRITE_PWG : +#endif (cups->cupsRasterVersion == 3 ? CUPS_RASTER_WRITE : CUPS_RASTER_WRITE_COMPRESSED)))) == |