From 26ee3a10b806df99915805516567f6ad38956ac4 Mon Sep 17 00:00:00 2001 From: scuri Date: Thu, 14 Oct 2010 18:07:59 +0000 Subject: Fixed: locale in SVG for floating point numbers, it must use dots "." for decimal separators. --- src/svg/cdsvg.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/svg/cdsvg.c b/src/svg/cdsvg.c index 0510919..46e41bf 100644 --- a/src/svg/cdsvg.c +++ b/src/svg/cdsvg.c @@ -31,6 +31,7 @@ struct _cdCtxCanvas char linestyle[50]; char pattern[50]; + char* old_locale; char* font_weight; char* font_style; char* font_decoration; @@ -57,6 +58,12 @@ 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, "\n"); /* close clipping container */ @@ -1235,6 +1242,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, "English"); + ctxcanvas->file = fopen(filename, "w"); if (!ctxcanvas->file) { -- cgit v1.2.3