diff options
Diffstat (limited to 'src/main/print-ps.c')
-rw-r--r-- | src/main/print-ps.c | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/src/main/print-ps.c b/src/main/print-ps.c index d85dd94..702d2d7 100644 --- a/src/main/print-ps.c +++ b/src/main/print-ps.c @@ -1,5 +1,5 @@ /* - * "$Id: print-ps.c,v 1.84 2006/04/17 02:06:19 rlk Exp $" + * "$Id: print-ps.c,v 1.87 2006/06/04 18:06:34 rleigh Exp $" * * Print plug-in Adobe PostScript driver for the GIMP. * @@ -34,6 +34,7 @@ #include "gutenprint-internal.h" #include <time.h> #include <string.h> +#include <math.h> #ifdef HAVE_LIMITS_H #include <limits.h> #endif @@ -159,6 +160,8 @@ ps_parameters_internal(const stp_vars_t *v, const char *name, stp_fill_parameter_settings(description, &(the_parameters[i])); break; } + if (strcmp(name, "PPDFile") == 0) + return; if (strcmp(name, "PrintingMode") == 0) { @@ -183,7 +186,7 @@ ps_parameters_internal(const stp_vars_t *v, const char *name, const stp_papersize_t *pt = stp_get_papersize_by_index(i); if (strlen(pt->name) > 0) stp_string_list_add_string - (description->bounds.str, pt->name, pt->text); + (description->bounds.str, pt->name, gettext(pt->text)); } description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; @@ -230,9 +233,9 @@ static void ps_parameters(const stp_vars_t *v, const char *name, stp_parameter_t *description) { - setlocale(LC_ALL, "C"); + char *locale = setlocale(LC_ALL, "C"); ps_parameters_internal(v, name, description); - setlocale(LC_ALL, ""); + setlocale(LC_ALL, locale); } /* @@ -260,8 +263,8 @@ ps_media_size_internal(const stp_vars_t *v, /* I */ != NULL) { sscanf(dimensions, "%f%f", &fwidth, &fheight); - *width = fwidth; - *height = fheight; + *width = (int) fwidth; + *height = (int) fheight; stp_dprintf(STP_DBG_PS, v, "dimensions '%s' %f %f %d %d\n", dimensions, fwidth, fheight, *width, *height); } @@ -272,9 +275,9 @@ ps_media_size_internal(const stp_vars_t *v, /* I */ static void ps_media_size(const stp_vars_t *v, int *width, int *height) { - setlocale(LC_ALL, "C"); + char *locale = setlocale(LC_ALL, "C"); ps_media_size_internal(v, width, height); - setlocale(LC_ALL, ""); + setlocale(LC_ALL, locale); } /* @@ -304,13 +307,16 @@ ps_imageable_area_internal(const stp_vars_t *v, /* I */ "ImageableArea", pagesize, NULL)) != NULL) { - stp_dprintf(STP_DBG_PS, v, "area = \'%s\'\n", area); - if (sscanf(area, "%f%f%f%f", &fleft, &fbottom, &fright, &ftop) == 4) + int status = sscanf(area, "%f%f%f%f", &fleft, &fbottom, &fright, &ftop); + stp_dprintf(STP_DBG_PS, v, + "area = \'%s\' status = %d l %f r %f b %f t %f h %d w %d\n", + area, status, fleft, fright, fbottom, ftop, width, height); + if (status) { - *left = (int)fleft; - *right = (int)fright; - *bottom = height - (int)fbottom; - *top = height - (int)ftop; + *left = (int) ceil((double) fleft); + *right = (int) floor((double) fright); + *bottom = (int) floor((double) height - fbottom); + *top = (int) ceil((double) height - ftop); if (use_max_area) { if (*left > 0) @@ -344,9 +350,9 @@ ps_imageable_area(const stp_vars_t *v, /* I */ int *bottom, /* O - Bottom position in points */ int *top) /* O - Top position in points */ { - setlocale(LC_ALL, "C"); + char *locale = setlocale(LC_ALL, "C"); ps_imageable_area_internal(v, 0, left, right, bottom, top); - setlocale(LC_ALL, ""); + setlocale(LC_ALL, locale); } static void @@ -356,9 +362,9 @@ ps_maximum_imageable_area(const stp_vars_t *v, /* I */ int *bottom, /* O - Bottom position in points */ int *top) /* O - Top position in points */ { - setlocale(LC_ALL, "C"); + char *locale = setlocale(LC_ALL, "C"); ps_imageable_area_internal(v, 1, left, right, bottom, top); - setlocale(LC_ALL, ""); + setlocale(LC_ALL, locale); } static void @@ -391,9 +397,9 @@ ps_describe_resolution_internal(const stp_vars_t *v, int *x, int *y) static void ps_describe_resolution(const stp_vars_t *v, int *x, int *y) { - setlocale(LC_ALL, "C"); + char *locale = setlocale(LC_ALL, "C"); ps_describe_resolution_internal(v, x, y); - setlocale(LC_ALL, ""); + setlocale(LC_ALL, locale); } static const char * @@ -454,6 +460,7 @@ ps_print_internal(const stp_vars_t *v, stp_image_t *image) int image_height, image_width; stp_vars_t *nv = stp_vars_create_copy(v); + char *locale; if (!resolution) resolution = ""; if (!media_size) @@ -638,11 +645,11 @@ ps_print_internal(const stp_vars_t *v, stp_image_t *image) always be printed with a decimal point rather than the locale-specific setting. */ - setlocale(LC_ALL, "C"); + locale = setlocale(LC_ALL, "C"); stp_zprintf(v, "%.3f %.3f scale\n", (double)out_width / ((double)image_width), (double)out_height / ((double)image_height)); - setlocale(LC_ALL, ""); + setlocale(LC_ALL, locale); stp_channel_reset(nv); stp_channel_add(nv, 0, 0, 1.0); @@ -766,10 +773,9 @@ ps_print_internal(const stp_vars_t *v, stp_image_t *image) static int ps_print(const stp_vars_t *v, stp_image_t *image) { - int status; - setlocale(LC_ALL, "C"); - status = ps_print_internal(v, image); - setlocale(LC_ALL, ""); + char *locale = setlocale(LC_ALL, "C"); + int status = ps_print_internal(v, image); + setlocale(LC_ALL, locale); return status; } |