Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions ppd/ppd-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,10 +949,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer
cfFreeResolution(current_def, NULL);
}
current_def = NULL;
// Checking if there is printer-default-resolution and this
// resolution is in the list, use it. If not, use the
// middpi, rounding down if the number of available
// resolutions is even.
// Use the middpi as the default, rounding down if the number
// of available resolutions is even.
if ((attr = ippFindAttribute(supported,
"printer-resolution-supported",
IPP_TAG_RESOLUTION)) != NULL)
Expand All @@ -961,19 +959,9 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer
"printer-resolution-default",
IPP_TAG_RESOLUTION)) != NULL)
{
current_def = cfIPPResToResolution(defattr, 0);
for (int j = 0; j < resStore; j ++)
{
if (current_def == cfNewResolution(resArray[i], resArray[i]))
{
current_def = cfIPPResToResolution(defattr, 0);
break;
}
else
{
current_def = cfNewResolution(middpi, middpi);
}
}
// printer-resolution-default describes the print engine, not
// the raster data we send, so it isn't used as the default here
current_def = cfNewResolution(middpi, middpi);
}
}
if (cupsArrayGetCount(current_res) > 0 &&
Expand Down
27 changes: 27 additions & 0 deletions ppd/test_ppd_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,33 @@ main(void)
free(ppd_text);
ippDelete(resp);

// T32b — URF printer: printer-resolution-default is about the print engine,
// so the default for the raster data stays the middle resolution.
#ifdef CUPS_RASTER_HAVE_APPLERASTER
{
static const char * const urf[] = { "V1.4", "W8", "RS300-600-1200" };
static const int dpi[] = { 300, 600, 1200 };

testBegin("URF printer-resolution-default 1200dpi → *DefaultResolution: 600dpi");
resp = ippNew();
add_format(resp, "image/urf");
ippAddStrings(resp, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "urf-supported",
3, NULL, urf);
ippAddResolutions(resp, IPP_TAG_PRINTER, "printer-resolution-supported",
3, IPP_RES_PER_INCH, dpi, dpi);
ippAddResolution(resp, IPP_TAG_PRINTER, "printer-resolution-default",
IPP_RES_PER_INCH, 1200, 1200);
result = ppdCreatePPDFromIPP2(buffer, sizeof(buffer), resp,
"Test", "image/urf",
0, 0, NULL, NULL, NULL, NULL, NULL, 0);
ppd_text = result ? slurp_file(buffer) : NULL;
testEnd(ppd_text && strstr(ppd_text, "*DefaultResolution: 600dpi"));
if (result == buffer) unlink(buffer);
free(ppd_text);
ippDelete(resp);
}
#endif // CUPS_RASTER_HAVE_APPLERASTER

// T33 — Asymmetric resolution 600x1200 → "*DefaultResolution: 600x1200dpi"
// form at line 2413 (else branch).
testBegin("printer-resolution-default 600x1200 → \"600x1200dpi\"");
Expand Down
Loading