Code

Line-end fix
[inkscape.git] / src / svg / svg-length.cpp
index 63af37665f02ce80858654108eebc02e15958acb..f909446675911d791382a4ca06d3150230760983 100644 (file)
 # include "config.h"
 #endif
 
+#include <cstring>
+#include <string>
 #include <math.h>
 #include <glib/gstrfuncs.h>
+
 #include "svg.h"
 #include "stringstream.h"
 #include "../unit-constants.h"
@@ -99,7 +102,7 @@ static unsigned sp_svg_number_write_d(gchar *buf, double val, unsigned int tprec
     }
     
     /* Determine the actual number of fractional digits */
-    fprec = MAX(fprec, tprec - idigits);
+    fprec = MAX(fprec, tprec - idigits - 1);
     /* Round value */
     val += 0.5 * pow(10.0, - ((double) fprec));
     /* Extract integral and fractional parts */
@@ -347,7 +350,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit,
                     *unit = SVGLength::PC;
                 }
                 if (computed) {
-                    *computed = v * 12 * PX_PER_PT;
+                    *computed = v * PX_PER_PC;
                 }
                 break;
             case UVAL('m','m'):
@@ -374,6 +377,14 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit,
                     *computed = v * PX_PER_IN;
                 }
                 break;
+            case UVAL('f','t'):
+                if (unit) {
+                    *unit = SVGLength::FOOT;
+                }
+                if (computed) {
+                    *computed = v * PX_PER_FT;
+                }
+                break;
             case UVAL('e','m'):
                 if (unit) {
                     *unit = SVGLength::EM;