Skip to content

Commit

Permalink
Further fixes in handling resolutions
Browse files Browse the repository at this point in the history
- cfRasterPrepareHeader(): When taking default resolution from
  "urf-supported" printer IPP attribute, use first value (lowest) of
  the list, to match the ppdLoadAttributes() function of libppd.

- raster_base_header(): If no resolution is specified as job IPP
  attribute or in the options list, use the default resolution from
  the printer IPP attributes.
  • Loading branch information
tillkamppeter committed Jun 19, 2023
1 parent 9687ebf commit 545a049
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cupsfilters/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ cfIPPAttrResolutionForPrinter(ipp_t *printer_attrs,// I - Printer attributes
attr_name = "printer-resolution";

// Check whether job got supplied the named attribute and read out its value
// as integer
// as resolution
if (job_attrs == NULL ||
(attr = ippFindAttribute(job_attrs, attr_name, IPP_TAG_ZERO)) == NULL)
retval = 0;
Expand Down
17 changes: 6 additions & 11 deletions cupsfilters/raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,10 @@ cfRasterPrepareHeader(cups_page_header2_t *h, // I - Raster header
const char *p = ippGetString(attr, i, NULL);
if (strncasecmp(p, "RS", 2))
continue;
int lo; int hi;
lo = atoi(p + 2);
if (lo == 0)
lo = -1;
p = strchr(p, '-');
if (p)
hi = atoi(p + 1);
else
hi = lo;
xres = hi;
yres = hi;
int res;
res = atoi(p + 2);
if (res > 0)
xres = yres = res;
}
}
}
Expand Down Expand Up @@ -1074,6 +1067,8 @@ raster_base_header(cups_page_header2_t *h, // O - Raster header
cfIPPAttrResolutionForPrinter(data->printer_attrs, attrs, NULL, &x, &y);
ippDelete(attrs);
}
else
cfIPPAttrResolutionForPrinter(data->printer_attrs, NULL, NULL, &x, &y);
if (x && y)
{
h->HWResolution[0] = x;
Expand Down

0 comments on commit 545a049

Please sign in to comment.