/*
- * "$Id$"
- *
* PWG media name API implementation for CUPS.
*
- * Copyright 2009-2014 by Apple Inc.
+ * Copyright 2009-2016 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
_PWG_MEDIA_MM("om_folio_210x330mm", "folio", "Folio", 210, 330),
_PWG_MEDIA_MM("om_folio-sp_215x315mm", NULL, "FolioSP", 215, 315),
_PWG_MEDIA_MM("om_invite_220x220mm", NULL, "EnvInvite", 220, 220),
- _PWG_MEDIA_MM("om_small-photo_100x200mm", NULL, "om_wide-photo", 100, 200)
+ _PWG_MEDIA_MM("om_small-photo_100x200mm", NULL, "om_wide-photo", 100, 200),
+
+ /* Disc Sizes */
+ _PWG_MEDIA_MM("disc_standard_40x118mm", NULL, NULL, 118, 118)
};
* units string is @code NULL@, otherwise inches ("in") or millimeters ("mm")
* are used.
*
- * @since CUPS 1.7/OS X 10.9@
+ * @since CUPS 1.7/macOS 10.9@
*/
int /* O - 1 on success, 0 on failure */
* Range check input...
*/
- DEBUG_printf(("pwgFormatSize(keyword=%p, keysize=" CUPS_LLFMT
- ", prefix=\"%s\", name=\"%s\", width=%d, length=%d, "
- "units=\"%s\")", keyword, CUPS_LLCAST keysize, prefix, name,
- width, length, units));
+ DEBUG_printf(("pwgFormatSize(keyword=%p, keysize=" CUPS_LLFMT ", prefix=\"%s\", name=\"%s\", width=%d, length=%d, units=\"%s\")", (void *)keyword, CUPS_LLCAST keysize, prefix, name, width, length, units));
if (keyword)
*keyword = '\0';
else
name = usize;
+ if (prefix && !strcmp(prefix, "disc"))
+ width = 4000; /* Disc sizes use hardcoded 40mm inner diameter */
if (!units)
{
return (1);
}
-/* For OS X 10.8 and earlier... */
+/* For macOS 10.8 and earlier... */
void _pwgGenerateSize(char *keyword, size_t keysize, const char *prefix,
const char *name, int width, int length)
{ pwgFormatSizeName(keyword, keysize, prefix, name, width, length, NULL); }
* member attribute was specified in the "media-col" Job Template attribute,
* otherwise it is initialized to 0.
*
- * @since CUPS 1.7/OS X 10.9@
+ * @since CUPS 1.7/macOS 10.9@
*/
int /* O - 1 if size was initialized, 0 otherwise */
return (1);
}
-/* For OS X 10.8 and earlier */
+/* For macOS 10.8 and earlier */
int _pwgInitSize(pwg_size_t *size, ipp_t *job, int *margins_set)
{ return (pwgInitSize(size, job, margins_set)); }
* The "name" argument specifies the legacy ISO media size name, for example
* "iso-a4" or "na-letter".
*
- * @since CUPS 1.7/OS X 10.9@
+ * @since CUPS 1.7/macOS 10.9@
*/
pwg_media_t * /* O - Matching size or NULL */
return ((pwg_media_t *)cupsArrayFind(cg->leg_size_lut, &key));
}
-/* For OS X 10.8 and earlier */
-pwg_media_t *_pwgMediaForLegacy(const char *legacy)
-{ return (pwgMediaForLegacy(legacy)); }
-
/*
* 'pwgMediaForPPD()' - Find a PWG media size by Adobe PPD name.
* thread. Custom names can be of the form "Custom.WIDTHxLENGTH[units]" or
* "WIDTHxLENGTH[units]".
*
- * @since CUPS 1.7/OS X 10.9@
+ * @since CUPS 1.7/macOS 10.9@
*/
pwg_media_t * /* O - Matching size or NULL */
return (size);
}
-/* For OS X 10.8 and earlier */
-pwg_media_t *_pwgMediaForPPD(const char *ppd)
-{ return (pwgMediaForPPD(ppd)); }
-
/*
* 'pwgMediaForPWG()' - Find a PWG media size by 5101.1 self-describing name.
* thread-local storage and is overwritten by each call to the function in the
* thread.
*
- * @since CUPS 1.7/OS X 10.9@
+ * @since CUPS 1.7/macOS 10.9@
*/
pwg_media_t * /* O - Matching size or NULL */
if (ptr)
{
+ if (!strncmp(pwg, "disc_", 5))
+ w = l; /* Make the media size OUTERxOUTER */
+
size = &(cg->pwg_media);
size->width = w;
size->length = l;
return (size);
}
-/* For OS X 10.8 and earlier */
-pwg_media_t *_pwgMediaForPWG(const char *pwg)
-{ return (pwgMediaForPWG(pwg)); }
-
/*
* 'pwgMediaForSize()' - Get the PWG media size for the given dimensions.
* thread-local storage and is overwritten by each call to the function in the
* thread.
*
- * @since CUPS 1.7/OS X 10.9@
+ * @since CUPS 1.7/macOS 10.9@
*/
pwg_media_t * /* O - PWG media name */
pwgMediaForSize(int width, /* I - Width in hundredths of millimeters */
int length) /* I - Length in hundredths of millimeters */
{
- /*
- * Adobe uses a size matching algorithm with an epsilon of 5 points, which
- * is just about 176/2540ths...
- */
- return _pwgMediaNearSize(width, length, 176);
+ /*
+ * Adobe uses a size matching algorithm with an epsilon of 5 points, which
+ * is just about 176/2540ths...
+ */
+
+ return (_pwgMediaNearSize(width, length, 176));
}
+
+/*
+ * '_pwgMediaNearSize()' - Get the PWG media size within the given tolerance.
+ */
+
pwg_media_t * /* O - PWG media name */
_pwgMediaNearSize(int width, /* I - Width in hundredths of millimeters */
- int length, /* I - Length in hundredths of millimeters */
- int epsilon) /* I - Match within this tolernace. PWG units */
+ int length, /* I - Length in hundredths of millimeters */
+ int epsilon) /* I - Match within this tolernace. PWG units */
{
int i; /* Looping var */
pwg_media_t *media, /* Current media */
return (&(cg->pwg_media));
}
-/* For OS X 10.8 and earlier */
-pwg_media_t *_pwgMediaForSize(int width, int length)
-{ return (pwgMediaForSize(width, length)); }
-
/*
* '_pwgMediaTable()' - Return the internal media size table.
return (value * numer / denom + fractional * numer / denom / divisor);
}
-
-
-/*
- * End of "$Id$".
- */