]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Media size matching now uses a tolerance of 0.5mm (rdar://33822024)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 21 Feb 2019 17:45:33 +0000 (12:45 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 21 Feb 2019 17:45:33 +0000 (12:45 -0500)
CHANGES.md
cups/pwg-media.c

index 020e4de4f36598384945b62497d9b9307110f688..3871ee38a7d690e9a56e3f9dfbbfd357eb683f71 100644 (file)
@@ -5,6 +5,7 @@ CHANGES - 2.3b8 - 2019-02-21
 Changes in CUPS v2.3b8
 ----------------------
 
+- Media size matching now uses a tolerance of 0.5mm (rdar://33822024)
 - The lpadmin command would hang with a bad PPD file (rdar://41495016)
 - Fixed a potential crash bug in cups-driverd (rdar://46625579)
 - Fixed a performance regression with large PPDs (rdar://47040759)
index 079faaa0fa2449ef6a7b878377de5cc3717829c0..00bb2ed61a89d79c8f6346b1ed5a225d1067b50c 100644 (file)
@@ -1,9 +1,10 @@
 /*
  * PWG media name API implementation for CUPS.
  *
- * Copyright 2009-2017 by Apple Inc.
+ * Copyright 2009-2019 by Apple Inc.
  *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 /*
@@ -21,6 +22,7 @@
 
 #define _PWG_MEDIA_IN(p,l,a,x,y) {p, l, a, (int)(x * 2540), (int)(y * 2540)}
 #define _PWG_MEDIA_MM(p,l,a,x,y) {p, l, a, (int)(x * 100), (int)(y * 100)}
+#define _PWG_EPSILON   50              /* Matching tolerance */
 
 
 /*
@@ -911,10 +913,11 @@ pwgMediaForSize(int width,                /* I - Width in hundredths of millimeters */
 {
  /*
   * Adobe uses a size matching algorithm with an epsilon of 5 points, which
-  * is just about 176/2540ths...
+  * is just about 176/2540ths...  But a lot of international media sizes are
+  * very close so use 0.5mm (50/2540ths) as the maximum delta.
   */
 
-  return (_pwgMediaNearSize(width, length, 176));
+  return (_pwgMediaNearSize(width, length, _PWG_EPSILON));
 }