[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: pstoedit patch fixing crash in Inkscape->pstoedit->pcb



On Mon, 22 Nov 2010 14:25:51 -0800
Colin D Bennett <colin@xxxxxxxxxxx> wrote:

> On Mon, 22 Nov 2010 15:25:49 -0600
> Mark Rages <markrages@xxxxxxxxx> wrote:
> 
> > I've seen this bug before too.  Try "text to path" in Inkscape.  If
> > that fails, binary search for the offending text: Delete half of it,
> > try again, etc.  Please do file the bug on pstoedit.
> 
> Workaround validated.  Thanks for the tip.

I have been in contact with Wolfgang Glunz, pstoedit maintainer, and
he's provided a couple of fixes which I've collected into the attached
patch, which is based against pstoedit 3.50.

To import text from Inkscape into pcb using this patched pstoedit
version, use the following process:

1. In Inkscape, save a copy of the drawing as PostScript.  I found
that text character spacing will be more precise in the pcb file output
if you check the box in the PostScript export dialog telling Inkscape to
convert texts to paths.

2. Run pstoedit to convert the PostScript file to a pcb file.  Use the
'-f pcbfill' option to select the filled-pcb output format and the
'-ssp' option to handle paths containing subpaths, which is produced
by Inkscape for the characters 'A', 'o', etc.

  pstoedit -f pcbfill -ssp INPUT.ps OUTPUT.pcb

3. Load the OUTPUT.pcb file into pcb.  It will initially be on the silk
layer but you can of course move it to any other layer.

Regards,
Colin
=== modified file 'src/drvpcb2.cpp'
--- src/drvpcb2.cpp	2010-11-23 22:00:56 +0000
+++ src/drvpcb2.cpp	2010-11-23 22:05:52 +0000
@@ -4,7 +4,7 @@
    Contributed / Copyright 2004 by: Mark Rages 
    Contributed / Copyright 2008 by: Stanislav Brabec sbrabec_AT_suse.cz
 
-   Copyright (C) 1993 - 2009 Wolfgang Glunz, wglunz34_AT_pstoedit.net
+   Copyright (C) 1993 - 2010 Wolfgang Glunz, wglunz34_AT_pstoedit.net
    (for the skeleton and the rest of pstoedit)
 
     This program is free software; you can redistribute it and/or modify
@@ -153,14 +153,11 @@
 
 			{
 				const Point & p0 = pathElement(0).getPoint(0);
-				const Point & pl = pathElement(numberOfElementsInPath()-1).getPoint(0);
-
+				numberofvalidelements = numberOfElementsInPath();
+				if (pathElement(numberofvalidelements-1).getType() == closepath ) numberofvalidelements--; // closepath can be ignored
+				const Point & pl = pathElement(numberofvalidelements-1).getPoint(0);
 				/* Polygons are closed automatically. Skip last element for already closed polygons. */
-				if (p0.x_ == pl.x_ && p0.y_ == pl.y_) {
-					numberofvalidelements = numberOfElementsInPath() - 1;
-				} else {
-					numberofvalidelements = numberOfElementsInPath();
-				}
+				if (p0.x_ == pl.x_ && p0.y_ == pl.y_) numberofvalidelements--;
 			}
 			/* If snap to grid fails for any of points draw into layer_polygons_nogrid layer */
 			round_success = true;

=== modified file 'src/drvpcbfill.cpp'
--- src/drvpcbfill.cpp	2010-11-23 22:00:56 +0000
+++ src/drvpcbfill.cpp	2010-11-24 20:19:24 +0000
@@ -3,7 +3,7 @@
    simple backend for Pcbfill format.
    Contributed / Copyright 2004 by: Mark Rages 
 
-   Copyright (C) 1993 - 2009 Wolfgang Glunz, wglunz35_AT_pstoedit.net
+   Copyright (C) 1993 - 2010 Wolfgang Glunz, wglunz35_AT_pstoedit.net
    (for the skeleton and the rest of pstoedit)
 
     This program is free software; you can redistribute it and/or modify
@@ -64,9 +64,11 @@
   outf << "\tPolygon(0x00000010)\n\t(\n\t\t";
 
 	for (unsigned int n = 0; n < numberOfElementsInPath(); n++) {
-		const Point & p = pathElement(n).getPoint(0);
-		outf << "[" << (int)(p.x_*SCALE) << " " 
+		if (pathElement(n).getType() != closepath) {
+			const Point & p = pathElement(n).getPoint(0);
+				outf << "[" << (int)(p.x_*SCALE) << " " 
                      << (int)(500000-p.y_*SCALE) << "] ";
+		}
 	}
   outf << "\n\t)\n";
 }


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user