summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2010-10-19 15:48:26 +0000
committerscuri <scuri>2010-10-19 15:48:26 +0000
commit736712ef1e87d38e52e502d859cca2dcad56a3ce (patch)
tree49ec51ce6376e2797258cd68d4db64b4f9452b4d
parentd965dd8953d37a41ab8958a3ff05d0d9aa14c09f (diff)
*** empty log message ***
-rw-r--r--html/en/history.html2
-rw-r--r--src/drv/cdps.c12
-rw-r--r--src/svg/cdsvg.c12
3 files changed, 19 insertions, 7 deletions
diff --git a/html/en/history.html b/html/en/history.html
index f68efe6..20acc64 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -60,7 +60,7 @@
driver when there are many horizontal lines in sequence on the same
polygon.</li>
<li>
- <span class="hist_fixed">Fixed:</span> locale in SVG for floating point
+ <span class="hist_fixed">Fixed:</span> locale in SVG and PS for floating point
numbers, it must use dots &quot;.&quot; for decimal separators.</li>
<li>
<span class="hist_fixed">Fixed:</span> Cairo context plus base driver
diff --git a/src/drv/cdps.c b/src/drv/cdps.c
index 08d6ba7..0db3590 100644
--- a/src/drv/cdps.c
+++ b/src/drv/cdps.c
@@ -9,6 +9,7 @@
#include <string.h>
#include <time.h>
#include <math.h>
+#include <locale.h>
#include "cd.h"
#include "cd_private.h"
@@ -64,6 +65,7 @@ struct _cdCtxCanvas
int level1; /* if true generates level 1 only function calls */
int landscape; /* page orientation */
int debug; /* print debug strings in the file */
+ char* old_locale;
float rotate_angle;
int rotate_center_x,
@@ -391,6 +393,12 @@ static void cdkillcanvas(cdCtxCanvas *ctxcanvas)
fclose(ctxcanvas->file);
+ if (ctxcanvas->old_locale)
+ {
+ setlocale(LC_NUMERIC, ctxcanvas->old_locale);
+ free(ctxcanvas->old_locale);
+ }
+
memset(ctxcanvas, 0, sizeof(cdCtxCanvas));
free(ctxcanvas);
}
@@ -1965,6 +1973,10 @@ static void cdcreatecanvas(cdCanvas* canvas, void *data)
ctxcanvas = (cdCtxCanvas *)malloc(sizeof(cdCtxCanvas));
memset(ctxcanvas, 0, sizeof(cdCtxCanvas));
+ /* SVN specification states that number must use dot as decimal separator */
+ ctxcanvas->old_locale = cdStrDup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
+
line += cdGetFileName(line, filename);
if (filename[0] == 0)
return;
diff --git a/src/svg/cdsvg.c b/src/svg/cdsvg.c
index b84fb48..bfde533 100644
--- a/src/svg/cdsvg.c
+++ b/src/svg/cdsvg.c
@@ -58,12 +58,6 @@ static void cdtransform(cdCtxCanvas *ctxcanvas, const double* matrix);
static void cdkillcanvas(cdCtxCanvas* ctxcanvas)
{
- if (ctxcanvas->old_locale)
- {
- setlocale(LC_NUMERIC, ctxcanvas->old_locale);
- free(ctxcanvas->old_locale);
- }
-
if (ctxcanvas->clip_control)
fprintf(ctxcanvas->file, "</g>\n"); /* close clipping container */
@@ -75,6 +69,12 @@ static void cdkillcanvas(cdCtxCanvas* ctxcanvas)
fclose(ctxcanvas->file);
+ if (ctxcanvas->old_locale)
+ {
+ setlocale(LC_NUMERIC, ctxcanvas->old_locale);
+ free(ctxcanvas->old_locale);
+ }
+
memset(ctxcanvas, 0, sizeof(cdCtxCanvas));
free(ctxcanvas);
}