<html><body>
<p>I originally sent this to Carl and he kindly suggested I re-post it to this mailing list, so...<br>
<br>
I have been working on some bugs in the Mozilla SVG arena. The initial stroke-cap is missing from the very first dash-array element drawn in the following svg example. I noticed there was a cairo bug already in the system, <a href="https://bugs.freedesktop.org/show_bug.cgi?id=4409">https://bugs.freedesktop.org/show_bug.cgi?id=4409</a>, that addressed this issue, or close to it, but apparently still exists on, at least, the Windows XP version of recent builds of firefox. I don't think this has been resolved in the most recent version of cairo-path-stroke.c.<br>
<br>
This is the svg example I have been playing with that shows this problem:<br>
<?xml version="1.0" ?> <br>
<svg xmlns="<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>" viewBox="0 0 600 600"><br>
<rect x="20" y="20" width="100" height="100" fill="blue" stroke="red"<br>
stroke-width="20" stroke-dasharray="0.001,20" stroke-linecap="round"/><br>
</svg><br>
<br>
If you render this in firefox, you will notice that the very first leading cap is cutoff.<br>
<br>
I am using a recent mozilla/gfx/cairo/cairo/src/cairo-path-stroke.c file from the Mozilla core to make changes for testing so my cvs diff is off from the cairo base code (otherwise I would include the entire patch). This change is minor but makes a difference in the rendering of the first array element in the case above. <br>
Here is a fix for it: <br>
<br>
@@ -720,21 +738,20 @@ _cairo_stroker_line_to_dashed (void *clo<br>
                if (stroker->has_current_face) {<br>
                 status = _cairo_stroker_join (stroker, &stroker->current_face, &sub_start);<br>
                 if (status)<br>
                        return status;<br>
                } else {<br>
                 if (!stroker->has_first_face) {<br>
                        stroker->first_face = sub_start;<br>
                        stroker->has_first_face = 1;<br>
-                 } <font color="#FF0000">else {</font><br>
+                 } <br>
                        status = _cairo_stroker_add_leading_cap (stroker, &sub_start);<br>
                        if (status)<br>
                         return status;<br>
-                 <font color="#FF0000">}</font><br>
                }<br>
         }<br>
         if (remain) {<br>
                /*<br>
                 * Cap if not at end of segment<br>
                 */<br>
                status = _cairo_stroker_add_trailing_cap (stroker, &sub_end);<br>
                if (status)<br>
<br>
The problem with the above svg example is that the first element in this dash-array NEVER invokes _cairo_stroker_add_leading_cap. I think _cairo_stroker_add_leading_cap needs to be called in both cases of <i>if (!stroker->has_first_face). </i><br>
<br>
Thanks,<br>
Keith</body></html>