[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Swftools-common] Parsing of svg path data
From: |
Magnus Lundin |
Subject: |
[Swftools-common] Parsing of svg path data |
Date: |
Sun, 06 Nov 2005 17:37:43 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20041206) |
Hello
I tried to use path data generated by gnuplot in a swfc .outline but had
to manually insert
whitespace between the M and L path commands and the position data.
According to the SVG 1.1 spec :
"Superfluous white space and separators such as commas can be eliminated
(e.g., "M 100 100 L 200 200" contains unnecessary spaces and could be
expressed more compactly as "M100 100L200 200")."
Ref: http://www.w3.org/TR/SVG11/paths.html#PathDataGeneralInformation
So it seems that gnuplot was right after all.
This can be fixed in the getToken function in drawer.c
diff orig/swftools-0.7.0/lib/drawer.c swftools-0.7.0/lib/d rawer.c
27a28
> #include <ctype.h>
38c39,49
< while(**p && !strchr(" ,()\t\n\r", **p)) {
---
> /*
> SVF pathdata can exclude whitespace after L and M commands.
> Ref: http://www.w3.org/TR/SVG11/paths.html#PathDataGeneralInformation
> This allows us to use svg files output from gnuplot.
> Also checks for relative MoveTo and LineTo (m and l).
> 051106 Magnus Lundin, address@hidden
> */
> if (strchr("LMlm", **p) && (isdigit(*(*p+1))||strchr("+-",
*(*p+1)))) {
> (*p)++;
> }
> else while(**p && !strchr(" ,()\t\n\r", **p)) {
This is perhaps not a beautiful patch ibut it semms to do the trick.
Magnus Lundin
- [Swftools-common] Parsing of svg path data,
Magnus Lundin <=