]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Update MediaType code to list all media-type-supported values, regardless of
authorMichael Sweet <michael.r.sweet@gmail.com>
Thu, 9 Mar 2017 20:04:39 +0000 (15:04 -0500)
committerMichael Sweet <michael.r.sweet@gmail.com>
Thu, 9 Mar 2017 20:04:39 +0000 (15:04 -0500)
whether they are standard names (Issue #4953)

Also add HP mis-spelling of 'photographic' ('photo').

CHANGES.txt
cups/ppd-cache.c

index db5f39574f12704bb450856511423c6b82b9c313..19500ba4464aef24774adda38ac372fba9302eb2 100644 (file)
@@ -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>)
 
 
index d14bc25ca87830042f7ffa6c6f1e1b9bd7d7f8da..0ec877451cbba660469b20d164d51ded4c75d2ae 100644 (file)
@@ -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") },
@@ -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");
   }