- Fix PostScript breakage following the non-monetary numeric format from

current locale. (#231916)
This commit is contained in:
Akira TAGOH 2007-03-27 11:50:55 +00:00
parent 3fd0d25b97
commit 874c8cefe1
2 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,82 @@
diff -ruN paps-0.6.6.orig/src/libpaps.c paps-0.6.6/src/libpaps.c
--- paps-0.6.6.orig/src/libpaps.c 2007-03-27 20:25:00.000000000 +0900
+++ paps-0.6.6/src/libpaps.c 2007-03-27 20:31:15.000000000 +0900
@@ -28,6 +28,7 @@
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include <errno.h>
+#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -263,7 +264,7 @@
);
/* Outline support */
- g_string_append_printf(paps->header,
+ paps_string_append_printf(paps->header,
"/conicto {\n"
" /to_y exch def\n"
" /to_x exch def\n"
@@ -691,3 +692,28 @@
return points * 1.0 / 72 * PAPS_DPI * PANGO_SCALE;
}
+void
+paps_string_append_printf(GString *string,
+ const gchar *fmt,
+ ...)
+{
+ gchar *buffer, *lc_numeric;
+ gint length;
+ va_list args;
+
+ va_start(args, fmt);
+
+ lc_numeric = g_strdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
+
+ length = g_vasprintf(&buffer, fmt, args);
+ g_string_append_len(string, buffer, length);
+
+ setlocale(LC_NUMERIC, lc_numeric);
+
+ g_free(buffer);
+ g_free(lc_numeric);
+
+ va_end(args);
+}
+
diff -ruN paps-0.6.6.orig/src/libpaps.h paps-0.6.6/src/libpaps.h
--- paps-0.6.6.orig/src/libpaps.h 2007-03-27 20:25:00.000000000 +0900
+++ paps-0.6.6/src/libpaps.h 2007-03-27 20:31:02.000000000 +0900
@@ -124,4 +124,8 @@
*/
double paps_postscript_points_to_pango(double points);
+void paps_string_append_printf(GString *string,
+ const gchar *fmt,
+ ...) G_GNUC_PRINTF (2, 3);
+
#endif /* LIBPAPS */
diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
--- paps-0.6.6.orig/src/paps.c 2007-03-27 20:25:00.000000000 +0900
+++ paps-0.6.6/src/paps.c 2007-03-27 20:31:33.000000000 +0900
@@ -992,7 +992,7 @@
y_top = page_layout->page_height - page_layout->top_margin - page_layout->header_height - page_layout->header_sep / 2;
y_bot = page_layout->bottom_margin - page_layout->footer_height;
- g_string_append_printf(ps_pages_string,
+ paps_string_append_printf(ps_pages_string,
"%f %f moveto %f %f lineto 0 setlinewidth stroke\n",
x_pos, y_top,
x_pos, y_bot);
@@ -1154,7 +1154,7 @@
/* header separator */
line_pos = page_layout->page_height - page_layout->top_margin - page_layout->header_height - page_layout->header_sep / 2;
- g_string_append_printf(ps_pages_string,
+ paps_string_append_printf(ps_pages_string,
"%d %f moveto %d %f lineto 0 setlinewidth stroke\n",
page_layout->left_margin, line_pos,
page_layout->page_width - page_layout->right_margin, line_pos);

View File

@ -1,6 +1,6 @@
Name: paps
Version: 0.6.6
Release: 18%{?dist}
Release: 19%{?dist}
License: LGPL
URL: http://paps.sourceforge.net/
@ -27,6 +27,7 @@ Patch9: paps-0.6.6-cpilpi.patch
Patch10: paps-0.6.6-exitcode.patch
Patch11: paps-0.6.6-fix-wcswidth.patch
Patch12: paps-0.6.6-langinfo.patch
Patch13: paps-0.6.6-lcnumeric.patch
Patch50: paps-cups.patch
Summary: Plain Text to PostScript converter
@ -49,6 +50,7 @@ paps is a PostScript converter from plain text file using Pango.
%patch10 -p1 -b .exitcode
%patch11 -p1 -b .wcswidth
%patch12 -p1 -b .langinfo
%patch13 -p1 -b .lcnumeric
%patch50 -p1 -b .cups
aclocal
automake
@ -82,6 +84,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Mar 27 2007 Akira TAGOH <tagoh@redhat.com> - 0.6.6-19
- Fix PostScript breakage following the non-monetary numeric format from
current locale. (#231916)
* Thu Mar 7 2007 Akira TAGOH <tagoh@redhat.com> - 0.6.6-18
- default to lpi=6 and cpi=10 if paps is bringing up as cups filter. (#223862)