diff --git a/ChangeLog b/ChangeLog index cd060678c..d31375ad2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,11 @@ Use NULL clip instead of special serial zero cairo_clip_t Should make using surfaces easier. +2005-12-19 Emmanuel Pacaud + + * src/cairo-svg-surface.c (_cairo_svg_surface_stroke): fix stroke + linewidth and dashes, I hope. Emit stroke-dashoffset. + 2005-12-19 Emmanuel Pacaud * configure.in: CAIRO_CAN_TEST_SVG_SURFACE depends on librsvg. diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c index b4a901440..5d9f74571 100644 --- a/src/cairo-svg-surface.c +++ b/src/cairo-svg-surface.c @@ -1147,7 +1147,7 @@ _cairo_svg_surface_stroke (void *abstract_dst, style = xmlBufferCreate (); emit_pattern (surface, source, style, 1); xmlBufferCat (style, CC2XML ("fill: none; stroke-width: ")); - _cairo_dtostr (buffer, sizeof buffer, (rx + ry) / 2.0); + _cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0)); xmlBufferCat (style, C2XML (buffer)); xmlBufferCat (style, CC2XML (";")); @@ -1183,10 +1183,18 @@ _cairo_svg_surface_stroke (void *abstract_dst, /* FIXME: Is is really what we want ? */ rx = ry = stroke_style->dash[i]; cairo_matrix_transform_distance (ctm, &rx, &ry); - _cairo_dtostr (buffer, sizeof buffer, (rx + ry) / 2.0); + _cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0)); xmlBufferCat (style, C2XML (buffer)); } xmlBufferCat (style, ";"); + if (stroke_style->dash_offset != 0.0) { + xmlBufferCat (style, CC2XML (" stroke-dashoffset: ")); + rx = ry = stroke_style->dash_offset; + cairo_matrix_transform_distance (ctm, &rx, &ry); + _cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0)); + xmlBufferCat (style, C2XML (buffer)); + xmlBufferCat (style, ";"); + } } xmlBufferCat (style, CC2XML (" stroke-miterlimit: "));