diff options
Diffstat (limited to 'src/cairo-tag-attributes.c')
-rw-r--r-- | src/cairo-tag-attributes.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/cairo-tag-attributes.c b/src/cairo-tag-attributes.c index 44b1147fb..7977d87f4 100644 --- a/src/cairo-tag-attributes.c +++ b/src/cairo-tag-attributes.c @@ -149,7 +149,7 @@ static attribute_spec_t _ccitt_params_spec[] = * lly - lower left y xoordinate * urx - upper right x xoordinate * ury - upper right y xoordinate - * all cordinates are in PostScript coordinates. + * all coordinates are in PostScript coordinates. */ static attribute_spec_t _eps_params_spec[] = { @@ -217,9 +217,28 @@ static const char * parse_float (const char *p, double *d) { int n; + const char *start = p; + cairo_bool_t has_decimal_point = FALSE; - if (sscanf(p, "%lf%n", d, &n) > 0) - return p + n; + while (*p) { + if (*p == '.' || *p == ']' || _cairo_isspace (*p)) + break; + p++; + } + + if (*p == '.') + has_decimal_point = TRUE; + + if (has_decimal_point) { + char *end; + *d = _cairo_strtod (start, &end); + if (end) + return end; + + } else { + if (sscanf(start, "%lf%n", d, &n) > 0) + return start + n; + } return NULL; } |