diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2013-09-11 22:01:00 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2013-09-11 22:01:00 +0000 |
| commit | 733c08860b33111126b46fbedb4fc4d744931e9a (patch) | |
| tree | 27d345e2f5e21e73859c2e3db2ae3c4d3c6a9252 | |
| parent | improve legibility (diff) | |
| download | inkscape-733c08860b33111126b46fbedb4fc4d744931e9a.tar.gz inkscape-733c08860b33111126b46fbedb4fc4d744931e9a.zip | |
partially revert 12471, this fixes bug 1215575, but undoes the fix for the less important bug 1208002.
(also improved unit conversion legibility)
Fixed bugs:
- https://launchpad.net/bugs/1215575
(bzr r12506)
| -rw-r--r-- | src/svg/svg-length.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/svg/svg-length.cpp b/src/svg/svg-length.cpp index ea438e91a..05a3ef4b8 100644 --- a/src/svg/svg-length.cpp +++ b/src/svg/svg-length.cpp @@ -285,6 +285,10 @@ std::vector<SVGLength> sp_svg_length_list_read(gchar const *str) static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, float *val, float *computed, char **next) { +/* note: this function is sometimes fed a string with several consecutive numbers, e.g. by sp_svg_length_list_read. +So after the number, the string does not necessarily have a \0 or a unit, it might also contain a space or comma and then the next number! +*/ + if (!str) { return 0; } @@ -330,8 +334,6 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, *next = (char *) e + 1; } return 1; - } else if (g_ascii_isspace(e[0])) { - return 0; // spaces are not allowed } else { /* Unitless */ if (unit) { @@ -367,7 +369,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, *unit = SVGLength::PT; } if (computed) { - *computed = v * Inkscape::Util::Quantity::convert(1, "pt", "px"); + *computed = Inkscape::Util::Quantity::convert(v, "pt", "px"); } break; case UVAL('p','c'): @@ -375,7 +377,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, *unit = SVGLength::PC; } if (computed) { - *computed = v * Inkscape::Util::Quantity::convert(1, "pc", "px"); + *computed = Inkscape::Util::Quantity::convert(v, "pc", "px"); } break; case UVAL('m','m'): @@ -383,7 +385,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, *unit = SVGLength::MM; } if (computed) { - *computed = v * Inkscape::Util::Quantity::convert(1, "mm", "px"); + *computed = Inkscape::Util::Quantity::convert(v, "mm", "px"); } break; case UVAL('c','m'): @@ -391,7 +393,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, *unit = SVGLength::CM; } if (computed) { - *computed = v * Inkscape::Util::Quantity::convert(1, "cm", "px"); + *computed = Inkscape::Util::Quantity::convert(v, "cm", "px"); } break; case UVAL('i','n'): @@ -399,7 +401,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, *unit = SVGLength::INCH; } if (computed) { - *computed = v * Inkscape::Util::Quantity::convert(1, "in", "px"); + *computed = Inkscape::Util::Quantity::convert(v, "in", "px"); } break; case UVAL('f','t'): @@ -407,7 +409,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, *unit = SVGLength::FOOT; } if (computed) { - *computed = v * Inkscape::Util::Quantity::convert(1, "ft", "px"); + *computed = Inkscape::Util::Quantity::convert(v, "ft", "px"); } break; case UVAL('e','m'): |
