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

Re: gEDA-user: gschem: problems with generated postscript



On Saturday 17 September 2005 18:53, Mark Rages wrote:
> On 9/17/05, Werner Hoch <werner.ho@xxxxxx> wrote:
> > On Saturday 17 September 2005 08:35, Karel Kulhavy wrote:
> > > A4 page size is 210x297mm. However when I generate colour
> > > schematic,
> >
> > A4 size is defined in the gschemrc file as (11.69,8.27) inches.
> > Multiplied with 25.38 mm/inch it is (296.69,209.89) mm.
>
> 25.38?
>
> http://www.google.com/search?q=inch+in+mm

Urgs, your right. I'm curious about myself.
11.69 inch should be representaded as 11.69*72 pt/inch = 841.68 pt in 
the postscript file.

The problem is truncation (typecast) of a value in libgeda f_print.c (or 
f_print.nw).

---- correct ps section ----------
0 0 0 setrgbcolor
0 0 moveto
595.440000 0 rlineto 0 841.680000 rlineto -595.440000 0 rlineto
closepath fill
-------------------------------------
patch attached.

Regards
Werner
Index: noweb/f_print.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/f_print.nw,v
retrieving revision 1.13
diff -u -r1.13 f_print.nw
--- noweb/f_print.nw	20 Apr 2005 15:50:16 -0000	1.13
+++ noweb/f_print.nw	18 Sep 2005 17:09:18 -0000
@@ -271,13 +271,13 @@
     fprintf(fp, "\n");	
     f_print_set_color(fp, w_current->print_color_background);
     if (w_current->print_orientation == LANDSCAPE) {
-       fprintf(fp, "0 0 moveto\n%d 0 rlineto 0 %d rlineto -%d 0 rlineto\n",
- 	       paper_size_y*72/1000, paper_size_x*72/1000, 
-	       paper_size_y*72/1000);
+       fprintf(fp, "0 0 moveto\n%f 0 rlineto 0 %f rlineto -%f 0 rlineto\n",
+ 	       paper_size_y*72/1000.0, paper_size_x*72/1000.0, 
+	       paper_size_y*72/1000.0);
     } else {
-       fprintf(fp, "0 0 moveto\n%d 0 rlineto 0 %d rlineto -%d 0 rlineto\n",
- 	       paper_size_x*72/1000, paper_size_y*72/1000, 
-	       paper_size_x*72/1000);
+       fprintf(fp, "0 0 moveto\n%f 0 rlineto 0 %f rlineto -%f 0 rlineto\n",
+ 	       paper_size_x*72/1000.0, paper_size_y*72/1000.0, 
+	       paper_size_x*72/1000.0);
    }
     fprintf(fp, "closepath fill\n");
   }