Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] PPD option preset auto-generation for common job IPP attributes #236

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Commits on Sep 1, 2021

  1. PPD option preset auto-generation for common job IPP attributes

    To make the job IPP attributes "print-color-mode", "print-quality",
    and "print-content-optimize" actually doing "the right thing" for most
    printers we auto-generate PPD option presets now.
    
    CUPS already had the functionality to apply a preset of one or more
    PPD option settings for each of the 6 combinations of
    "print-color-mode" and "print-quality" settings for longer time but
    this was never actually being made use of as it required manually
    defining the presets via "APPrinterPreset" PPD attributes. This no one
    wants to do with the ~10000 PPDs which come with a typical Linux
    distribution nowadays. Even a user with his few print queues does not
    want to do it, know how to do it, or know that it is even possible.
    
    This commit makes this fully automatic on every PPD where the presets
    are not already manually defined via "APPrinterPreset" attributes.
    
    When creating the PPD cache for a queue's PPD file and the PPD is
    without manual presets, it calls the new function
    _ppdCacheAssignPresets() which analyses for each PPD option the names
    of the choices to find out which choices switch to manochrome or to
    color, lower or raise print quality, or improve text/graphics/photo
    printing and which are the moset suitable of them. It also analyses
    the PostScript/PJL code of the choices to find out whether it affects
    the printing resolution.
    
    With this it selects which options get into the the presets and with
    which choices.
    
    In addition to presets for the "print-color-mode"/"print-quality"
    combos presets for "print-content-optimize" are introduced.
    
    PPD Option settings added by preset are logged on job execution.
    tillkamppeter committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    3b07df3 View commit details
    Browse the repository at this point in the history
  2. Fixed bugs revealed by LGTM.com

    This especially revealed that on selecting the final setting for the
    color mode/quality presets only 2 of the intended 3 passes were done.
    tillkamppeter committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    14f3883 View commit details
    Browse the repository at this point in the history
  3. Replaced "str(n)casecmp()" by "_cups_str(n)casecmp() for portability

    Automatic Windows test build errored on that.
    tillkamppeter committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    a925de9 View commit details
    Browse the repository at this point in the history
  4. Introduced own implementation of strcasestr(), for build on Windows

    Windows does not have a strcasestr() so we have to provide our own
    implementation, as we already did with strcasecmp() and strncasecmp().
    tillkamppeter committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    d054b11 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2021

  1. PPD option preset auto-generator: Added some more option/choice names…

    … to check for
    
    Checking the PPD file for the HP LaserJet 4050 (PostScript) found more
    option/choice names of options which influence print quality:
    
      - Smoothing
      - Halftone
      - ProRes(600/1200/2400)
    
    Some other of HPLIP's PostScript PPDs use "HPPJLColorAsGray" with
    choices "yes" and "no" instead of ""HPColorAsGray" with "True" and
    "False".  libcupsfilters: More PPD preset rules, especially for HP
    
    Also analyse choice names for options which contain "Resolution" in
    their names.
    tillkamppeter committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    c5c278f View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2021

  1. PPD option mapping auto-generator: Consider "ColorMode" also with prefix

    This way we also cover "cupsColorMode" for example which appears in
    auto-generated PPDs for driverless IPP printers (in case we cannot
    print directly to the printer but only have access via a CUPS queue).
    
    Also updated a comment and a log message.
    tillkamppeter committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    36583f2 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2023

  1. Configuration menu
    Copy the full SHA
    2b4e2b9 View commit details
    Browse the repository at this point in the history
  2. Fix indentation

    tillkamppeter committed Sep 24, 2023
    Configuration menu
    Copy the full SHA
    b75275f View commit details
    Browse the repository at this point in the history
  3. _ppdCacheAssignPresets(): Added NULL checks for option choice propert…

    …ies record
    
    Static analysis of code, GitHub code scanning, found missing NULL
    checks for allocating memory for option choice properties records
    (gives NULL when out of memory) and for grabbing the records from a
    CUPS array (should now never happen as we now skip the option on the
    first memory allocation failure).
    
    Added appropriate NULL checks. Now in case of unsufficient memory the
    current option gets skipped on the first failed calloc() call.
    tillkamppeter committed Sep 24, 2023
    Configuration menu
    Copy the full SHA
    97e4485 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2023

  1. Content optimize "presets" -> Content optimize "mappings"

    Renamed the fields in _ppd_cache_s and updated the comments.
    tillkamppeter committed Sep 25, 2023
    Configuration menu
    Copy the full SHA
    adb8deb View commit details
    Browse the repository at this point in the history