Robert, a UMLGraph user sent me an email describing a problem with the GNU plotutils SVG output on Firefox. I firmly believe that code reading is a lot easier than many think: one can easily fix most software problems without detailed knowledge of the underlying system. I therefore decided to practice what I preach.
Robert wrote.
"I've been playing with sequence diagrams and outputting to SVG format and noticed that the resulting SVG XML file isn't playing nicely with Firefox. After some experimenting and googling I found it is because the "stroke-dasharray='...'" entry intags is missing commas between array items. According to misc forum posts it seems that the spec requires commas, and Firefox is pedantic about this. Diagrams look fine aside from all lines being solid.
E.g.:should have been<line ... stroke-dasharray="0.05 0.05"/>I tried mangling the "dashwid" variable of my sequence diagram to include a comma (e.g. "dashwid = '0.05,';) but couldn't avoid upsetting pic2plot's parser.<line ... stroke-dasharray="0.05, 0.05"/>
So I'm not sure where the problem lies - is it sequence.pic? pic2plot? libplot?"
I found and fixed the problem through the following steps.
find . -type f | xargs grep 'stroke-dashar'
./libplot/s_closepl.c
,
./libplot/s_path.c
, and
./test/plot2svg.xout
.
Common sense indicates that the problem is in
s_path.c
.
Note that I didn't spend any time browsing the distribution's other
559 files (337,753 lines).
sprintf (page->point, "stroke-dasharray=\"");
_update_buffer (page);
for (i = 0; i < num_dashes; i++)
{
sprintf (page->point, "%.5g%s",
dashbuf[i],
i < num_dashes - 1 ? " " : "\"");
_update_buffer (page);
}
sprintf (page->point, "%.5g%s",
dashbuf[i],
i < num_dashes - 1 ? ", " : "\"");
Last modified: Tuesday, August 11, 2009 4:40 pm
Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.