Win32: stroke dashes disappear in eps files

Bug #167002 reported by Bug Importer
0
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Unassigned

Bug Description

when recording in .eps and opening file in Illustrator,
stroke or minus dashes (this - , i prefer to show
because english is not my mother tongue and i'm not too
sure) have disappeared, and a large blank space have
replaced them.

inkscape 0.42, windows2000pro

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Works for me. Please attach a sample file.

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.

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

Okay, here is an update. I looked into this method again and
found the bug. It is located in the first while statement.
The i++ appears too early. Hope that I could help.

Best regards,

Christian

Here is the patch to correct this bug:

--- inkscape-0.43_old/src/extension/internal/ps.cpp
2005-10-20 06:43:21.000000000 +0200
+++ inkscape-0.43_new/src/extension/internal/ps.cpp
2006-02-23 16:05:22.000000000 +0100
@@ -692,9 +692,9 @@
         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;
+ i++;
         }
         if (!LineSolid) {
             os << "[";

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Thanks, good catch! Your fix is committed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.