[PATCH] use "." as fraction separator independently of locale settings
- From: Vlad Harchev <hvv hippo ru>
- To: gnome-print helixcode com
- Cc: gnome-i18n gnome org
- Subject: [PATCH] use "." as fraction separator independently of locale settings
- Date: Sat, 10 Mar 2001 16:10:13 +0400 (SAMT)
Hi,
Here is a patch against 0.25 that forces pdf generator to use "." as fraction
seprarator, independant of the locale's settings (e.g., under russian locales
fraction separator is comma). Of course, .pdf that use anything but dot as
fraction seprator can't be opened by any .pdf reader out there.
It would be nice if this patch went into gnome-print shipped with
gnome-1.4 - what do you think?
Best regards,
-Vlad
--- gnome-print-pdf.c~ Tue Nov 14 04:30:56 2000
+++ gnome-print-pdf.c Sat Mar 10 15:33:28 2001
@@ -54,6 +54,7 @@
#include <gtk/gtk.h>
#include <string.h>
#include <math.h>
+#include <locale.h>
#include <libart_lgpl/art_affine.h>
#include <libart_lgpl/art_misc.h>
@@ -347,11 +348,15 @@
GnomePrintPdf *pdf;
va_list arguments;
gchar *text;
+ char *oldlocale;
g_return_val_if_fail (GNOME_IS_PRINT_CONTEXT (pc), -1);
pdf = GNOME_PRINT_PDF (pc);
g_return_val_if_fail (pdf != NULL, -1);
+ oldlocale = g_strdup (setlocale (LC_NUMERIC, NULL));
+ setlocale (LC_NUMERIC, "C");
+
va_start (arguments, format);
text = g_strdup_vprintf (format, arguments);
va_end (arguments);
@@ -359,6 +364,9 @@
pdf->offset += gnome_print_context_write_file (pc, text, strlen(text));
g_free (text);
+
+ setlocale (LC_NUMERIC, oldlocale);
+ g_free (oldlocale);
return 0;
}
@@ -1633,6 +1641,7 @@
va_list arguments;
gchar *text;
gint text_length;
+ char *oldlocale;
debug (FALSE, "");
@@ -1641,9 +1650,15 @@
pc = GNOME_PRINT_CONTEXT (pdf);
g_return_val_if_fail (GNOME_IS_PRINT_CONTEXT (pc), -1);
+ oldlocale = g_strdup (setlocale (LC_NUMERIC, NULL));
+ setlocale (LC_NUMERIC, "C");
+
va_start (arguments, format);
text = g_strdup_vprintf (format, arguments);
va_end (arguments);
+
+ setlocale (LC_NUMERIC, oldlocale);
+ g_free (oldlocale);
page = pdf->current_page;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]