]> git.ipfire.org Git - thirdparty/cups-filters.git/log
thirdparty/cups-filters.git
22 hours agofoomatic-rip: `rip_die()` did not relay error to cupsd (#649) master
zdohnal [Wed, 30 Jul 2025 11:55:30 +0000 (13:55 +0200)] 
foomatic-rip: `rip_die()` did not relay error to cupsd (#649)

The function which is used to report error was using incorrect format
for cupsd to process it as error, causing hiding its error messages.

8 days agoIntroduce foomatic-hash and reject unauthorized values in foomatic-rip (#648)
zdohnal [Tue, 22 Jul 2025 13:12:19 +0000 (15:12 +0200)] 
Introduce foomatic-hash and reject unauthorized values in foomatic-rip (#648)

The change provides a way for users to have control over what values are
allowed for the foomatic-rip-related PPD keywords FoomaticRIPCommandLine,
FoomaticRIPCommandLinePDF, and FoomaticRIPOptionSetting. Since the
values can be later used when constructing a shell command, the filter
foomatic-rip was a target of several exploits (caused by issues at
different places in CUPS or in different projects of the printing stack) to
do arbitrary code execution when the filter is used.

By default the filter is run by user lp, so the issue is mitigated, but
this PR gives admin complete control over what can be run in
foomatic-rip and reject anything injected into system via different
ways.

First, the new tool - foomatic-hash - can be called on a PPD file or
directory with drivers/PPDs, with scan output and file with hexadecimal
representation of hashed values. Once the scan output is reviewed by
admin, admin can decide to put the resulting hashes into
/etc/foomatic/hashes.d and allow them for the filter.

4 months agoAdd a configure option for texttopdf filter (#630)
Nathan Muggli [Wed, 19 Mar 2025 07:52:45 +0000 (01:52 -0600)] 
Add a configure option for texttopdf filter (#630)

Add --enable-texttopdf/--disable-texttopdf configure options.  If this
is enabled, build the texttopdf filter. If not enabled, don't build that
filter.

If texttopdf is not enabled, don't add the texttopdf option in
cupsfilters-individual.convs

5 months agoFix build failure with GCC 15 and -std=c23 (#618)
zdohnal [Tue, 11 Feb 2025 08:40:59 +0000 (09:40 +0100)] 
Fix build failure with GCC 15 and -std=c23 (#618)

The newest standard has more strict data type checks, function pointers
in function prototypes have to declare data types of its arguments.

7 months ago.gitignore: Ignore the foomatic-rip executable but not foomatic-rip/ directory
Till Kamppeter [Mon, 23 Dec 2024 00:06:09 +0000 (01:06 +0100)] 
.gitignore: Ignore the foomatic-rip executable but not foomatic-rip/ directory

Fix of Issue #610

11 months agocups-filters 2.0.1 Release 2.0.1
Till Kamppeter [Wed, 14 Aug 2024 22:40:35 +0000 (00:40 +0200)] 
cups-filters 2.0.1 Release

11 months agoserial backend: unbreak build on BSD (#548)
Antoine Jacoutot [Fri, 2 Aug 2024 20:29:28 +0000 (22:29 +0200)] 
serial backend: unbreak build on BSD (#548)

The comments aren't properly protected leading to the following error:
backend/serial.c:822:16: error: expected ';' after expression
                                         * devices

12 months agopclmtoraster: Properly set CFLAGS (#588)
Michael Weghorn [Fri, 5 Jul 2024 11:29:39 +0000 (13:29 +0200)] 
pclmtoraster: Properly set CFLAGS (#588)

As this is a C program, set
`pclmtoraster_CFLAGS`, not `pclmtoraster_CXXFLAGS`.

This fixes building pclmtoraster when libcupsfilter
headers are installed in a non-standard directory.

Previously, when configuring and installing libcupsfilters
with e.g. `--prefix=$HOME/temp/cpdb` and then configuring
cups-filters with `PKG_CONFIG_PATH=$HOME/temp/cpdb/lib/pkgconfig/`,
`make pclmtoraster` would fail like this:

      CC       filter/pclmtoraster.o
    filter/pclmtoraster.c:14:10: fatal error: cupsfilters/filter.h: No such file or directory
       14 | #include <cupsfilters/filter.h>
          |          ^~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.

For this to actually work, recent libcupsfilters
commit [1] is also needed:

    commit 449ac6350d00c385ae226513ef6d85ee81ae161a
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu Jul 4 14:44:26 2024 +0200

        pkgconfig: Add '-I${includedir}' to Cflags (#57)

[1] https://github.com/OpenPrinting/libcupsfilters/commit/449ac6350d00c385ae226513ef6d85ee81ae161a

16 months agoconfigure: Fix broken bashism resulting in logic failure (#567)
Eli Schwartz [Fri, 8 Mar 2024 12:02:33 +0000 (07:02 -0500)] 
configure: Fix broken bashism resulting in logic failure (#567)

After carefully using configure checks designed to work on pre-unix wars
bourne shells -- that is, the `test "$var" = ""` construct once upon a
time wasn't specified to treat "" as a distinct argument, and various
buggy implementations mishandled various forms where the first argument
started with a dash, so the "x" padding provided a guaranteed comparison
-- the configure.ac check then fails to run on any shells at all other
than GNU bash.

Bash provides the standard `test XXX = YYY` or `[ XXX = YYY ]`
utilities. It also provides the ability to spell the equals sign as a
double equals. This does nothing whatsoever -- it adds no new
functionality to bash, it forbids nothing, it is *literally* an exact
alias.

It should never be used under any circumstances. All developers must
immediately forget that it exists. Using it is non-portable and does not
work in /bin/sh scripts such as configure scripts, and it results in
dangerous muscle memory when used in bash scripts because it makes
people unthinkingly use the double equals even in /bin/sh scripts. To
add insult to injury, it makes scripts take up more disk space (by a
whole byte! and sometimes even a few bytes...)

Delete this accidental bashism, and restore the ability to get correct
./configure behavior on systems where /bin/sh is something other than a
symlink to GNU bash.

16 months agoconfigure.ac: Remove final traces of avahi (#558)
Eli Schwartz [Fri, 8 Mar 2024 11:50:13 +0000 (06:50 -0500)] 
configure.ac: Remove final traces of avahi (#558)

This was originally searched for cups-browsed, and during the great
split these lookups accidentally got left in and moved around in the
file.

The original code began with this autoconf comment:
```
dnl Avahi for cups-browsed
```

After shifting down, it became:
```
dnl Avahi
```

After removing avahi from configure.ac, there are no remaining mentions
of avahi anywhere other than CHANGES*.md

22 months agocups-filters 2.0.0 Release 2.0.0
Till Kamppeter [Fri, 22 Sep 2023 16:12:11 +0000 (18:12 +0200)] 
cups-filters 2.0.0 Release

22 months agoEnable application/vnd.cups-postscript in conversion tables (#534)
zdohnal [Thu, 21 Sep 2023 17:52:00 +0000 (19:52 +0200)] 
Enable application/vnd.cups-postscript in conversion tables (#534)

Unfortunately there are filters which produce this MIME type (such as
hpps from hplip), and if someone uses such driver on client and server
has IPP Everywhere/driverless driver, job fails.

The patch (together with change in libcupsfilters, which will come later)
fixes the issue.

2 years agocups-filters 2.0rc2 Release 2.0rc2
Till Kamppeter [Tue, 20 Jun 2023 20:05:40 +0000 (22:05 +0200)] 
cups-filters 2.0rc2 Release

2 years agoMerge pull request from GHSA-gpxc-v2m8-fr3x
Till Kamppeter [Wed, 17 May 2023 09:12:37 +0000 (11:12 +0200)] 
Merge pull request from GHSA-gpxc-v2m8-fr3x

* beh backend: Use execv() instead of system() - CVE-2023-24805

With execv() command line arguments are passed as separate strings and
not the full command line in a single string. This prevents arbitrary
command execution by escaping the quoting of the arguments in a job
with forged job title.

* beh backend: Extra checks against odd/forged input - CVE-2023-24805

- Do not allow '/' in the scheme of the URI (= backend executable
  name), to assure that only backends inside /usr/lib/cups/backend/
  are used.

- Pre-define scheme buffer to empty string, to be defined for case of
  uri being NULL.

- URI must have ':', to split off scheme, otherwise error.

- Check return value of snprintf() to create call path for backend, to
  error out on truncation of a too long scheme or on complete failure
  due to a completely odd scheme.

* beh backend: Further improvements - CVE-2023-24805

- Use strncat() instead of strncpy() for getting scheme from URI, the latter
  does not require setting terminating zero byte in case of truncation.

- Also exclude "." or ".." as scheme, as directories are not valid CUPS
  backends.

- Do not use fprintf() in sigterm_handler(), to not interfere with a
  fprintf() which could be running in the main process when
  sigterm_handler() is triggered.

- Use "static volatile int" for global variable job_canceled.

2 years agoparallel backend: Added missing #include lines 2.0rc1
Till Kamppeter [Tue, 11 Apr 2023 23:25:35 +0000 (01:25 +0200)] 
parallel backend: Added missing #include lines

2 years agocups-filters 2.0rc1 Release
Till Kamppeter [Tue, 11 Apr 2023 23:09:51 +0000 (01:09 +0200)] 
cups-filters 2.0rc1 Release

2 years agoDrop C++ references and obsolete C standards (#513)
Adam Majer [Mon, 10 Apr 2023 14:22:46 +0000 (16:22 +0200)] 
Drop C++ references and obsolete C standards (#513)

With no C++ compiler needed, there is no need to set the
CXXFLAGS or log it during configure. Furthermore, forcing
outdated C11 standard is not a good idea considering compilers
have moved on. We should not limit our feature set, including
compiler warnings, to old standards.

2 years agofoomatic-rip: Fix a SIGPIPE error when calling gs (#517)
Steve Langasek [Fri, 17 Mar 2023 20:02:43 +0000 (13:02 -0700)] 
foomatic-rip: Fix a SIGPIPE error when calling gs (#517)

https://autopkgtest.ubuntu.com/packages/f/foo2zjs/lunar/ppc64el shows
foo2zjs's testsuite failing with cups-filters 2.0beta3 on ppc64el because
the gs command here to check page count is failing with a SIGPIPE when
trying to write back to the parent.  To fix this, we close gs's input fd as
soon as we know we're done writing to it.  Since gs may not have started
processing its input until this happens, also give the final poll() a longer
timeout (5s instead of 1s); without this we see race conditions because
foomatic-rip gives up before gs has had a chance to finish processing.

2 years agoMerge pull request #510 from zdohnal/coverity_fixes
Till Kamppeter [Thu, 16 Feb 2023 16:42:29 +0000 (17:42 +0100)] 
Merge pull request #510 from zdohnal/coverity_fixes

Coverity fixes for 2.0b3

2 years agoRe: Fix issue 6. 510/head
Zdenek Dohnal [Thu, 16 Feb 2023 14:48:32 +0000 (15:48 +0100)] 
Re: Fix issue 6.

Use default branch instead of specific one

2 years agoFix coverity issue 7.
Zdenek Dohnal [Wed, 15 Feb 2023 18:03:37 +0000 (19:03 +0100)] 
Fix coverity issue 7.

Alloc the array only in case we need it to prevent overwriting pointer

2 years agoFix coverity issue 6.
Zdenek Dohnal [Wed, 15 Feb 2023 17:58:08 +0000 (18:58 +0100)] 
Fix coverity issue 6.

Ensure that PrinterPlanes is not zero

2 years agoFix coverity issue 5.
Zdenek Dohnal [Wed, 15 Feb 2023 17:51:32 +0000 (18:51 +0100)] 
Fix coverity issue 5.

Free the struct at the end of function

2 years agoFix coverity issue 4.
Zdenek Dohnal [Wed, 15 Feb 2023 17:48:07 +0000 (18:48 +0100)] 
Fix coverity issue 4.

Move the allocation and big arrays into scope where it is needed

2 years agoFix coverity issue 3.
Zdenek Dohnal [Wed, 15 Feb 2023 17:40:55 +0000 (18:40 +0100)] 
Fix coverity issue 3.

Ensure we have NULL terminator

2 years agoFix coverity issue 2.
Zdenek Dohnal [Wed, 15 Feb 2023 17:39:17 +0000 (18:39 +0100)] 
Fix coverity issue 2.

Delete identical branch

2 years agoFix coverity issue 1.
Zdenek Dohnal [Wed, 15 Feb 2023 17:37:37 +0000 (18:37 +0100)] 
Fix coverity issue 1.

Close file descriptor in case of error

2 years agoconfigure.ac: Change deprecated AC_PROG_LIBTOOL for LT_INIT (#508)
zdohnal [Tue, 14 Feb 2023 18:15:03 +0000 (19:15 +0100)] 
configure.ac: Change deprecated AC_PROG_LIBTOOL for LT_INIT (#508)

2 years agoconfigure.ac: C++ not needed (#504)
zdohnal [Thu, 2 Feb 2023 22:58:36 +0000 (23:58 +0100)] 
configure.ac: C++ not needed (#504)

2 years agocups-filters 2.0b3 Release 2.0b3
Till Kamppeter [Tue, 31 Jan 2023 23:58:04 +0000 (20:58 -0300)] 
cups-filters 2.0b3 Release

2 years agoUpdated CHANGES.md
Till Kamppeter [Tue, 31 Jan 2023 21:37:12 +0000 (18:37 -0300)] 
Updated CHANGES.md

2 years agoAdd templates for issue reports.
Till Kamppeter [Mon, 30 Jan 2023 02:13:45 +0000 (23:13 -0300)] 
Add templates for issue reports.

2 years agoCOPYING: Fixed typo
Till Kamppeter [Thu, 26 Jan 2023 03:45:35 +0000 (00:45 -0300)] 
COPYING: Fixed typo

2 years agoCOPYING, NOTICE: Simplification for autotools-generated files
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.

2 years agotexttopdf: Do not include fontconfig.h in the CUPS filter wrapper
Till Kamppeter [Tue, 17 Jan 2023 18:19:11 +0000 (15:19 -0300)] 
texttopdf: Do not include fontconfig.h in the CUPS filter wrapper

2 years agoBuild system: Do not explicitly check for libpoppler-cpp
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.

2 years agoMakefile.am: Include LICENSE in distribution tarball
Till Kamppeter [Tue, 10 Jan 2023 01:46:16 +0000 (22:46 -0300)] 
Makefile.am: Include LICENSE in distribution tarball

2 years agocups-filters 2.0b2 Release 2.0b2
Till Kamppeter [Sun, 8 Jan 2023 22:51:57 +0000 (19:51 -0300)] 
cups-filters 2.0b2 Release

2 years agoUpdated CHANGES.md
Till Kamppeter [Sun, 8 Jan 2023 03:23:49 +0000 (00:23 -0300)] 
Updated CHANGES.md

2 years agoCleaned up .gitignore
Till Kamppeter [Sat, 7 Jan 2023 01:33:31 +0000 (22:33 -0300)] 
Cleaned up .gitignore

Still contained all the cups-filters entries from before the splitting
of the repositories.

2 years agoCorrected installation path for *.h files of *.drv files
Till Kamppeter [Fri, 6 Jan 2023 20:54:34 +0000 (17:54 -0300)] 
Corrected installation path for *.h files of *.drv files

The ppdc (and underlying functions) of libppd searches for include
files in /usr/share/ppdc and not in /usr/share/cups/ppdc any more.

2 years agoREADME.md: Removed Printer Application links
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.

2 years agoFixes in DEVELOPING.md
Till Kamppeter [Fri, 6 Jan 2023 19:08:32 +0000 (16:08 -0300)] 
Fixes in DEVELOPING.md

- Removed "Interfaces" and "Headers" sections in DEVELOPING.md, as
  cups-filters does not provide a library.

- No "cups" prefix for names in cups-filters C files

2 years agoconfigure.ac: Remove unnecessary "AVAHI_GLIB_..." definitions.
Till Kamppeter [Fri, 23 Dec 2022 18:20:23 +0000 (15:20 -0300)] 
configure.ac: Remove unnecessary "AVAHI_GLIB_..." definitions.

2 years agoMakefile.am: Include NOTICE in distribution tarball
Till Kamppeter [Fri, 23 Dec 2022 18:19:21 +0000 (15:19 -0300)] 
Makefile.am: Include NOTICE in distribution tarball

2 years agoconfigure.ac: Added "foreign" to to AM_INIT_AUTOMAKE() call.
Till Kamppeter [Fri, 25 Nov 2022 14:58:04 +0000 (15:58 +0100)] 
configure.ac: Added "foreign" to to AM_INIT_AUTOMAKE() call.

Makes automake not require a file named README.

2 years agoCHANGES.md: Improved formatting, general fixes of content.
Till Kamppeter [Fri, 18 Nov 2022 12:12:04 +0000 (13:12 +0100)] 
CHANGES.md: Improved formatting, general fixes of content.

2 years agoREADME.md: Remove Braille embossing part.
Till Kamppeter [Fri, 18 Nov 2022 00:12:03 +0000 (01:12 +0100)] 
README.md: Remove Braille embossing part.

2 years agocups-filters 2.0b1 Release 2.0b1
Till Kamppeter [Fri, 18 Nov 2022 00:08:39 +0000 (01:08 +0100)] 
cups-filters 2.0b1 Release

2 years ago.gitignore: Updated to changed filter executable names
Till Kamppeter [Fri, 18 Nov 2022 00:07:13 +0000 (01:07 +0100)] 
.gitignore: Updated to changed filter executable names

    rastertopdf  -> pwgtopdf
    rastertopclm -> pwgtopclm

2 years agoRemoved everything which got split out
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.

2 years agoDEVELOPING.md, CONTRIBUTING.md: Include them in tarball and installation
Till Kamppeter [Mon, 14 Nov 2022 23:20:37 +0000 (00:20 +0100)] 
DEVELOPING.md, CONTRIBUTING.md: Include them in tarball and installation

Added the new files to Makefile.am so that "make dist" amd "make
install" include them.

2 years agoAdded DEVELOPING.md and CONTRIBUTING.md
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, ...

2 years agoCHANGES.md, README.md, INSTALL: Updated source package documentation
Till Kamppeter [Mon, 14 Nov 2022 21:00:03 +0000 (22:00 +0100)] 
CHANGES.md, README.md, INSTALL: Updated source package documentation

- 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.

2 years agoAUTHORS, COPYING, LICENSE, NOTICE: Switchover to Apache 2.0
Till Kamppeter [Fri, 11 Nov 2022 23:57:41 +0000 (00:57 +0100)] 
AUTHORS, COPYING, LICENSE, NOTICE: Switchover to Apache 2.0

Reflect the switchover to the Apache 2.0 license with CUPS extension
(same license as CUPS) in the appropriate files.

Also updated lists of copyright holders and authors.

2 years agoData files: Changed license info to Apache 2.0
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.

2 years agolibcupsfilters: Updated all licence headers to Apache 2.0
Till Kamppeter [Sun, 23 Oct 2022 23:23:24 +0000 (01:23 +0200)] 
libcupsfilters: Updated all licence headers to Apache 2.0

Now the license headers contains infor what the file contains,
copyright info and the license info.

The license is now the same as in CUPS:

    Licensed under Apache License v2.0.  See the file "LICENSE" for more
    information.

Added the header where it was missing. Also used a unique format for all
headers.

2 years agocups-browsed, driverless: Code clean-up for code of the utilities
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.

2 years agoCUPS backends: Code clean-up for code in backend/
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.

2 years agoCUPS filters: Code clean-up for code in filter/
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.

2 years agofoomatic-rip: Updated the license info of all source files
Till Kamppeter [Wed, 19 Oct 2022 22:06:58 +0000 (00:06 +0200)] 
foomatic-rip: Updated the license info of all source files

cups-filters will be put under the same license as CUPS. Updated the
source files of foomatic-rip appropriately.

2 years agolibppd: Code clean-up for code of foomatic-rip
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.

2 years agolibcupsfilters/libppd: More coding style clean-up ...
Till Kamppeter [Mon, 17 Oct 2022 17:29:10 +0000 (19:29 +0200)] 
libcupsfilters/libppd: More coding style clean-up ...

2 years agolibcupsfilters, README: 2.x requires Ghostscript 10.00.0
Till Kamppeter [Mon, 17 Oct 2022 10:57:39 +0000 (12:57 +0200)] 
libcupsfilters, README: 2.x requires Ghostscript 10.00.0

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

https://github.com/OpenPrinting/cups-filters/issues/484

Updated comments in cupsfilters/ghostscript.c and README
appropriately.

2 years agolibcupsfilters, libppd: cfFilterExternal() filter function
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.

2 years agolibcupsfilters: Added info about source of human-readable option strings
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.

2 years agolibppd: Code clean-up for code of libppd
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.

2 years agolibcupsfilters: Removed unused and forgotten header file
Till Kamppeter [Wed, 12 Oct 2022 11:51:35 +0000 (13:51 +0200)] 
libcupsfilters: Removed unused and forgotten header file

The content of filter/textcommon.h has been completely moved into
cupsfilters/texttopdf.c. therefore we remove the file now.

2 years agolibcupsfilters: Code clean-up for code of testpdf1 and testpdf2
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.

2 years agolibcupsfilters: Move test suite programs to cupsfilters/
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.

2 years agolibcupsfilters: Cleaned up coding style of test suite
Till Kamppeter [Tue, 11 Oct 2022 22:25:06 +0000 (00:25 +0200)] 
libcupsfilters: Cleaned up coding style of test suite

Cleaned up the coding style of the test programs run by "make check".

- Converted comments from "/* ... */" to "// ..."

- Suppressed warnings of unused return values of fgets() and fread(), via
  "fread(...);" -> "if (fread(...));"

2 years agolibcupsfilters: Renamed functions and types in fontembed code
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.

2 years agolibfontembed, libcupsfilters: Merge libfontembed into libcupsfilters
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.

2 years agolibfontembed: Code clean-up for code of libfontembed
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.

2 years agolibcupsfilters: Moved IPP-attribute-related functions to ipp.c
Till Kamppeter [Sat, 8 Oct 2022 06:34:42 +0000 (08:34 +0200)] 
libcupsfilters: Moved IPP-attribute-related functions to ipp.c

There were some non-Raster-related but IPP-attribute-related functions
in raster.c. With this commit they are moved to ipp.c now.

The functions are:

    - cfGetBackSideOrientation()
    - cfGetPrintRenderIntent()
    - cfJoinJobOptionsAndAttrs()

2 years agolibcupsfilters: Added RGBW support to cfFilterPCLmToRaster()
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.

2 years agolibcupsfilters: Code clean-up for code of libcupsfilters
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.

2 years agolibcupsfilters: Code clean-up for code of libcupsfilters
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.

2 years agolibcupsfilters: Removed portability implementationsn of functions
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.

2 years agoAdd FrequentNetifUpdate option/directive (#482)
zdohnal [Thu, 15 Sep 2022 14:14:29 +0000 (16:14 +0200)] 
Add FrequentNetifUpdate option/directive (#482)

2 years agolibcupsfilters: Code clean-up for code of cfFilterPDFToPDF()
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.

2 years agolibcupsfilters: Code clean-up for code of cfFilterPDFToPDF()
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.

2 years agoRemoved PHP and Perl APIs
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.

2 years agolibcupsfilters: Removed support for legacy image formats
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.

JPEG, PNG, and TIFF are still available.

2 years agolibcupsfilters: Update comments about filter functions in filter.h
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.

2 years agolibcupsfilters: Let cfFilterUniversal() not se unnecessary parameters
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.

2 years agolibcupsfilters: Do not feed CUPS Raster into cfFilterPWGToPDF()
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.

2 years agolibcupsfilters: Renamed cfFilterRasterToPDF() to cfFilterPWGToPDF()
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.

2 years agolibcupsfilters: In cfFilterPDFToRaster() Fixed margins of output pages
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.

2 years agolibcupsfilters: cfFilterUniversal() supports also Poppler's pdftops now
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.

2 years agoBuild system: Improvements for ./configure script
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.

2 years agolibppd: In ppdFilterUniversal() set output data type also if no PPD supplied
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.

2 years agolibppd: Improvements on ppdLoadAttributes() PPD-to-printer-IPP-attributes
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.

2 years agolibppd: Corrections for determining resolution in ppdFilterPDFToPS()
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").

2 years agolibcupsfilters: Declare raster_base_header() function static
Till Kamppeter [Sun, 28 Aug 2022 21:46:56 +0000 (23:46 +0200)] 
libcupsfilters: Declare raster_base_header() function static

raster_base_header() is only used inside the cupsfilters/raster.c file
and not intended to be an API function.

2 years agolibcupsfilters, universal: Impoert template dir for cfFilterBannerToPDF()
Till Kamppeter [Sun, 28 Aug 2022 16:36:10 +0000 (18:36 +0200)] 
libcupsfilters, universal: Impoert template dir for cfFilterBannerToPDF()

Fixes Issue #471.

The cfFilterUniversal() filter function did not import the template
directory which cfFilterBannerToPDF() needs as parameter.

2 years agolibppd: In ppdLoadAttributes() complete custom page size support
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.

2 years agolibcupsfilters: Compare case-insesitively in cfFilterUniversal()
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.

2 years agolibppd: In ppdFilterLoadPPD() let PDF filter log pages when output is PS
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.

2 years agolibppd: In ppdFilterLoadPPD() correct check for final output type
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.