From 816b3bfd42d7433a9c44326e44d8bb8e6829e0ed Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 21 Feb 2019 12:46:09 -0500 Subject: [PATCH] Media size matching now uses a tolerance of 0.5mm (rdar://33822024) --- CHANGES.md | 1 + cups/pwg-media.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7a9c1350e..234dc5a9c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,7 @@ Changes in CUPS v2.2.11 - Added a USB quirks rule for Xerox printers (Issue #5523) - The scheduler's self-signed certificate did not include all of the alternate names for the server when using GNU TLS (Issue #5525) +- 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) diff --git a/cups/pwg-media.c b/cups/pwg-media.c index 62455ea6d..0c6e44bc3 100644 --- a/cups/pwg-media.c +++ b/cups/pwg-media.c @@ -1,7 +1,7 @@ /* * PWG media name API implementation for CUPS. * - * Copyright 2009-2017 by Apple Inc. + * Copyright 2009-2019 by Apple Inc. * * These coded instructions, statements, and computer programs are the * property of Apple Inc. and are protected by Federal copyright @@ -26,6 +26,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 */ /* @@ -912,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)); } -- 2.39.2