ipp_t *response) /* I - Get-Printer-Attributes response */
{
cups_file_t *fp; /* PPD file */
+ cups_array_t *sizes; /* Media sizes we've added */
ipp_attribute_t *attr, /* xxx-supported */
*defattr, /* xxx-default */
*x_dim, *y_dim; /* Media dimensions */
cupsFilePrintf(fp, "*OpenUI *PageSize: PickOne\n"
"*OrderDependency: 10 AnySetup *PageSize\n"
"*DefaultPageSize: %s\n", ppdname);
+
+ sizes = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
+
for (i = 0, count = ippGetCount(attr); i < count; i ++)
{
if (ippGetValueTag(attr) == IPP_TAG_BEGIN_COLLECTION)
char twidth[256], /* Width string */
tlength[256]; /* Length string */
+ if (cupsArrayFind(sizes, (void *)pwg->ppd))
+ {
+ cupsFilePrintf(fp, "*%% warning: Duplicate size '%s' reported by printer.\n", pwg->ppd);
+ continue;
+ }
+
+ cupsArrayAdd(sizes, (void *)pwg->ppd);
+
_cupsStrFormatd(twidth, twidth + sizeof(twidth), pwg->width * 72.0 / 2540.0, loc);
_cupsStrFormatd(tlength, tlength + sizeof(tlength), pwg->length * 72.0 / 2540.0, loc);
}
cupsFilePuts(fp, "*CloseUI: *PageSize\n");
+ cupsArrayDelete(sizes);
+ sizes = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
+
cupsFilePrintf(fp, "*OpenUI *PageRegion: PickOne\n"
"*OrderDependency: 10 AnySetup *PageRegion\n"
"*DefaultPageRegion: %s\n", ppdname);
char twidth[256], /* Width string */
tlength[256]; /* Length string */
+ if (cupsArrayFind(sizes, (void *)pwg->ppd))
+ continue;
+
+ cupsArrayAdd(sizes, (void *)pwg->ppd);
+
_cupsStrFormatd(twidth, twidth + sizeof(twidth), pwg->width * 72.0 / 2540.0, loc);
_cupsStrFormatd(tlength, tlength + sizeof(tlength), pwg->length * 72.0 / 2540.0, loc);
}
cupsFilePuts(fp, "*CloseUI: *PageRegion\n");
+ cupsArrayDelete(sizes);
+ sizes = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
+
cupsFilePrintf(fp, "*DefaultImageableArea: %s\n"
"*DefaultPaperDimension: %s\n", ppdname, ppdname);
for (i = 0, count = ippGetCount(attr); i < count; i ++)
twidth[256], /* Width string */
tlength[256]; /* Length string */
+ if (cupsArrayFind(sizes, (void *)pwg->ppd))
+ continue;
+
+ cupsArrayAdd(sizes, (void *)pwg->ppd);
+
_cupsStrFormatd(tleft, tleft + sizeof(tleft), left * 72.0 / 2540.0, loc);
_cupsStrFormatd(tbottom, tbottom + sizeof(tbottom), bottom * 72.0 / 2540.0, loc);
_cupsStrFormatd(tright, tright + sizeof(tright), (pwg->width - right) * 72.0 / 2540.0, loc);
cupsFilePrintf(fp, "*PaperDimension %s: \"%s %s\"\n", pwg->ppd, twidth, tlength);
}
}
+
+ cupsArrayDelete(sizes);
}
else
goto bad_ppd;
_PWG_MEDIA_IN("oe_photo-l_3.5x5in", NULL, "3.5x5", 3.5, 5),
/* Other Metric Standard Sheet Media Sizes */
- _PWG_MEDIA_MM("om_small-photo_100x150mm", NULL, "om_small-photo", 100, 150),
+ _PWG_MEDIA_MM("om_small-photo_100x150mm", NULL, "100x150mm", 100, 150),
_PWG_MEDIA_MM("om_italian_110x230mm", NULL, "EnvItalian", 110, 230),
- _PWG_MEDIA_MM("om_large-photo_200x300", NULL, "om_large-photo", 200, 300),
+ _PWG_MEDIA_MM("om_large-photo_200x300", NULL, "200x300mm", 200, 300),
_PWG_MEDIA_MM("om_folio_210x330mm", "folio", "Folio", 210, 330),
_PWG_MEDIA_MM("om_folio-sp_215x315mm", NULL, "FolioSP", 215, 315),
_PWG_MEDIA_MM("om_invite_220x220mm", NULL, "EnvInvite", 220, 220),
- _PWG_MEDIA_MM("om_small-photo_100x200mm", NULL, "om_wide-photo", 100, 200),
+ _PWG_MEDIA_MM("om_small-photo_100x200mm", NULL, "100x200mm", 100, 200),
/* Disc Sizes */
_PWG_MEDIA_MM("disc_standard_40x118mm", NULL, "Disc", 118, 118)