From: Frank Noack <[EMAIL PROTECTED]>
   Date: Sun, 14 Mar 2004 08:40:22 +0100

   I have any trouble with printing the new gimp2.0(pre4). It works fine if i use 
   LANG=en. But if i use [EMAIL PROTECTED] i cant print with using the ppd file. 
   If i dont use the ppd file it works. I use 
   Suse 8.2 with recompiled ghostcript 7.07.1rc1 and gimpprint 4.2.6
   gimp 2.0pre4
   Cups with Turboprint
   The gimp developer says they will release in the next time the gimp 2.0rc but 
   its not good if the printing not works. If i read the release note from 
   gimp-print all says we only support gimp 1.2 not higher. When you supports 
   gimp 1.3 or 2.0?

Please try this patch to src/main/print-ps.c.  It resets the locale
around all potentially risky operations, although it may turn out to
be too big of a hammer.  We had to do something similar to the IJS
driver.

We'll need to do something similar in the 5.0 line.

Index: print-ps.c
===================================================================
RCS file: /cvsroot/gimp-print/print/src/main/print-ps.c,v
retrieving revision 1.26.2.5
diff -u -r1.26.2.5 print-ps.c
--- print-ps.c  30 Apr 2003 00:21:55 -0000      1.26.2.5
+++ print-ps.c  14 Mar 2004 15:42:05 -0000
@@ -72,10 +72,10 @@
  */
 
 static stp_param_t *                           /* O - Parameter values */
-ps_parameters(const stp_printer_t printer,     /* I - Printer model */
-              const char *ppd_file,            /* I - PPD file (not used) */
-              const char *name,                /* I - Name of parameter */
-              int  *count)             /* O - Number of values */
+ps_parameters_internal(const stp_printer_t printer,    /* I - Printer model */
+                      const char *ppd_file,    /* I - PPD file (not used) */
+                      const char *name,        /* I - Name of parameter */
+                      int  *count)             /* O - Number of values */
 {
   int          i;
   char         line[1024],
@@ -165,10 +165,23 @@
     return (valptrs);
 }
 
+static stp_param_t *                           /* O - Parameter values */
+ps_parameters(const stp_printer_t printer,     /* I - Printer model */
+              const char *ppd_file,            /* I - PPD file (not used) */
+              const char *name,                /* I - Name of parameter */
+              int  *count)             /* O - Number of values */
+{
+  stp_param_t *answer;
+  setlocale(LC_ALL, "C");
+  answer = ps_parameters_internal(printer, ppd_file, name, count);
+  setlocale(LC_ALL, "");
+  return answer;
+}
+
 static const char *
-ps_default_parameters(const stp_printer_t printer,
-                     const char *ppd_file,
-                     const char *name)
+ps_default_parameters_internal(const stp_printer_t printer,
+                              const char *ppd_file,
+                              const char *name)
 {
   int          i;
   char         line[1024],
@@ -237,16 +250,27 @@
   return NULL;
 }
 
+static const char *
+ps_default_parameters(const stp_printer_t printer,
+                     const char *ppd_file,
+                     const char *name)
+{
+  const char *answer;
+  setlocale(LC_ALL, "C");
+  answer = ps_default_parameters_internal(printer, ppd_file, name);
+  setlocale(LC_ALL, "");
+  return answer;
+}
 
 /*
  * 'ps_media_size()' - Return the size of the page.
  */
 
 static void
-ps_media_size(const stp_printer_t printer,     /* I - Printer model */
-             const stp_vars_t v,               /* I */
-              int  *width,             /* O - Width in points */
-              int  *height)            /* O - Height in points */
+ps_media_size_internal(const stp_printer_t printer,    /* I - Printer model */
+                      const stp_vars_t v,              /* I */
+                      int  *width,             /* O - Width in points */
+                      int  *height)            /* O - Height in points */
 {
   char *dimensions;                    /* Dimensions of media size */
 
@@ -264,18 +288,28 @@
     stp_default_media_size(printer, v, width, height);
 }
 
+static void
+ps_media_size(const stp_printer_t printer,     /* I - Printer model */
+             const stp_vars_t v,               /* I */
+              int  *width,             /* O - Width in points */
+              int  *height)            /* O - Height in points */
+{
+  setlocale(LC_ALL, "C");
+  ps_media_size_internal(printer, v, width, height);
+  setlocale(LC_ALL, "");
+}
 
 /*
  * 'ps_imageable_area()' - Return the imageable area of the page.
  */
 
 static void
-ps_imageable_area(const stp_printer_t printer, /* I - Printer model */
-                 const stp_vars_t v,      /* I */
-                  int  *left,          /* O - Left position in points */
-                  int  *right,         /* O - Right position in points */
-                  int  *bottom,                /* O - Bottom position in points */
-                  int  *top)           /* O - Top position in points */
+ps_imageable_area_internal(const stp_printer_t printer,        /* I - Printer model */
+                          const stp_vars_t v,      /* I */
+                          int  *left,  /* O - Left position in points */
+                          int  *right, /* O - Right position in points */
+                          int  *bottom, /* O - Bottom position in points */
+                          int  *top)   /* O - Top position in points */
 {
   char *area;                          /* Imageable area of media */
   float        fleft,                          /* Floating point versions */
@@ -310,6 +344,19 @@
 }
 
 static void
+ps_imageable_area(const stp_printer_t printer, /* I - Printer model */
+                 const stp_vars_t v,      /* I */
+                  int  *left,          /* O - Left position in points */
+                  int  *right,         /* O - Right position in points */
+                  int  *bottom,                /* O - Bottom position in points */
+                  int  *top)           /* O - Top position in points */
+{
+  setlocale(LC_ALL, "C");
+  ps_imageable_area_internal(printer, v, left, right, bottom, top);
+  setlocale(LC_ALL, "");
+}
+
+static void
 ps_limit(const stp_printer_t printer,  /* I - Printer model */
            const stp_vars_t v,                 /* I */
            int *width,
@@ -327,8 +374,8 @@
  * This is really bogus...
  */
 static void
-ps_describe_resolution(const stp_printer_t printer,
-                       const char *resolution, int *x, int *y)
+ps_describe_resolution_internal(const stp_printer_t printer,
+                               const char *resolution, int *x, int *y)
 {
   *x = -1;
   *y = -1;
@@ -336,14 +383,23 @@
   return;
 }
 
+static void
+ps_describe_resolution(const stp_printer_t printer,
+                       const char *resolution, int *x, int *y)
+{
+  setlocale(LC_ALL, "C");
+  ps_describe_resolution_internal(printer, resolution, x, y);
+  setlocale(LC_ALL, "");
+}
+
 /*
  * 'ps_print()' - Print an image to a PostScript printer.
  */
 
 static void
-ps_print(const stp_printer_t printer,          /* I - Model (Level 1 or 2) */
-         stp_image_t *image,           /* I - Image to print */
-        const stp_vars_t v)
+ps_print_internal(const stp_printer_t printer, /* I - Model (Level 1 or 2) */
+                 stp_image_t *image,           /* I - Image to print */
+                 const stp_vars_t v)
 {
   unsigned char *cmap = stp_get_cmap(v);
   int          model = stp_printer_get_model(printer);
@@ -693,6 +749,16 @@
   stp_free_vars(nv);
 }
 
+static void
+ps_print(const stp_printer_t printer,          /* I - Model (Level 1 or 2) */
+         stp_image_t *image,           /* I - Image to print */
+        const stp_vars_t v)
+{
+  setlocale(LC_ALL, "C");
+  ps_print_internal(printer, image, v);
+  setlocale(LC_ALL, "");
+}
+
 
 /*
  * 'ps_hex()' - Print binary data as a series of hexadecimal numbers.

_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to