Skip to content

Commit

Permalink
Update MediaType code to list all media-type-supported values, regard…
Browse files Browse the repository at this point in the history
…less of

whether they are standard names (Issue #4953)

Also add HP mis-spelling of 'photographic' ('photo').
  • Loading branch information
michaelrsweet committed Mar 9, 2017
1 parent 3b6c3c8 commit 3ae6282
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CHANGES IN CUPS V2.2.3
or type (Issue #4963)
- IPP Everywhere print queues did not always support all print qualities
supported by the printer (Issue #4953)
- IPP Everywhere print queues did not always support all media types
supported by the printer (Issue #4953)
- Fixed some localization issues on macOS (<rdar://problem/27245567>)


Expand Down
17 changes: 12 additions & 5 deletions cups/ppd-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -3595,6 +3595,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
{ "multi-part-form", _("Multi Part Form") },
{ "other", _("Other") },
{ "paper", _("Paper") },
{ "photo", _("Photo Paper") }, /* HP mis-spelling */
{ "photographic", _("Photo Paper") },
{ "photographic-archival", _("Photographic Archival") },
{ "photographic-film", _("Photo Film") },
Expand Down Expand Up @@ -3646,14 +3647,20 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
cupsFilePrintf(fp, "*OpenUI *MediaType: PickOne\n"
"*OrderDependency: 10 AnySetup *MediaType\n"
"*DefaultMediaType: %s\n", ppdname);
for (i = 0; i < (int)(sizeof(media_types) / sizeof(media_types[0])); i ++)
for (i = 0; i < count; i ++)
{
if (!ippContainsString(attr, media_types[i][0]))
continue;
const char *keyword = ippGetString(attr, i, NULL);

pwg_ppdize_name(media_types[i][0], ppdname, sizeof(ppdname));
pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));

cupsFilePrintf(fp, "*MediaType %s/%s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, _cupsLangString(lang, media_types[i][1]), ppdname);
for (j = 0; j < (int)(sizeof(media_types) / sizeof(media_types[0])); j ++)
if (!strcmp(keyword, media_types[i][0]))
break;

if (j < (int)(sizeof(media_types) / sizeof(media_types[0])))
cupsFilePrintf(fp, "*MediaType %s/%s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, _cupsLangString(lang, media_types[j][1]), ppdname);
else
cupsFilePrintf(fp, "*MediaType %s/%s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, keyword, ppdname);
}
cupsFilePuts(fp, "*CloseUI: *MediaType\n");
}
Expand Down

0 comments on commit 3ae6282

Please sign in to comment.