]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/mark.c
Merge changes from CUPS 1.5svn-r9049 (private header support)
[thirdparty/cups.git] / cups / mark.c
index a9b5124e34a7809d4ad4cb8caeac024856ab6814..9ef999b7fa0879ae1929d48240d4652a27a0aa6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: mark.c 8210 2009-01-09 02:30:26Z mike $"
+ * "$Id: mark.c 9042 2010-03-24 00:45:34Z mike $"
  *
  *   Option marking routines for CUPS.
  *
  * Include necessary headers...
  */
 
-#include "cups.h"
-#include "string.h"
-#include "debug.h"
-#include "pwg-private.h"
+#include "cups-private.h"
 
 
 /*
@@ -1146,106 +1143,5 @@ ppd_mark_option(ppd_file_t *ppd,        /* I - PPD file */
 
 
 /*
- * 'ppd_mark_size()' - Quickly mark a page size without checking for conflicts.
- *
- * This function is also responsible for mapping PWG/ISO/IPP size names to the
- * PPD file...
- */
-
-static void
-ppd_mark_size(ppd_file_t *ppd,         /* I - PPD file */
-              const char *size)                /* I - Size name */
-{
-  int                  i;              /* Looping var */
-  _cups_pwg_media_t    *pwgmedia;      /* PWG media information */
-  ppd_size_t           *ppdsize;       /* Current PPD size */
-  double               dw, dl;         /* Difference in width and height */
-  double               width,          /* Width to find */
-                       length;         /* Length to find */
-  char                 width_str[256], /* Width in size name */
-                       length_str[256],/* Length in size name */
-                       units[256],     /* Units in size name */
-                       custom[256];    /* Custom size */
-  struct lconv         *loc;           /* Localization data */
-
-
- /*
-  * See if this is a PPD size...
-  */
-
-  if (!strncasecmp(size, "Custom.", 7) || ppdPageSize(ppd, size))
-  {
-    ppd_mark_option(ppd, "PageSize", size);
-    return;
-  }
-
- /*
-  * Nope, try looking up the PWG or legacy (IPP/ISO) size name...
-  */
-
-  if ((pwgmedia = _cupsPWGMediaByName(size)) == NULL)
-    pwgmedia = _cupsPWGMediaByLegacy(size);
-
-  if (pwgmedia)
-  {
-    width  = pwgmedia->width;
-    length = pwgmedia->length;
-  }
-  else if (sscanf(size, "%*[^_]_%*[^_]_%255[0-9.]x%255[0-9.]%s", width_str,
-                  length_str, units) == 3)
-  {
-   /*
-    * Got a "self-describing" name that isn't in our table...
-    */
-
-    loc    = localeconv();
-    width  = _cupsStrScand(width_str, NULL, loc);
-    length = _cupsStrScand(length_str, NULL, loc);
-
-    if (!strcmp(units, "in"))
-    {
-      width  *= 72.0;
-      length *= 72.0;
-    }
-    else if (!strcmp(units, "mm"))
-    {
-      width  *= 25.4 / 72.0;
-      length *= 25.4 / 72.0;
-    }
-    else
-      return;
-  }
-  else
-    return;
-
- /*
-  * Search the PPD file for a matching size...
-  */
-
-  for (i = ppd->num_sizes, ppdsize = ppd->sizes; i > 0; i --, ppdsize ++)
-  {
-    dw = ppdsize->width - width;
-    dl = ppdsize->length - length;
-
-    if (dw > -5.0 && dw < 5.0 && dl > -5.0 && dl < 5.0)
-    {
-      ppd_mark_option(ppd, "PageSize", ppdsize->name);
-      return;
-    }
-  }
-
- /*
-  * No match found; if custom sizes are supported, set a custom size...
-  */
-
-  if (ppd->variable_sizes)
-  {
-    snprintf(custom, sizeof(custom), "Custom.%dx%d", (int)width, (int)length);
-    ppd_mark_option(ppd, "PageSize", custom);
-  }
-}
-
-
-/*
- * End of "$Id: mark.c 8210 2009-01-09 02:30:26Z mike $".
+ * End of "$Id: mark.c 9042 2010-03-24 00:45:34Z mike $".
  */