Till Kamppeter [Wed, 18 Jan 2023 20:48:10 +0000 (17:48 -0300)]
COPYING, NOTICE: Simplification for autotools-generated files
autotools-generated files can be included under the license of the
upstream code, and FSF copyright added to upstream copyright
list. Simplified debian/copyright appropriately.
Till Kamppeter [Tue, 17 Jan 2023 16:53:23 +0000 (13:53 -0300)]
Build system: Do not explicitly check for libpoppler-cpp
The cups-filters does not contain any code using libpoppler-cpp,
therefore we let ./configure not check for it. This makes building
distribution packages easier.
Till Kamppeter [Fri, 6 Jan 2023 19:13:29 +0000 (16:13 -0300)]
README.md: Removed Printer Application links
The package cups-filters only contains classic CUPS filters and
backends, not relevant for Printer Applications, as they would use the
underlying filter functions of libcupsfilters.
Till Kamppeter [Thu, 17 Nov 2022 12:58:03 +0000 (13:58 +0100)]
Removed everything which got split out
In the New Architecture for printing we switch to an all-IPP workflow
with PPD files being abolished and classic CUPS printer drivers
replaced by Printer Applications (software emulation of driverless IPP
printers).
To conserve the functionality of the CUPS filters which got developed
over the last 20+ years into a PPD-less, IPP-driven world without
having to maintain and include the legacy PPD support in OS
distributions and other system environments, the original cups-filters
package got split into 5 separate packages: libcupsfilters, libppd,
cups-filters, braille-printer-app, and cups-browsed, with
libcupsfilters and braille-printer-app not containing PPD file support
code any more and cups-browsed being planned to drop explicit use of
PPD files.
This commit drops everything from the cups-filters repository which
got split out into the other 4, new repositories.
What remains are the CUPS filter executables, from which most are
wrappers around filter functions implemented in the libcupsfilters and
libppd libraries, backends, the "driverless" utility for setting up
driverless printers with classic printer setup tools, and auxiliary
files (PPD files, *.drv files, MIME rules, ...).
This package is needed for using CUPS 2.x with filters from
libcupsfilters (2.x) and libppd.
It is not needed/does not make sense to be used with CUPS 3.x or the
CUPS Snap (or any other containerized CUPS implementation). If you
need printer drivers for such CUPS versions, use Printer Applications.
Till Kamppeter [Mon, 14 Nov 2022 22:33:16 +0000 (23:33 +0100)]
Added DEVELOPING.md and CONTRIBUTING.md
These files are mainly overtaken from CUPS. They provide information
for contributors: Coding style, contact, where to report bugs/post
feature requests, ...
- Renamed NEWS to CHANGES.md
- Moved changes on 1.x to CHANGES-1.x.md
- As changes for 2.0b1 listed all changes compared to the last 1.x release
(1.28.16), in preparation for the separation already divided up by the
components.
- Converted README to README.md, some updates of the text.
Till Kamppeter [Fri, 11 Nov 2022 19:19:57 +0000 (20:19 +0100)]
Data files: Changed license info to Apache 2.0
Changed the license info in the file headers to the license used by
CUPS, on PostScript files, *.drv PPD generator files, M4 files, MIME
rules, and PPD files.
Till Kamppeter [Sun, 23 Oct 2022 19:21:41 +0000 (21:21 +0200)]
cups-browsed, driverless: Code clean-up for code of the utilities
Cleaned up the code in the utils/ drirectory following the coding
style rules in the DEVELOPING.md file of the CUPS source code.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions received during more than a
decade, even before the start of the cups-filters project.
In addition, all the file's header comments reflect the new license,
Apache 2.0, the same license as used for CUPS.
Note that we did not clean up driverless.c, as here we still accept a
major code contribution from the GSoC.
Till Kamppeter [Sat, 22 Oct 2022 14:32:45 +0000 (16:32 +0200)]
CUPS backends: Code clean-up for code in backend/
Cleaned up the code of the legacy CUPS backends following the coding
style rules in the DEVELOPING.md file of the CUPS source code.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions received during more than a
decade, even before the start of the cups-filters project.
In addition, all the file's header comments reflect the new license
now, Apache 2.0, the same license as used for CUPS.
Till Kamppeter [Fri, 21 Oct 2022 21:56:00 +0000 (23:56 +0200)]
CUPS filters: Code clean-up for code in filter/
Cleaned up the code of the legacy CUPS filters/filter function
wrappers following the coding style rules in the DEVELOPING.md file of
the CUPS source code.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions received during more than a
decade, even before the start of the cups-filters project.
In addition, all the file's header comments reflect the new license
now, Apache 2.0, the same license as used for CUPS.
Till Kamppeter [Wed, 19 Oct 2022 21:38:59 +0000 (23:38 +0200)]
libppd: Code clean-up for code of foomatic-rip
Cleaned up the code following the coding style rules in the
DEVELOPING.md file of the CUPS source code.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
The indent width is set to 2 spaces instead of 4, to match the other
files.
This way we get rid of the mix of many different coding styles which
came together from the many code contributions received during more
than a decade, even before the start of the cups-filters project.
libcupsfilters 2.x (cfFilterGhostscript() filter function) requires
Ghostscript 10.00.0 for a "cups"/"pwgraster"/"appleraster"/"urf"
output device with full support for PPD-less use. Ghostscript 10.01.0
is recommended, to fix
Till Kamppeter [Sun, 16 Oct 2022 07:19:26 +0000 (09:19 +0200)]
libcupsfilters, libppd: cfFilterExternal() filter function
Moved the core functionality of the ppdFilterExternalCUPS() filter
function from libppd into libcupsfilters, as the new
cfFilterExternal() filter function.
This way also in applications without PPD file support, not using
libppd, external filter executables can be easily integrated in filter
function chains. This is for example needed if filters are not written
in C and conversion gets too awkward and error-prone, or is not even
possible (like with closed-source filters).
The Braille embosser printer driver for example contains filters which
are shell scripts.
External filters must use the call scheme of either CUPS filters or
System V interface scripts. Both call schemes are merely the same,
only in the CUPS filters there got added that input can come from
stdin instead of only via files named in the 6th and further command
line arguments.
ppdFilterExternalCUPS() is a wrapper around cfFilterExternal() now and
does not more than setting the cups-specific environment variables
CUPS_DATADIR, CUPS_SERVERBIN, CUPS_SERVERROOT, CUPS_STATEDIR,
SOFTWARE, CONTENT_TYPE, FINAL_CONTENT_TYPE, PRINTER, PPD, DEVICE_URI
to emulate a cUPS environment as good as possible. The PPD's file name
for the PPD environment variable is taken from the "libppd" extension
for the filter data.
For calling CUPS backends for job execution, the DEVICE_URI
environment variable must be set to the CUPS device URI of the
printer. This can be done by setting the variable right away or adding
it to the environment variable list in the parameters.
The parameters data structure for both cfFilterExternal() and
ppdFilterExternalCUPS() is cf_filter_external_t (in
cupsfilters/filter.h) now and not ppd_filter_external_cups_t any
more. Here the device_uri field got removed (the DEVICE_URI
environment variable has to be used instead) and the is_backend field
got replaced by exec_mode. exec_mode allows 4 setting: -1 for System V
interface scripts (input is file named by 6th command line argument),
0 for CUPS filter (input via stdin), 1 for CUPS backend in job
execution mode, 2 for CUPS backend in device discovery mode (no
command line arguments).
To allow easy handling of the environment variable list in the
parameters, the envp field, the internal helper functions
add_env_var() and get_env_var() got promoted into the API, as
cfFilterAddEnvVar() and cfFilterGetEnvVar(). This allows also libppd
to use these functions.
For testing and debugging any changes on cfFilterExternal() and
ppdFilterExternalCUPS() a new wrapper pseudo CUPS filter,
"test-external", source file filter/test-external.c, got added. This
one is mainly intended to be called manually. To tell which filter or
backend should be called and in which mode, one of the environment
variables INTERFACE, FILTER, CUPSFILTER, or CUPSBACKEND has to be set
to the filter/backend executable.
Till Kamppeter [Sat, 15 Oct 2022 14:13:50 +0000 (16:13 +0200)]
libcupsfilters: Added info about source of human-readable option strings
The files cupsfilters/catalog.c and cupsfilters/catalog.h contain an
API to obtain human-readable and translated strings for printer
options and choices. Document where the actual strings are taken from.
Till Kamppeter [Sat, 15 Oct 2022 13:23:10 +0000 (15:23 +0200)]
libppd: Code clean-up for code of libppd
Cleaned up the code following the coding style rules in the
DEVELOPING.md file of the CUPS source code.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions received during more than a
decade, even before the start of the cups-filters project.
In addition, all the file's header comments reflect the new license,
Apache 2.0, the same license as used for CUPS.
Till Kamppeter [Tue, 11 Oct 2022 23:02:42 +0000 (01:02 +0200)]
libcupsfilters: Code clean-up for code of testpdf1 and testpdf2
Cleaned up the code following the coding style rules in the
DEVELOPING.md file of the CUPS source code.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions received during more than a
decade, even before the start of the cups-filters project.
In addition, one can now supply a fon file as argument to testpdf2, so
that this program embeds the supplied font instead of a standard one.
Till Kamppeter [Tue, 11 Oct 2022 22:40:52 +0000 (00:40 +0200)]
libcupsfilters: Move test suite programs to cupsfilters/
Two test suite programs for libcupsfilters, test_pdf1.c and
test_pdf2.c were still in the filter/ directory. This commit moves
them into cupsfilters and correct their naming style.
Till Kamppeter [Tue, 11 Oct 2022 06:49:40 +0000 (08:49 +0200)]
libcupsfilters: Renamed functions and types in fontembed code
Renamed all functions and types in the source files in the fontembed/
subdirectory tofollow the rules of DEVELOPING.md of CUPS.
To distinguish functions and types internal to only fontembed/ and
internal to the whole libcupsfilters, the ones internal to fontembed/
have two underscores in the beginning of their names now
("__cfFontEmbed...", "__cf_fontembed_...") while the ones which form
the internal API to libcupsfilters have only one ("_cfFontEmbed...",
"_cf_fontembed_...").
Also considered the API of fontembed as internal to
libcupsfilters. Therefore renamed cupsfilters/fontembed.h to
cupsfilters/fontembed-private.h and not installing it into
/usr/include.
Till Kamppeter [Mon, 10 Oct 2022 18:34:12 +0000 (20:34 +0200)]
libfontembed, libcupsfilters: Merge libfontembed into libcupsfilters
libfontembed is only used by cups-filters, and here only by the
cfFilterTextToPDF() filter function ("texttopdf" CUPS filter, also
part of "universal" CUPS filter). It is also not used by any other
package (at least of Ubuntu Main and Universe).
To ease the separation of cups-filters into their components (similar
to CUPDS 3.x we will separate, into libcupsfilters, libppd,
cups-filters, and cups-browsed, to cleanly separate off the PPD file
support) we merge the functionality of libfontembed into
Libcupsfilters, to keep the cfFilterTextToPDF() filter function for
plain text file printing support.
Till Kamppeter [Mon, 10 Oct 2022 12:16:03 +0000 (14:16 +0200)]
libfontembed: Code clean-up for code of libfontembed
Cleaned up the code following the coding style rules in the
DEVELOPING.md file of the CUPS source code.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions received during more than a
decade, even before the start of the cups-filters project.
Till Kamppeter [Fri, 7 Oct 2022 12:03:22 +0000 (14:03 +0200)]
libcupsfilters: Added RGBW support to cfFilterPCLmToRaster()
Requesting RGBW as destination color space (to test, use pclmtoraster
CUPS filter wrapper and PPD for HP inkjet with hpcups driver of HPLIP)
leads to wrong color output on some input files and even to a crash on
others.
This is cause by missing support for RGBW and this, instead RGB being
output into the destination file with RGBW declared as the color space
in its header.
This commit adds explicit support for RGBW output and this way solves
the problem.
Till Kamppeter [Thu, 6 Oct 2022 15:59:38 +0000 (17:59 +0200)]
libcupsfilters: Code clean-up for code of libcupsfilters
Completed the code clean-up of the source files of libcupsfilters in
the cupsfilters/ directory itself (no sub-directory) following the
coding style rules in the DEVELOPING.md file of the CUPS source code.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions received during more than a
decade, even before the start of the cups-filters project.
Till Kamppeter [Thu, 29 Sep 2022 22:41:46 +0000 (00:41 +0200)]
libcupsfilters: Code clean-up for code of libcupsfilters
Cleaned up the second bunch of source code files of libcupsfilters in
the cupsfilters/ directory itself (no sub-directory) following the
coding style rules in the DEVELOPING.md file of the CUPS source code.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions rteceived during more than a
decade, even before the start of the cups-filters project.
Till Kamppeter [Sun, 25 Sep 2022 21:03:08 +0000 (23:03 +0200)]
libcupsfilters: Removed portability implementationsn of functions
For portability implementations of the GNU C functions getline() and
strcasestr() were included in the source code but there is nothing in
the build system making them actually used if the system does not
provide them.
Therefor we do not take them to 2.x and remove them here.
Till Kamppeter [Sat, 10 Sep 2022 06:48:48 +0000 (08:48 +0200)]
libcupsfilters: Code clean-up for code of cfFilterPDFToPDF()
Cleaned up the first bunch of source code files of libcupsfilters in
the cupsfilters/ directory itself (no sub-directory) following the
coding stype rules in the DEVELOPING.md file of the CUPS source code.
Comments are re-formatted to use "// ..." instead of "/* ... */", like
in PAPPL, so C and C++ files get the same comment style.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Also we get rid of the mix of many different coding styles which came
together from the many code contributions rteceived during more than a
decade, even before the start of the cups-filters project.
Till Kamppeter [Mon, 5 Sep 2022 22:06:10 +0000 (00:06 +0200)]
libcupsfilters: Code clean-up for code of cfFilterPDFToPDF()
Cleaned up all the source code files of the cfFilterPDFToPDF() filter
function (all files in cupsfilters/pdftopdf/) following the coding
stype rules in the DEVELOPING.md file of the CUPS source code.
This improves the readability of the code a lot, especially as missing
spaces got inserted in comma-separated lists ("xxx,yyy,zzz" -> "xxx,
yyy, zzz") and around operators ("x=a*(b+c)%4" -> "x = a * (b + c) %
4"), what got nearly completely missed out by several contributors.
Till Kamppeter [Sun, 4 Sep 2022 13:22:57 +0000 (15:22 +0200)]
Removed PHP and Perl APIs
The included PHP and Perl APIs did not get actually maintained and
especially never used by anyone. They still were on the API level of
CUPS 1.2. And the Perl part was not even supported by the build system
(only the scripting/perl/ directory in EXTRA_DIST to get it into the
source tarball).
Therefore we do not take it over into cups-filters 2.x and drop it
here.
Till Kamppeter [Sun, 4 Sep 2022 12:59:33 +0000 (14:59 +0200)]
libcupsfilters: Removed support for legacy image formats
Removed support for the legacy image formats GIF, Photo CD, X Pixmap,
X Bitmap, PNM (Portable Anymap/Bitmap/Graymap/Pixmap), BMP, SGI RGB,
Sun Raster. This is to avoid the requirement to maintain gthe code
supporting these mostly obsolete image formats.
Till Kamppeter [Sat, 3 Sep 2022 18:08:14 +0000 (20:08 +0200)]
libcupsfilters: Update comments about filter functions in filter.h
The filter functions cfFilterGhostscript() and cfFilterPWGtoPDF()
allow the output format also to be supplied as parameter and not
only via filter data structure.
Till Kamppeter [Sat, 3 Sep 2022 18:00:30 +0000 (20:00 +0200)]
libcupsfilters: Let cfFilterUniversal() not se unnecessary parameters
With the new fields content_type and final_content_type in the filter
data structure the output format does not need to get supplied as
parameter any more for most filter functions. So let
cfFilterUniversal() not supply any parameters any more to filter
functions which do not use them any more.
Till Kamppeter [Sat, 3 Sep 2022 16:31:42 +0000 (18:31 +0200)]
libcupsfilters: Do not feed CUPS Raster into cfFilterPWGToPDF()
- In cfFilterUniversal() correct filter chains to always feed PWG
Raster (or Apple Raster) into cfFilterPWGToPDF():
o After cfFilterImageToRaster() call cfFilterRasterToPWG() before
cfFilterPWGToPDF()
o Do not accept CUPS Raster as input format for cfFilterUniversal(),
so we only need to convert PWG Raster and Apple Raster to PDF,
which works with cfFilterPWGToPDF(). CUPS Raster as input is
actually not needed, as it is not used as network format for print
jobs but only internally by CUPS, usually for Raster drivers. Also
updated the MIME rules to not accept CUPS Raster.
o Convert application/vnd.adobe-reader-postscript (PostScript from
Adobe Reader) always to PDF via cfFilterGhostscript() (to PWG
Raster) and cfFilterPWGToPDF() (to PDF). Removed the other paths
for simplification. Also made sure that the filters to convert PDF
to the final format get added to the chain.
- Let cfFilterRasterToPWG() also accept the final output format PCLm
and then create PWG Raster, in preparation for cfFilterPWGToPDF().
- Let cfFilterPWGToRaster() not accept PCLm as final output format as
its input format (PWG or Apple Raster) is directly accepted by
cfFilterPWGToPDF() and so this filter is not needed for PCLm as
final output format.
- These changes also fix printing
application/vnd.adobe-reader-postscript (PostScript from Adobe
Reader) with the cfFilterUniversal() filter function.
Till Kamppeter [Fri, 2 Sep 2022 23:31:37 +0000 (01:31 +0200)]
libcupsfilters: Renamed cfFilterRasterToPDF() to cfFilterPWGToPDF()
Renamed the filter function cfFilterRasterToPDF() to
cfFilterPWGToPDF() as it actually does not work with CUPS Raster input
but only with PWG Raster input (or URF/Apple Raster).
Also renamed the corresponding CUPS filters to pwgtopdf and pwgtopclm.
Till Kamppeter [Fri, 2 Sep 2022 22:58:48 +0000 (00:58 +0200)]
libcupsfilters: In cfFilterPDFToRaster() Fixed margins of output pages
The PDF rasterizing filter function cfFilterPDFToRaster() which is
based on Poppler and usually only used when Ghostscript is not
available did not get enough testing and produced raster files with
wrong margins.
This commit fixes the problems:
- Apply "MediaClass"/"media-class" option only if final output format
is CUPS Raster or PWG Raster. Let the option do not change any thing
if not present. When switching the format due to this option, also
change the outformat variable.
- Supply a pointer to the outformat to parse_opts(), so that if
parse_opts() changes the outformat the caller gets this change.
- The cfFilterRasterToPCLm() filter function only accepts PWG Raster
as input, not CUPS Raster.
Till Kamppeter [Fri, 2 Sep 2022 11:24:51 +0000 (13:24 +0200)]
libcupsfilters: cfFilterUniversal() supports also Poppler's pdftops now
Added support for Poppler's pdftops instead of Ghostscript for PDF
rendering by the universal filter function cfFilterUniversal().
By conditional compiling either the filter functions to use
Ghostscript or the ones to use pdftops are used. This can be
controlled via ./configure script, by using the "--disable-..."
argument for the unwished PDF renderer. If both PDF renderers are
enabled, Ghostscript is preferred.
If pdftops is used, the cfFilterUniversal() filter function does not
support PostScript input. For this Ghostscript is required.
If both Ghostscript and pdftops are disabled by ./configure arguments,
the "universal" CUPS filter wrapper is not installed, to not use the
then rather crippled cfFilterUniversal() filter function as CUPS
filter.
Till Kamppeter [Thu, 1 Sep 2022 21:58:21 +0000 (23:58 +0200)]
Build system: Improvements for ./configure script
- Make sure that always a valid PDF-to-PostScript renderer is
selected, especially if one or another renderer is disabled, like
"hybrid" ("--with-pdftops=hybrid") does not make sense if Ghostscipt
is disabled ("--disable ghostscript"). In this case the first valid
renderer found will beused.
- In the summary at the end report which PDF-to-PostScript renderer
gets actually used.
- Changed oder of treating the PDF-to-PostScript renderer, so that as
first choice Ghostscript would be taken and as second choice
Poppler's pdftops.
- Generate for each supported PDF renderer a "HAVE_..." macro in
config.h, for easily excluding unnecessary code.
Till Kamppeter [Tue, 30 Aug 2022 18:02:49 +0000 (20:02 +0200)]
libppd: In ppdFilterUniversal() set output data type also if no PPD supplied
Now both cfFilterUniversal() and its PPD file support wrapper
ppdFilterUniversal() are absolutely compatible if no PPD file got
supplied via named extension to the filter data.
Before, if no PPD was supplied and no actual_output_type in the
parameters, the output data type stayed undetermined and the function
errored out not being able to find a filter combination for the
requested conversion.
Now always final_content_type of thef ilter data is used if there is
no actual_output_type specified in the parameters, regardless of
whether we have a PPD file or not.
Till Kamppeter [Mon, 29 Aug 2022 16:13:06 +0000 (18:13 +0200)]
libppd: Improvements on ppdLoadAttributes() PPD-to-printer-IPP-attributes
As this function is for telling filters and drivers how to print a job
on the printer for which the supplied PPD is and NOT for a PPD
retro-fitting Printer Application (or any other PPD-supporting IPP
print server) to answer a get-printer-attributes IPP request several
changes were needed.
- More sophisticated way to find the default resolution. Do not only
look for "*DefaultResolution:" but also the result of a
ppdRasterInterpretPPD() call, what is marked in the "Resolution"
option, "*cupsUrfSupported:", "*cupsPwgRaster...", "*cupsPclm..."
(from PPD generator of libppd).
- To determine the supported output formats take care that in
"*cupsFilter2: ..." lines in the PPD the final output format is the
second word and no the first, as in "*cupsFilter: ..." lines.
- For media-col-ready use the same entry as for media-col-default and
for media-ready use the same entry as for media-default.
- For print-content-optimize-supported, use the 5 standard values, no
just "auto".
- Removed the irrelevant parts about supplies. They produced constant,
device-independent output anyway.
- Removed the document-password-supported attribute.
- When synthesizing a device ID, also create a CMD: field from the
MIME rules in the "*cupsFilter(2): ..." lines.
Till Kamppeter [Sun, 28 Aug 2022 21:49:32 +0000 (23:49 +0200)]
libppd: Corrections for determining resolution in ppdFilterPDFToPS()
If we have a PPD file we use ppdRasterInterpretPPD() to determine the
actual resolution of the current job. Only consider the resolution
invalid if both horizontal and vertical resolution are 100 dpi.
When getting resolution from PPD's "Resolution" option setting or
default resolution, set y resolution to x resolution if we have only
one number ("600dpi").
Till Kamppeter [Sun, 28 Aug 2022 15:55:56 +0000 (17:55 +0200)]
libppd: In ppdLoadAttributes() complete custom page size support
If the user has sent a job on a custom page size, these custom size is
correctly set as default size in the printer IPP attributes derived
from the PPD file, as media-col, with dimensions, margins, and PWG
specifying the size in the units originally used for it.
Also added the custom page size range keywords to the
"media-supported" printer IPP attribute.
Till Kamppeter [Sat, 27 Aug 2022 23:16:02 +0000 (01:16 +0200)]
libcupsfilters: Compare case-insesitively in cfFilterUniversal()
Case-sensitive comparing of MIME types does not make sense, there are
no two MIME types where the names only differ by lower/uppar
case. This way wrongly written MIME types (like application/pclm
instead of application/PCLm) are no problem any more.
Till Kamppeter [Sat, 27 Aug 2022 23:04:32 +0000 (01:04 +0200)]
libppd: In ppdFilterLoadPPD() let PDF filter log pages when output is PS
PostScript output is going through the ppdFilterPSToPS() filter to
insert the PostScript code of the option settings into the PostScript
output data stream. The ppdFilterPSToPS() filter only logs pages if
the PPD is a pure PostScript PPD (without "*cupsFilter(2): ..."
lines). If it is not, the PDF filter has to log. This change lets the
PDF filter log the pages in such a case.
Till Kamppeter [Sat, 27 Aug 2022 20:53:45 +0000 (22:53 +0200)]
libppd: In ppdFilterLoadPPD() correct check for final output type
To determine whether the PDF filter (usually cfFilterPDFToPDF()) has
to do the page logging for CUPS ("PAGE: XX YY" log messages) or the
driver filter, we check the final output type (FINAL_CONTENT_TYPE
environment cariable from CUPS) to see whether a driver filter is
involved which should log the pages by itself.
The code to compare the final output type with the "*cupsFilter(2):
..." lines in the PPD file was broken, which is fixed with this
commit.
Till Kamppeter [Thu, 25 Aug 2022 21:32:36 +0000 (23:32 +0200)]
libfontembed, libcupsfilters, libppd: assert() only if DEBUG is set
A failing assert() makes the whole program crash, a daemon (Printer
Application) crashes when a filter fails on a damaged input file, a
distro-packaged program sends automatic bug reports to the distro,
... Sometimes assert() is really overkill.
But assert() can be useful for debugging, as one gets easily aware
when some values are wrong somewhere (this probably made the
contributors yo cups-filters insert that many assert() calls).
At least, assert() should only be used for debugging, not in
production code.
Therefore we have replaced all assert() calls by the DEBUG_assert()
macro and the macro is set to assert() when the code is compiled with
the DEBUG macro set and to nothing otherwise. For setting this macro
and other debugging macros there are */debug-internal.h files for all
the 3 libraries now.
Also defined functions for DEBUG_printf and DEBUG_puts in
libcupsfilters (cupsfilters/debug.c).
On a compilation with DEBUG set ("CXXFLAGS=-DDEBUG CFLAGS=-DDEBUG
./configure ...") found some build failures and fixed them.
Till Kamppeter [Sat, 20 Aug 2022 20:38:08 +0000 (22:38 +0200)]
libppd: Added NULL checks when "libppd" extension not present
The functions ppdFilterExternalCUPS(), ppdFilterEmitJCL(), and
ppdFilterUniversal() get the PPD file via the "libppd" extension for
the filter data. There was no NULL check when the extension was not
present, without extension there was simply a crash, a hang, or other
unexpected behavior.
This commit adds NULL checks so that if the extension is missing, the
functions simply do what they can do without PPD file, but do not
cause a crash.
Till Kamppeter [Sat, 20 Aug 2022 15:29:37 +0000 (17:29 +0200)]
libppd: Make driverless printing PPDs from CUPS work correctly
If one sets up a driverless printer with CUPS, either manually by the
"-m everywhere" option for "lpadmin" (or equivalent functionality in
the web interface) or automatically when CUPS creates a temporary
queue, the generated PPD file did not work correctly with current
cups-filters.
CUPS' auto-generated PPD files to not contain "*cupsUrfSupported: ..."
or "*cupsPwgRaster..." lines, but instead, add pseudo-PostScript code
(as in PPDs for CUPS Raster drivers) to the "ColorModel" and
"cupsPrintQuality" options.
Therefore the ppdLoadAttributes() function should not create artifical
"urf-supported" or "pwg-raster-..." printer IPP attributes and the
ppdFilterLoadPPD() should instead create a sample Raster header as it
already does for PPDs for CUPS Raster drivers. This way color space,
depth, and resolution get supplied to the filters via the header.
Carlos Nihelton [Tue, 16 Aug 2022 14:47:52 +0000 (11:47 -0300)]
Makefile.am: Move the libppd declarations after cups-filters (#477)
When doing "sudo make install", the re-linking breaks because libppd depends on libcupsfilters (and not vice-versa, as before), not yet installed. Reordering the declarations in the Makefile.am seems to fix the bahavior.
To reproduce the issue try on a minimal Ubuntu environment, such as WSL or cloud images running on LXD or docker:
```
sudo apt install autotools-dev autoconf automake autopoint libavahi-client-dev libavahi-glib-dev libcurl4-gnutls-dev libglib2.0-dev libgnutls28-dev libjpeg-dev libpam0g-dev libpng-dev libusb-1.0-0-dev zlib1g-dev libcups2-dev libcupsimage2-dev libssl-dev libtool libqpdf-dev poppler-utils libfontconfig1-dev libpoppler-cpp-dev libtiff5-dev libdbus-1-dev libexif-dev librsvg2-bin sharutils liblcms2-dev ghostscript pkg-config g++ --no-install-recommends
git clone https://github.com/OpenPrinting/cups-filters
cd cups-filters
./autogen.sh
./configure --prefix=/usr --disable-ldap --disable-foomatic --disable-braille --disable-mutool
make
sudo make install
```
Only the install target should fail to relink the libppd against libcupsfilters due the latter not yet being installed. With this patch the order is corrected which should solve the problem.
Till Kamppeter [Thu, 11 Aug 2022 12:51:35 +0000 (14:51 +0200)]
libcupsfilters, libppd: Separated PPD file support from libcupsfilters
This commit reverses the dependencies of the libcupsfilters and libppd
libraries. Instead of libcupsfilters depending on libppd no libppd
depends on libcupsfilters.
This is important for removing PPD file support from OS distributions
and so allow discontinuing the maintenance of PPD-file-supporting code
in the future. In a later step libppd and the filter executables for
CUPS will get separated from the cups-filters project/repository into
their own projects/repositories.
CUPS will not use PPD files any more from version 3.0.0 on, but go
all-IPP instead. CUPS iteself will only support driverless IPP
printers (IPP Everywhere, AirPrint, Mopria) and no classic printer
drivers which consist of PPD files and filter/backend executables any
more. For printers which still need drivers Printer Applications ar
the new driver format. A Printer Application is a software emulation
of a driverless IPP printer which on the other end talks with the
physical printer.
These modifications introduce several changes on the APIs of
libcupsfilters and libppd. Software depending on these libraries (like
pappl-retrofit) needs to get adapted. All filter executables,
backends, and utilities included in cups-filters got already adapted
with this commit.
The following changes have been done:
- cf_filter_data_t gets support for an array of named extension data
structures and does not support field for the PPD name and data any
more. libppd defines an extension named "libppd" to hold PPD name
and data. Filter functions (of libppd) which explicitly use/support
PPD files access the PPD file through this extension, others simply
ignore the extension if present.
- All filter functions in libcupsfilters drop PPD support completely.
They get printer-specific data only by the printer IPP attributes
and by option settings in the option list of the cf_filter_data_t
structure. The full functionality of each filter function is
conserved.
- Filter functions which process or generate raster data can also get
the parameters for the raster data as a CUPS Raster sample header.
- To continue offering PPD-supporting CUPS filters libppd provides the
ppdLoadAttributes() to convert a PPD file into printer IPP
attributes, the ppdFilterLoadPPD() to convert further PPD attributes
which have no IPP equivalent into option settings and a CUPS Raster
sample header, and the wrapper function ppdFilterCUPSWrapper()
called by the CUPS filter executable, making the mentioned two
functions be called before the filter function itself (in most cases
from libcupsfilters) gets called.
- Filter functions which need PPD file support, especially those which
output PostScript, and also the former cfFilterExternalCUPS() (now
ppdFilterExternalCUPS()) filter function have moved to libppd.
- The support for PostScript output has also been removed. Nowadays it
only serves for printing on PostScript printers (where one usually
also has a PPD file), as document exchange format PostScript got
fully replaced by PDF.
- If PPD file support cannot be added to a filter function by only
extracting the printer's properties from the PPD via printer IPP
attributes and option settings, a wrapper filter function is created
in libppd. This we do for cfFilterUniversal() (to correct the output
format according to "*cupsFilters2: ..." lines in the PPD) and for
cfFilterPDFToPDF()/cfFilterImageToPDF() (to add JCL/PJL commands
from the PPD file for "classic" PDF printers).
- In raster driver support code moved the functions to read parameters
from the PPD file to libppd.
- Moved the PPD file generator used by cups-browsed and by the
driverless utility to libppd.
- Moved the handling of common parameters, like page size, duplex,
backside orientation, color spaces and depths, Raster headers, ...,
by the filter functions into separate functions to not duplicate the
code in each filter function.
- Improved the page size handling, especially accepting all types of
parameter supply (options, job attributes, printer attributes,
Raster headers, handling borderless printing and overspray,
specification of size by dimensions or by name, custom size,
margins, recognition whether user explicitly requested a page size
(if not, use input page size if possible) ...
- Made functions for handling human-readable/translation strings (of
the PPD generator) API functions of libcupsfilters.
Till Kamppeter [Fri, 20 May 2022 14:05:23 +0000 (16:05 +0200)]
libcupsfilters: In the env variables for cfFilterExternalCUPS() use CUPS 2.5.99
Use CUPS version 2.5.99 for the "SOFTWARE" environment variable when
calling CUPS filters or backends via the cfFilterExternalCUPS() filter
function. This is the last CUPS version which supports PPD files and
classic printer drivers.
Till Kamppeter [Fri, 20 May 2022 09:38:40 +0000 (11:38 +0200)]
libcupsfilters: Correct lengths of log message prefixes
In the cfFilterExternalCUPS() filter function we catch the stderr
(log) output of the called CUPS filter and convert it into log
function calls with correct log levels. here we need to compare
exactly the prefix, not more and not less, to safely identify the log
level of each line.
Sachin Thakan [Sat, 14 May 2022 07:12:36 +0000 (12:42 +0530)]
libcupsfilters: Read image resolution from EXIF data of JPEG, PNG, TIFF
If images are printed with "print-scaling=none" one wants to have their original size. To get an original size in absolute dimensions (inches, cm) one needs the pixel count and resolution (dpi, ppi). The resolution is supposed to be in the image's own header but in practice it is often not there.
Images from cameras, and also from some scanners, have additional metadata, the so-called EXIF data which usually contains a resolution. So we read out this with the help of libexif.
In Linux distributions there we usually have libexif and so it is no big effort to let libcupsfilters use it. But it is not required, so for low-resource systems libcupsfilters can be built without (and then not having this feature).
Till Kamppeter [Tue, 12 Apr 2022 08:37:40 +0000 (10:37 +0200)]
libcupsfilters: For ghostscript() require GS 9.56.0
Removed the conditionals for the presence or absemse of the
"appleraster" output device in Ghostscript (version 9.56.0 and
newer). We already require that the "pclm" device is there (GS version
9.55.0 and newer). So we remove the conditionals now and simply
require Ghostscript 9.56.0.
Till Kamppeter [Tue, 12 Apr 2022 08:00:28 +0000 (10:00 +0200)]
libcupsfilters: Added gray PCLm support to ghostscript()
PCLm does not only support 24-bit sRGB bur also 8-bit sGray. All PCLm
printers, regardless of whether they are color or monochrome accept
these two color spaces. Monochrome printers have to convert color into
gray if needed.
Ghhostscript has a grayscale PCLm output device, "pclm8" since version
9.56.0. We now make use of it if the job is monochrome. This also
allows us to supply the cortrecr sGray ICC profile instead of the sRGB
one.
Till Kamppeter [Tue, 12 Apr 2022 07:44:31 +0000 (09:44 +0200)]
libcupsfilters: Let ghostscript() do raster PDF in gray on bw jobs
The ghostscript() filter function did PDF Image (raster PDF) output in
color if the printer is a color printer, in gray only if the printer
is monochrome. Monochrome jobs were therefore printed in color on
color printers. This commit makes grayscale output also used if the
job is monochrome.