Re: [Inkscape-devel] more on win32 locale
Se attached diff for the function that causes the komma.
Thanks, applied
For now I don't see other cases that generate wrong number output even there are a lot printfs.
Here's what I found:
sp_arc_set_elliptical_path_attribute in sp-ellipse
sp_stop_write and sp_gradient_repr_set_vector in sp-gradient
sp-metrics
one more _dump_path is sp-offset
sp_shape_build in sp-shape
still lots of printfs with %g in style.cpp
sp_svg_write_percentage
all postscript output in extensions/internal/ps.cpp
sp_dtw_whatever_changed and 2 more cases in desktop-properties
still more style writing in sp_fill_style_widget_paint_changed in dialogs/fill-style
similar in stroke-style, also dash setting there
widget_opacity_value_changed in item-properties
setting font-size in text-edit
Perhaps I still missed something...
_________________________________________________________________ Free yourself from those irritating pop-up ads with MSn Premium. Get 2months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI...
Here's what I found:
sp_arc_set_elliptical_path_attribute in sp-ellipse
....
Oh my god ;-)
ok lets go step by step and where we can produce a failure ...
Attached there is a failure.svg and patch for the "d" property in ellipse. Also a patch for stroke-with in style.
I noticed that I can't set stroke with from within the dialog. So most of the dialog functions are infected.
bulia byak wrote:
Se attached diff for the function that causes the komma.
Thanks, applied
For now I don't see other cases that generate wrong number output even there are a lot printfs.
Here's what I found:
sp_arc_set_elliptical_path_attribute in sp-ellipse
sp_stop_write and sp_gradient_repr_set_vector in sp-gradient
sp-metrics
one more _dump_path is sp-offset
sp_shape_build in sp-shape
still lots of printfs with %g in style.cpp
sp_svg_write_percentage
all postscript output in extensions/internal/ps.cpp
sp_dtw_whatever_changed and 2 more cases in desktop-properties
still more style writing in sp_fill_style_widget_paint_changed in dialogs/fill-style
similar in stroke-style, also dash setting there
widget_opacity_value_changed in item-properties
setting font-size in text-edit
Perhaps I still missed something...
Free yourself from those irritating pop-up ads with MSn Premium. Get 2months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI...
--- style.cvs.cpp 2004-03-26 22:25:27.000000000 +0100 +++ style.cpp 2004-03-28 14:43:37.000000000 +0200 @@ -2145,43 +2145,55 @@ */ static gint sp_style_write_ilength (gchar *p, gint len, const gchar *key, SPILength *val, SPILength *base, guint flags) { + Inkscape::SVGOStringStream os; + if (((flags & SP_STYLE_FLAG_IFSET) && val->set) || ((flags & SP_STYLE_FLAG_IFDIFF) && val->set && sp_length_differ (val, base))) { if (val->inherit) { return g_snprintf (p, len, "%s:inherit;", key); } else { switch (val->unit) { case SP_CSS_UNIT_NONE: - return g_snprintf (p, len, "%s:%g;", key, val->computed); - break; + os << key << ":" << val->computed << ";"; + return g_strlcpy (p, os.str().c_str(), len); + break; case SP_CSS_UNIT_PX: - return g_snprintf (p, len, "%s:%gpx;", key, val->computed); + os << key << ":" << val->computed << "px;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_PT: - return g_snprintf (p, len, "%s:%gpt;", key, val->computed / 1.25); + os << key << ":" << val->computed / 1.25 << "pt;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_PC: - return g_snprintf (p, len, "%s:%gpc;", key, val->computed / 15.0); + os << key << ":" << val->computed / 15.0 << "pc;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_MM: - return g_snprintf (p, len, "%s:%gmm;", key, val->computed / 3.543307); + os << key << ":" << val->computed / 3.543307 << "mm;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_CM: - return g_snprintf (p, len, "%s:%gmm;", key, val->computed / 35.43307); + os << key << ":" << val->computed / 35.43307 << "mm;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_IN: - return g_snprintf (p, len, "%s:%gin;", key, val->computed / 90.0); + os << key << ":" << val->computed / 90 << "in;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_EM: - return g_snprintf (p, len, "%s:%gem;", key, val->value); + os << key << ":" << val->computed << "em;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_EX: - return g_snprintf (p, len, "%s:%gex;", key, val->value); + os << key << ":" << val->computed << "ex;"; + return g_strlcpy (p, os.str().c_str(), len); break; case SP_CSS_UNIT_PERCENT: - return g_snprintf (p, len, "%s:%g%%;", key, val->value); + os << key << ":" << val->computed << "%;"; + return g_strlcpy (p, os.str().c_str(), len); break; default: /* Invalid */ break;
--- sp-ellipse.cvs.cpp 2004-03-16 05:20:23.000000000 +0100 +++ sp-ellipse.cpp 2004-03-28 13:53:38.000000000 +0200 @@ -20,8 +20,9 @@
#include "libnr/nr-matrix.h" #include "libnr/nr-matrix-ops.h" #include "svg/svg.h" +#include "svg/stringstream.h" #include "attributes.h" #include "style.h" #include "version.h"
@@ -687,50 +688,44 @@ */ static gboolean sp_arc_set_elliptical_path_attribute (SPArc *arc, SPRepr *repr) { -#define ARC_BUFSIZE 256 gint fa, fs; gdouble dt; - gchar c[ARC_BUFSIZE]; - + Inkscape::SVGOStringStream os; + SPGenericEllipse *ge = SP_GENERICELLIPSE (arc);
NR::Point p1 = sp_arc_get_xy (arc, ge->start); NR::Point p2 = sp_arc_get_xy (arc, ge->end);
dt = fmod (ge->end - ge->start, SP_2PI); if (fabs (dt) < 1e-6) { NR::Point ph = sp_arc_get_xy (arc, (ge->start + ge->end) / 2.0); - g_snprintf (c, ARC_BUFSIZE, "M %f %f A %f %f 0 %d %d %f,%f A %g %g 0 %d %d %g %g z", - p1[NR::X], p1[NR::Y], - ge->rx.computed, ge->ry.computed, - 1, (dt > 0), - ph[NR::X], ph[NR::Y], - ge->rx.computed, ge->ry.computed, - 1, (dt > 0), - p2[NR::X], p2[NR::Y]); + os << "M " << p1[NR::X] << " " << p1[NR::Y] + << " A " << ge->rx.computed << " " << ge->ry.computed + << " 0 1 " << ((dt > 0)?1:0) << " " << ph[NR::X] << "," << ph[NR::Y] + << " A " << ge->rx.computed << " " << ge->ry.computed + << " 0 1 " << ((dt > 0)?1:0) << " " << p2[NR::X] << " " << p2[NR::Y] << " z"; } else { fa = (fabs (dt) > M_PI) ? 1 : 0; fs = (dt > 0) ? 1 : 0; #ifdef ARC_VERBOSE g_print ("start:%g end:%g fa=%d fs=%d\n", ge->start, ge->end, fa, fs); #endif if (ge->closed) { - g_snprintf (c, ARC_BUFSIZE, "M %f,%f A %f,%f 0 %d %d %f,%f L %f,%f z", - p1[NR::X], p1[NR::Y], - ge->rx.computed, ge->ry.computed, - fa, fs, - p2[NR::X], p2[NR::Y], - ge->cx.computed, ge->cy.computed); + os << "M " << p1[NR::X] << "," << p1[NR::Y] + << " A " << ge->rx.computed << "," << ge->ry.computed + << " 0 " << fa << " " << fs << " " << p2[NR::X] << "," << p2[NR::Y] + << " L " << ge->cx.computed << "," << ge->cy.computed << " z"; } else { - g_snprintf (c, ARC_BUFSIZE, "M %f,%f A %f,%f 0 %d %d %f,%f", - p1[NR::X], p1[NR::Y], - ge->rx.computed, ge->ry.computed, - fa, fs, p2[NR::X], p2[NR::Y]); + os << "M " << p1[NR::X] << "," << p1[NR::Y] + << " A " << ge->rx.computed << "," << ge->ry.computed + << " 0 " << fa << " " << fs << " " << p2[NR::X] << "," << p2[NR::Y]; + } } - return sp_repr_set_attr (repr, "d", c); + return sp_repr_set_attr (repr, "d", os.str().c_str()); }
static SPRepr * sp_arc_write (SPObject *object, SPRepr *repr, guint flags)
participants (2)
-
Adib Taraben
-
bulia byak