Comment 2 for bug 167002

Revision history for this message
Bug Importer (bug-importer) wrote :

The same happens on Linux (Gentoo) with Inkscape Version
0.43. I figured out that it works if the SVG-attribute
"stroke-dasharray:" contains at least two values e.g
"stroke-dasharray:10,10". If it only contains one value the
line appears as a solid line. I looked also into the source
file ps.cpp and found the method print_stroke_style. There
appears the following code:

// There are rare cases in which for a solid line
stroke_dasharray_set is true. To avoid
// invalid PS-lines such as "[0.0000000 0.0000000] 0.0000000
setdash", which should be "[] 0 setdash",
// we first check if all components of stroke_dash.dash are 0.
    bool LineSolid = true;
    if (style->stroke_dasharray_set &&
        style->stroke_dash.n_dash &&
        style->stroke_dash.dash ) {
        int i = 0;
        while (LineSolid && (i < style->stroke_dash.n_dash)) {
                i++;
                if (style->stroke_dash.dash[i] > 0.00000001)
                    LineSolid = false;
        }
        if (!LineSolid) {
            os << "[";
            for (i = 0; i < style->stroke_dash.n_dash; i++) {
                if (i > 0) {
                    os << " ";
                }
                os << style->stroke_dash.dash[i];
            }
            os << "] " << style->stroke_dash.offset << "
setdash\n";
        } else {
            os << "[] 0 setdash\n";
        }
    } else {
        os << "[] 0 setdash\n";
    }

I guess the problem is that the outer most if statement
fails and then [] 0 setdash is written in the output (You
can see it if you look into the eps-File. E.g the export as
a PNG picture works fine with the same input SVG.