diff options
author | Michael Sweet <michael.r.sweet@gmail.com> | 2017-11-30 11:38:54 -0500 |
---|---|---|
committer | Michael Sweet <michael.r.sweet@gmail.com> | 2017-11-30 11:38:54 -0500 |
commit | 84de5e9234e078e149a982848bf49ed4a8e83bd1 (patch) | |
tree | 41ac2b1d906ea0e266ad0683d419e91bea9bb9db /cups/pwg-media.c | |
parent | 63b75fbef93c854583d3cb22b951f12ecb75efa3 (diff) | |
download | cups-84de5e9234e078e149a982848bf49ed4a8e83bd1.tar.gz |
Last of the media improvements (Issue #5167)
cups/dest-localization.c:
- Use "other tray" and "other media" for unknown media sources and types.
cups/dest-options.c:
- media-key is king for size matching.
- Synthesize a media-key value using the size name unless we can't get one.
cups/language-private.h:
- Add _CUPS_MESSAGE_PO constant.
cups/pwg-media.c:
- Allow PWG names with a trailing "_foo" qualifier (so media-key still works
if an application just adds the _cups_size_t.media value as the "media"
option.
locale/*.{po,pot,strings}:
- Update localization strings.
locale/cups.footer:
- Add common HP and Canon media types.
locale/checkpo.c:
- Fix \ validation.
Diffstat (limited to 'cups/pwg-media.c')
-rw-r--r-- | cups/pwg-media.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cups/pwg-media.c b/cups/pwg-media.c index 26fc78d8f..61671efe8 100644 --- a/cups/pwg-media.c +++ b/cups/pwg-media.c @@ -838,18 +838,22 @@ pwgMediaForPWG(const char *pwg) /* I - PWG size name */ /* * Try decoding the self-describing name of the form: * - * class_name_WWWxHHHin - * class_name_WWWxHHHmm + * class_name_WWWxHHHin[_something] + * class_name_WWWxHHHmm[_something] */ int w, l; /* Width and length of page */ int numer; /* Scale factor for units */ - const char *units = ptr + strlen(ptr) - 2; - /* Units from size */ + const char *units; /* Units from size */ - ptr ++; + if ((units = strchr(ptr + 1, '_')) != NULL) + units -= 2; + else + units = ptr + strlen(ptr) - 2; - if (units >= ptr && !strcmp(units, "in")) + ptr ++; + + if (units >= ptr && (!strcmp(units, "in") || !strncmp(units, "in_", 3))) numer = 2540; else numer = 100; |