]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/texttops.c
Merge changes from CUPS 1.5svn-r9400
[thirdparty/cups.git] / filter / texttops.c
index 6bb21010755b80d5c3b6e4bdf00c14fa085a8963..af549cefa92f9404d6d36c7298d8d0ca04836287 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * "$Id: texttops.c 7720 2008-07-11 22:46:21Z mike $"
  *
- *   Text to PostScript filter for the Common UNIX Printing System (CUPS).
+ *   Text to PostScript filter for CUPS.
  *
- *   Copyright 2007-2008 by Apple Inc.
+ *   Copyright 2007-2010 by Apple Inc.
  *   Copyright 1993-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -29,7 +29,7 @@
  */
 
 #include "textcommon.h"
-#include <cups/i18n.h>
+#include <cups/language-private.h>
 
 
 /*
@@ -176,13 +176,28 @@ WriteProlog(const char *title,            /* I - Title of job */
   if (SizeColumns <= 0 || SizeColumns > 32767 ||
       SizeLines <= 0 || SizeLines > 32767)
   {
-    _cupsLangPrintf(stderr, _("ERROR: Unable to print %dx%d text page\n"),
-                    SizeColumns, SizeLines);
+    _cupsLangPrintFilter(stderr, "ERROR",
+                         _("Unable to print %dx%d text page."),
+                         SizeColumns, SizeLines);
+    exit(1);
+  }
+
+  if ((Page = calloc(sizeof(lchar_t *), SizeLines)) == NULL)
+  {
+    _cupsLangPrintFilter(stderr, "ERROR",
+                         _("Unable to print %dx%d text page."),
+                         SizeColumns, SizeLines);
+    exit(1);
+  }
+
+  if ((Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines)) == NULL)
+  {
+    _cupsLangPrintFilter(stderr, "ERROR",
+                         _("Unable to print %dx%d text page."),
+                         SizeColumns, SizeLines);
     exit(1);
   }
 
-  Page    = calloc(sizeof(lchar_t *), SizeLines);
-  Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines);
   for (i = 1; i < SizeLines; i ++)
     Page[i] = Page[0] + i * SizeColumns;
 
@@ -197,8 +212,8 @@ WriteProlog(const char *title,              /* I - Title of job */
 
   if (ColumnWidth <= 0)
   {
-    _cupsLangPrintf(stderr, _("ERROR: Unable to print %d text columns\n"),
-                    PageColumns);
+    _cupsLangPrintFilter(stderr, "ERROR",
+                         _("Unable to print %d text columns."), PageColumns);
     exit(1);
   }
 
@@ -245,8 +260,7 @@ WriteProlog(const char *title,              /* I - Title of job */
   }
   else
   {
-    fprintf(stderr, _("ERROR: Unable to open \"%s\" - %s\n"), filename,
-            strerror(errno));
+    _cupsLangPrintError("ERROR", _("Unable to open psglyphs"));
     exit(1);
   }
 
@@ -265,8 +279,7 @@ WriteProlog(const char *title,              /* I - Title of job */
       * Can't open charset file!
       */
 
-      fprintf(stderr, _("ERROR: Unable to open %s: %s\n"), filename,
-              strerror(errno));
+      _cupsLangPrintError("ERROR", _("Unable to open charset file"));
       exit(1);
     }
 
@@ -281,7 +294,8 @@ WriteProlog(const char *title,              /* I - Title of job */
       */
 
       fclose(fp);
-      fprintf(stderr, _("ERROR: Bad charset file %s\n"), filename);
+      _cupsLangPrintFilter(stderr, "ERROR", _("Bad charset file \"%s\"."),
+                           filename);
       exit(1);
     }
 
@@ -292,7 +306,8 @@ WriteProlog(const char *title,              /* I - Title of job */
       */
 
       fclose(fp);
-      fprintf(stderr, _("ERROR: Bad charset file %s\n"), filename);
+      _cupsLangPrintFilter(stderr, "ERROR", _("Bad charset file \"%s\"."),
+                           filename);
       exit(1);
     }
 
@@ -345,7 +360,8 @@ WriteProlog(const char *title,              /* I - Title of job */
          * Can't have a font without all required values...
          */
 
-         fprintf(stderr, _("ERROR: Bad font description line: %s\n"), valptr);
+         _cupsLangPrintFilter(stderr, "ERROR",
+                              _("Bad font description line: %s"), valptr);
          fclose(fp);
          exit(1);
        }
@@ -358,7 +374,8 @@ WriteProlog(const char *title,              /* I - Title of job */
          Directions[NumFonts] = -1;
        else
        {
-         fprintf(stderr, _("ERROR: Bad text direction %s\n"), valptr);
+         _cupsLangPrintFilter(stderr, "ERROR", _("Bad text direction: %s"),
+                              valptr);
          fclose(fp);
          exit(1);
        }
@@ -381,7 +398,8 @@ WriteProlog(const char *title,              /* I - Title of job */
          * Can't have a font without all required values...
          */
 
-         fprintf(stderr, _("ERROR: Bad font description line: %s\n"), valptr);
+         _cupsLangPrintFilter(stderr, "ERROR",
+                              _("Bad font description line: %s"), valptr);
          fclose(fp);
          exit(1);
        }
@@ -394,7 +412,8 @@ WriteProlog(const char *title,              /* I - Title of job */
           Widths[NumFonts] = 2;
        else 
        {
-         fprintf(stderr, _("ERROR: Bad text width %s\n"), valptr);
+         _cupsLangPrintFilter(stderr, "ERROR",
+                              _("Bad text width: %s"), valptr);
          fclose(fp);
          exit(1);
        }
@@ -450,7 +469,7 @@ WriteProlog(const char *title,              /* I - Title of job */
     }
     else
     {
-      fprintf(stderr, _("ERROR: Bad charset type %s\n"), lineptr);
+      _cupsLangPrintFilter(stderr, "ERROR", _("Bad charset type: %s"), lineptr);
       fclose(fp);
       exit(1);
     }