diff options
| author | mathog <> | 2015-02-25 23:02:56 +0000 |
|---|---|---|
| committer | mathog <> | 2015-02-25 23:02:56 +0000 |
| commit | 52f3d8937eac1d8b7115af5a4a9c8b0e6c70eb78 (patch) | |
| tree | 4cfa1082c982c0bce4052e28fb591bf55576486e /src | |
| parent | Isolate components of libgc (diff) | |
| download | inkscape-52f3d8937eac1d8b7115af5a4a9c8b0e6c70eb78.tar.gz inkscape-52f3d8937eac1d8b7115af5a4a9c8b0e6c70eb78.zip | |
fix for bug 1425317
(bzr r13947)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/emf-inout.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/emf-print.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/text_reassemble.c | 20 | ||||
| -rw-r--r-- | src/extension/internal/wmf-inout.cpp | 4 |
4 files changed, 25 insertions, 7 deletions
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 71b6b82f7..31e69706f 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -188,7 +188,7 @@ double Emf::current_scale(PEMF_CALLBACK_DATA d){ "matrix(a,b,c,d,e,f)" (WITH the double quotes) */ std::string Emf::current_matrix(PEMF_CALLBACK_DATA d, double x, double y, int useoffset){ - std::stringstream cxform; + SVGOStringStream cxform; double scale = current_scale(d); cxform << "\"matrix("; cxform << d->dc[d->level].worldTransform.eM11/scale; cxform << ","; @@ -1058,7 +1058,7 @@ Emf::snap_to_faraway_pair(double *x, double *y) Since exclude clip can go through here, it calls snap_to_faraway_pair for numerical stability. */ std::string Emf::pix_to_xy(PEMF_CALLBACK_DATA d, double x, double y){ - std::stringstream cxform; + SVGOStringStream cxform; double tx = pix_to_x_point(d,x,y); double ty = pix_to_y_point(d,x,y); snap_to_faraway_pair(&tx,&ty); diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index b22dbc0e3..67a9242bc 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -251,7 +251,11 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1"); } + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); snprintf(buff, sizeof(buff) - 1, "Drawing=%.1lfx%.1lfpx, %.1lfx%.1lfmm", _width, _height, Inkscape::Util::Quantity::convert(dwInchesX, "in", "mm"), Inkscape::Util::Quantity::convert(dwInchesY, "in", "mm")); + setlocale(LC_NUMERIC, oldlocale); + g_free(oldlocale); rec = textcomment_set(buff); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1"); diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c index 4dfc49420..d3aafef12 100644 --- a/src/extension/internal/text_reassemble.c +++ b/src/extension/internal/text_reassemble.c @@ -67,11 +67,11 @@ Optional compiler switches for development: File: text_reassemble.c -Version: 0.0.15 -Date: 24-JUL-2014 +Version: 0.0.16 +Date: 25-FEB-2015 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2014 David Mathog and California Institute of Technology (Caltech) +Copyright: 2015 David Mathog and California Institute of Technology (Caltech) */ #ifdef __cplusplus @@ -80,6 +80,7 @@ extern "C" { #include "text_reassemble.h" #include <libuemf/uemf_utf.h> /* For a couple of text functions. Exact copy from libUEMF. */ +#include <locale.h> #include <float.h> /* Code generated by make_ucd_mn_table.c using: @@ -1936,6 +1937,15 @@ void TR_layout_2_svg(TR_INFO *tri){ double newx,newy,tmpx; uint32_t utmp; + /* copy the current numeric locale, make a copy because setlocale may stomp on + the memory it points to. Then change it because SVG needs decimal points, + not commas, in floats. Restore on exit from this routine. + */ + char *prev_locale = setlocale(LC_NUMERIC,NULL); + char *hold_locale = malloc(sizeof(char) * (strlen(prev_locale) + 1)); + strcpy(hold_locale,prev_locale); + (void) setlocale(LC_NUMERIC,"POSIX"); + /* #define DBG_TR_PARA 0 #define DBG_TR_INPUT 1 @@ -2232,6 +2242,10 @@ void TR_layout_2_svg(TR_INFO *tri){ } /* end of j loop */ TRPRINT(tri,"</tspan></text>\n"); } /* end of i loop */ + + /* restore locale and free memory. */ + (void) setlocale(LC_NUMERIC,hold_locale); + free(hold_locale); } /** diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 8eb03131c..503a93418 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -176,7 +176,7 @@ double Wmf::current_scale(PWMF_CALLBACK_DATA /*d*/){ /* WMF has no worldTransform, so this always returns an Identity rotation matrix, but the offsets may have values.*/ std::string Wmf::current_matrix(PWMF_CALLBACK_DATA d, double x, double y, int useoffset){ - std::stringstream cxform; + SVGOStringStream cxform; double scale = current_scale(d); cxform << "\"matrix("; cxform << 1.0/scale; cxform << ","; @@ -948,7 +948,7 @@ Wmf::pix_to_abs_size(PWMF_CALLBACK_DATA d, double px) /* returns "x,y" (without the quotes) in inkscape coordinates for a pair of WMF x,y coordinates */ std::string Wmf::pix_to_xy(PWMF_CALLBACK_DATA d, double x, double y){ - std::stringstream cxform; + SVGOStringStream cxform; cxform << pix_to_x_point(d,x,y); cxform << ","; cxform << pix_to_y_point(d,x,y); |
