diff --git a/src/globals.c b/src/globals.c index 4fd19317..ddee6a41 100644 --- a/src/globals.c +++ b/src/globals.c @@ -122,7 +122,6 @@ int change_lw=0; /* allow change lw */ int incr_hilight=1; unsigned short enable_stretch=0; int auto_hilight=0; -int a3page=-1; int has_x=1; int split_files=0; /* split netlist files 20081202 */ double cadgrid = CADGRID; @@ -186,6 +185,7 @@ int fill=1; /* filled rectangles */ int draw_pixmap=1; /* use pixmap for double buffer */ int draw_window=0; int text_svg=1; /* use svg element for text instead of xschem's internal vector font */ +int text_ps=1; /* use ps font for text instead of xschem's internal vector font */ double cadhalfdotsize = CADHALFDOTSIZE; unsigned int color_index[256]; /* layer color lookup table */ int max_undo=MAX_UNDO; diff --git a/src/options.c b/src/options.c index 98ca5b6c..d7a94b08 100644 --- a/src/options.c +++ b/src/options.c @@ -90,10 +90,6 @@ void check_opt(char *opt, char *optval, int type) dbg(1, "process_options(): set color postscript\n"); color_ps=1; - } else if( (type == SHORT && *opt == '3') || (type == LONG && !strcmp("a3page", opt)) ) { - dbg(1, "process_options(): set A3 page size\n"); - a3page=1; - } else if( (type == SHORT && *opt == 'i') || (type == LONG && !strcmp("no_rcload", opt)) ) { load_initfile=0; diff --git a/src/psprint.c b/src/psprint.c index db344287..0ba06185 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -33,20 +33,22 @@ typedef struct { } Ps_color; static Ps_color *ps_colors; +static char ps_font_name[80] = "Helvetica"; /* Courier Times Helvetica */ +static char ps_font_family[80] = "Helvetica"; /* Courier Times Helvetica */ -static void restore_lw(void) + +static void set_lw(void) { if(xctx->lw==0.0) - fprintf(fd, "%.16g setlinewidth\n",0.5); + fprintf(fd, "%g setlinewidth\n",0.5); else - if(a3page) fprintf(fd, "%.16g setlinewidth\n",xctx->lw/1.2/sqrt(2)); - else fprintf(fd, "%.16g setlinewidth\n",xctx->lw/1.2); + fprintf(fd, "%g setlinewidth\n",xctx->lw/1.2); } static void set_ps_colors(unsigned int pixel) { - if(color_ps) fprintf(fd, "%.16g %.16g %.16g setrgbcolor\n", + if(color_ps) fprintf(fd, "%g %g %g setrgbcolor\n", (double)ps_colors[pixel].red/256.0, (double)ps_colors[pixel].green/256.0, (double)ps_colors[pixel].blue/256.0); @@ -55,31 +57,29 @@ static void set_ps_colors(unsigned int pixel) static void ps_xdrawarc(int layer, int fillarc, double x, double y, double r, double a, double b) { if(fill && fillarc) - fprintf(fd, "%.16g %.16g %.16g %.16g %.16g AF\n", x, y, r, -a, -a-b); + fprintf(fd, "%g %g %g %g %g A %g %g LT C F S\n", x, y, r, -a, -a-b, x, y); else - fprintf(fd, "%.16g %.16g %.16g %.16g %.16g A\n", x, y, r, -a, -a-b); + fprintf(fd, "%g %g %g %g %g A S\n", x, y, r, -a, -a-b); } static void ps_xdrawline(int layer, double x1, double y1, double x2, double y2) { - fprintf(fd, "%.16g %.16g %.16g %.16g L\n", x2, y2, x1, y1); + fprintf(fd, "%.6g %.6g %.6g %.6g L\n", x2, y2, x1, y1); } static void ps_xdrawpoint(int layer, double x1, double y1) { - fprintf(fd, "%.16g %.16g %.16g %.16g L\n", x1, y1,x1,y1); + fprintf(fd, "%g %g %g %g L\n", x1, y1,x1,y1); } static void ps_xfillrectange(int layer, double x1, double y1, double x2, double y2) { - /*fprintf(fd, "%.16g %.16g moveto %.16g %.16g lineto %.16g %.16g lineto %.16g %.16g lineto closepath\n", */ - /* x1,y1,x2,y1,x2,y2,x1,y2); */ - fprintf(fd, "%.16g %.16g %.16g %.16g R\n", x1,y1,x2-x1,y2-y1); + fprintf(fd, "%g %g %g %g R\n", x1,y1,x2-x1,y2-y1); if( (layer==4 || layer==PINLAYER || layer==WIRELAYER) && fill) { - fprintf(fd, "%.16g %.16g %.16g %.16g RF\n", x1,y1,x2-x1,y2-y1); + fprintf(fd, "%g %g %g %g RF\n", x1,y1,x2-x1,y2-y1); /* fprintf(fd,"fill\n"); */ } /*fprintf(fd,"stroke\n"); */ @@ -109,13 +109,13 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in for(i=0;imooz); + fprintf(fd, "SF\n"); + fprintf(fd, "GS\n"); + fprintf(fd, "NP\n"); + fprintf(fd, "%g %g MT\n", ix, iy); + if(rot1) fprintf(fd, "%d rotate\n", rot1*90); + fprintf(fd, "1 -1 scale\n"); + fprintf(fd, "(%s)\n", s); + + if (rot==1 && flip==0) {fprintf(fd, "dup SW pop neg 0 RMT\n");} + else if(rot==2 && flip==0) {fprintf(fd, "dup SW pop neg 0 RMT\n");} + else if(rot==0 && flip==1) {fprintf(fd, "dup SW pop neg 0 RMT\n");} + else if(rot==3 && flip==1) {fprintf(fd, "dup SW pop neg 0 RMT\n");} + + fprintf(fd, "show\n"); + fprintf(fd, "GR\n"); +} + + + +static void ps_draw_string(int layer, const char *str, short rot, short flip, int hcenter, int vcenter, + double x,double y, double xscale, double yscale) +{ + char *tt, *ss, *sss=NULL; + double textx1,textx2,texty1,texty2; + char c; + int lineno=0; + double size, height, ascent, descent; + int llength=0; + if(str==NULL || !has_x ) return; + size = xscale*53.; + height = size*xctx->mooz * 1.147; /* was 1.147 */ + ascent = size*xctx->mooz * 0.808; /* was 0.908 */ + descent = size*xctx->mooz * 0.219; /* was 0.219 */ + + text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x,y, &textx1,&texty1,&textx2,&texty2); + /* fprintf(fd, "%% text bbox: %g %g\n", xctx->mooz * (textx2 - textx1), xctx->mooz * (texty2 - texty1)); */ + if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) { + return; + } + if(hcenter) { + if(rot == 0 && flip == 0 ) { x=textx1;} + if(rot == 1 && flip == 0 ) { y=texty1;} + if(rot == 2 && flip == 0 ) { x=textx2;} + if(rot == 3 && flip == 0 ) { y=texty2;} + if(rot == 0 && flip == 1 ) { x=textx2;} + if(rot == 1 && flip == 1 ) { y=texty2;} + if(rot == 2 && flip == 1 ) { x=textx1;} + if(rot == 3 && flip == 1 ) { y=texty1;} + } + if(vcenter) { + if(rot == 0 && flip == 0 ) { y=texty1;} + if(rot == 1 && flip == 0 ) { x=textx2;} + if(rot == 2 && flip == 0 ) { y=texty2;} + if(rot == 3 && flip == 0 ) { x=textx1;} + if(rot == 0 && flip == 1 ) { y=texty1;} + if(rot == 1 && flip == 1 ) { x=textx2;} + if(rot == 2 && flip == 1 ) { y=texty2;} + if(rot == 3 && flip == 1 ) { x=textx1;} + } + llength=0; + my_strdup2(465, &sss, str); + tt=ss=sss; + for(;;) { + c=*ss; + if(c=='\n' || c==0) { + *ss='\0'; + ps_draw_string_line(layer, tt, x, y, size, rot, flip, lineno, height, ascent, descent, llength); + lineno++; + if(c==0) break; + *ss='\n'; + tt=ss+1; + llength=0; + } else { + llength++; + } + ss++; + } + my_free(1154, &sss); +} + +static void old_ps_draw_string(int gctext, const char *str, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double xscale, double yscale) @@ -250,7 +363,6 @@ static void ps_draw_string(int gctext, const char *str, } } - static void ps_drawgrid() { double x,y; @@ -293,6 +405,8 @@ static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xo xText text; xArc arc; xPoly polygon; + xSymbol *symptr; + char *textfont; if(xctx->inst[n].ptr == -1) return; if( (layer != PINLAYER && !enable_layer[layer]) ) return; @@ -324,6 +438,7 @@ static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xo x0=xctx->inst[n].x0 + xoffset; y0=xctx->inst[n].y0 + yoffset; + symptr = (xctx->inst[n].ptr+ xctx->sym); for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->lines[layer];j++) { line = ((xctx->inst[n].ptr+ xctx->sym)->line[layer])[j]; @@ -387,14 +502,35 @@ static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xo textlayer = (xctx->inst[n].ptr+ xctx->sym)->text[j].layer; if(textlayer < 0 || textlayer >= cadlayers) textlayer = layer; } + + my_snprintf(ps_font_family, S(ps_font_name), "Helvetica"); + my_snprintf(ps_font_name, S(ps_font_name), "Helvetica"); + textfont = symptr->text[j].font; + if( (textfont && textfont[0])) { + my_snprintf(ps_font_family, S(ps_font_family), textfont); + my_snprintf(ps_font_name, S(ps_font_name), textfont); + } + if( symptr->text[j].flags & TEXT_BOLD) + my_snprintf(ps_font_family, S(ps_font_family), "%s-Bold", ps_font_name); + if( symptr->text[j].flags & TEXT_ITALIC) + my_snprintf(ps_font_family, S(ps_font_family), "%s-Oblique", ps_font_name); + if( symptr->text[j].flags & TEXT_OBLIQUE) + my_snprintf(ps_font_family, S(ps_font_family), "%s-Oblique", ps_font_name); + if((layer == PINLAYER && xctx->inst[n].flags & 4) || enable_layer[textlayer]) { - ps_draw_string(textlayer, txtptr, - (text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3, - flip^text.flip, text.hcenter, text.vcenter, - x0+x1, y0+y1, text.xscale, text.yscale); + if(text_ps) { + ps_draw_string(textlayer, txtptr, + (text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3, + flip^text.flip, text.hcenter, text.vcenter, + x0+x1, y0+y1, text.xscale, text.yscale); + } else { + old_ps_draw_string(textlayer, txtptr, + (text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3, + flip^text.flip, text.hcenter, text.vcenter, + x0+x1, y0+y1, text.xscale, text.yscale); + } } } - restore_lw(); } Tcl_SetResult(interp,"",TCL_STATIC); @@ -419,26 +555,34 @@ static void fill_ps_colors() } - void ps_draw(void) { double dx, dy, scale; + double margin=20; /* in postscript points, (1/72)" */ + xRect boundbox; int c,i, textlayer; - char *tmp=NULL; + char tmp[2*PATH_MAX+40]; int old_grid; int modified_save; - const char *r; + const char *r, *textfont; + char *psfile; if(!plotfile[0]) { - my_strdup(59, &tmp, "tk_getSaveFile -title {Select destination file} -initialdir [pwd]"); + my_snprintf(tmp, S(tmp), "tk_getSaveFile -title {Select destination file} -initialdir [pwd]"); tcleval(tmp); - my_free(878, &tmp); r = tclresult(); if(r[0]) my_strncpy(plotfile, r, S(plotfile)); else { return; } } + + + if(!(fd = open_tmpfile("psplot_", &psfile)) ) { + fprintf(errfp, "ps_draw(): can not create tmpfile %s\n", psfile); + return; + } + modified_save=xctx->modified; push_undo(); trim_wires(); /* 20161121 add connection boxes on wires but undo at end */ @@ -451,11 +595,18 @@ void ps_draw(void) old_grid=draw_grid; draw_grid=0; - dx=xctx->areax2-xctx->areax1; - dy=xctx->areay2-xctx->areay1; - dbg(1, "ps_draw(): dx=%.16g dy=%.16g\n", dx, dy); + calc_drawing_bbox(&boundbox, 0); - fd=fopen("plot.ps", "w"); + + boundbox.x1 = X_TO_PS(boundbox.x1); + boundbox.x2 = X_TO_PS(boundbox.x2); + boundbox.y1 = Y_TO_PS(boundbox.y1); + boundbox.y2 = Y_TO_PS(boundbox.y2); + + + dx=boundbox.x2-boundbox.x1; + dy=boundbox.y2-boundbox.y1; + dbg(1, "ps_draw(): bbox: x1=%g y1=%g x2=%g y2=%g\n", boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); fprintf(fd, "%%!PS-Adobe-3.0\n"); fprintf(fd, "%s\n", "%%DocumentMedia: a4land 842 595 80 () ()"); fprintf(fd, "%%%%Orientation: Portrait\n"); @@ -467,10 +618,21 @@ void ps_draw(void) fprintf(fd,"/cm {28.346457 mul} bind def\n"); fprintf(fd,"/LT {lineto} bind def\n"); fprintf(fd,"/MT {moveto} bind def\n"); + fprintf(fd,"/RMT {rmoveto} bind def\n"); fprintf(fd,"/L {moveto lineto stroke} bind def\n"); - fprintf(fd,"/A {arcn stroke} bind def\n"); - fprintf(fd,"/AF {arcn fill stroke} bind def\n"); + fprintf(fd,"/RGB {setrgbcolor} bind def\n"); + fprintf(fd,"/FF {findfont} bind def\n"); + fprintf(fd,"/SF {setfont} bind def\n"); + fprintf(fd,"/SCF {scalefont} bind def\n"); + fprintf(fd,"/SW {stringwidth} bind def\n"); + fprintf(fd,"/GS {gsave} bind def\n"); + fprintf(fd,"/GR {grestore} bind def\n"); + fprintf(fd,"/NP {newpath} bind def\n"); + fprintf(fd,"/A {arcn} bind def\n"); fprintf(fd,"/R {rectstroke} bind def\n"); + fprintf(fd,"/S {stroke} bind def\n"); + fprintf(fd,"/C {closepath} bind def\n"); + fprintf(fd,"/F {fill} bind def\n"); fprintf(fd,"/RF {rectfill} bind def\n"); fprintf(fd, "%%%%EndProlog\n"); fprintf(fd, "%%%%BeginSetup\n"); @@ -478,29 +640,46 @@ void ps_draw(void) fprintf(fd, "%%%%Page: 1 1\n\n"); fprintf(fd, "%%%%BeginPageSetup\n"); fprintf(fd, "%%%%EndPageSetup\n"); - fprintf(fd, "0 595 translate\n"); - - scale = 595.0 / xctx->areah; - if(xctx->areaw * scale > 842.0) scale = 842.0 / xctx->areaw; + scale = (595.0-2 * margin) / dy; + if(dx * scale > (842.0 - 2 * margin)) scale = (842.0 - 2 * margin) / dx; + fprintf(fd, "%g %g translate\n", -scale * boundbox.x1 + margin, 595 - margin + scale * boundbox.y1); fprintf(fd, "%g %g scale\n", scale, -scale); - - fprintf(fd, "1 setlinejoin 1 setlinecap\n"); - restore_lw(); + set_lw(); ps_drawgrid(); - for(i=0;itexts;i++) { textlayer = xctx->text[i].layer; if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER; - ps_draw_string(textlayer, xctx->text[i].txt_ptr, - xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter, - xctx->text[i].x0,xctx->text[i].y0, - xctx->text[i].xscale, xctx->text[i].yscale); + + my_snprintf(ps_font_family, S(ps_font_name), "Helvetica"); + my_snprintf(ps_font_name, S(ps_font_name), "Helvetica"); + textfont = xctx->text[i].font; + if( (textfont && textfont[0])) { + my_snprintf(ps_font_family, S(ps_font_family), textfont); + my_snprintf(ps_font_name, S(ps_font_name), textfont); + } + if( xctx->text[i].flags & TEXT_BOLD) + my_snprintf(ps_font_family, S(ps_font_family), "%s-Bold", ps_font_name); + if( xctx->text[i].flags & TEXT_ITALIC) + my_snprintf(ps_font_family, S(ps_font_family), "%s-Oblique", ps_font_name); + if( xctx->text[i].flags & TEXT_OBLIQUE) + my_snprintf(ps_font_family, S(ps_font_family), "%s-Oblique", ps_font_name); + + if(text_ps) { + ps_draw_string(textlayer, xctx->text[i].txt_ptr, + xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter, + xctx->text[i].x0,xctx->text[i].y0, + xctx->text[i].xscale, xctx->text[i].yscale); + } else { + old_ps_draw_string(textlayer, xctx->text[i].txt_ptr, + xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter, + xctx->text[i].x0,xctx->text[i].y0, + xctx->text[i].xscale, xctx->text[i].yscale); + } } - restore_lw(); for(c=0;cmodified=modified_save; } diff --git a/src/save.c b/src/save.c index 6e50bc3d..b2bbca2d 100644 --- a/src/save.c +++ b/src/save.c @@ -135,8 +135,8 @@ const char *create_tmpdir(char *prefix) /* */ -/* try to create a tmp file in $HOME */ -/* ${HOME}/ */ +/* try to create a tmp file in $XSCHEM_TMP_DIR */ +/* ${XSCHEM_TMP_DIR}/ */ /* after 5 unsuccessfull attemps give up */ /* and return NULL */ /* */ diff --git a/src/scheduler.c b/src/scheduler.c index 9912b876..e49e21de 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -500,13 +500,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg else if(!strcmp(argv[1],"get") && argc==3) { cmd_found = 1; - if(!strcmp(argv[2],"a3page")) { - if( a3page != 0 ) - Tcl_SetResult(interp, "1",TCL_STATIC); - else - Tcl_SetResult(interp, "0",TCL_STATIC); - } - else if(!strcmp(argv[2],"auto_hilight")) { + if(!strcmp(argv[2],"auto_hilight")) { if( auto_hilight != 0 ) Tcl_SetResult(interp, "1",TCL_STATIC); else @@ -903,7 +897,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } printf("modified=%d\n", xctx->modified); printf("color_ps=%d\n", color_ps); - printf("a3page=%d\n", a3page); printf("hilight_nets=%d\n", xctx->hilight_nets); printf("need_reb_sel_arr=%d\n", xctx->need_reb_sel_arr); printf("******* end global variables:*******\n"); @@ -2139,9 +2132,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg else if(!strcmp(argv[2],"enable_stretch")) { enable_stretch=atoi(argv[3]); } - else if(!strcmp(argv[2],"a3page")) { - a3page=atoi(argv[3]); - } else if(!strcmp(argv[2],"color_ps")) { color_ps=atoi(argv[3]); } diff --git a/src/svgdraw.c b/src/svgdraw.c index 38f0d6fc..684051e7 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -161,13 +161,16 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a fprintf(fd,"zoom, 1.4*dash/xctx->zoom); - if(!fillarc) fprintf(fd,"style=\"fill:none;\" "); - fprintf(fd, "d=\"M%g %g A%g %g 0 %d %d %g %g\"/>\n", xx1, yy1, rr, rr, fa, fs, xx2, yy2); + if(!fillarc) { + fprintf(fd,"style=\"fill:none;\" "); + fprintf(fd, "d=\"M%g %g A%g %g 0 %d %d %g %g\"/>\n", xx1, yy1, rr, rr, fa, fs, xx2, yy2); + } else { + fprintf(fd, "d=\"M%g %g A%g %g 0 %d %d %g %gL%g %gz\"/>\n", xx1, yy1, rr, rr, fa, fs, xx2, yy2, xx, yy); + } } } } - static void svg_drawline(int gc, int bus, double linex1,double liney1,double linex2,double liney2, int dash) { double x1,y1,x2,y2; @@ -182,8 +185,6 @@ static void svg_drawline(int gc, int bus, double linex1,double liney1,double lin } } -static double textx1,textx2,texty1,texty2; - static void svg_draw_string_line(int layer, char *s, double x, double y, double size, short rot, short flip, int lineno, double fontheight, double fontascent, double fontdescent, int llength) { @@ -193,8 +194,13 @@ static void svg_draw_string_line(int layer, char *s, double x, double y, double int line_offset; double lines; char col[20]; - my_snprintf(col, S(col), "#%02x%02x%02x", - xcolor_array[layer].red >> 8, xcolor_array[layer].green >> 8, xcolor_array[layer].blue >> 8); + if(color_ps) + my_snprintf(col, S(col), "#%02x%02x%02x", + xcolor_array[layer].red >> 8, xcolor_array[layer].green >> 8, xcolor_array[layer].blue >> 8); + else if(dark_colorscheme) + my_snprintf(col, S(col), "#%02x%02x%02x", 255, 255, 255); + else + my_snprintf(col, S(col), "#%02x%02x%02x", 0, 0, 0); if(s==NULL) return; if(llength==0) return; @@ -247,6 +253,7 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i double x,double y, double xscale, double yscale) { char *tt, *ss, *sss=NULL; + double textx1,textx2,texty1,texty2; char c; int lineno=0; double size, height, ascent, descent; diff --git a/src/xinit.c b/src/xinit.c index ba47e9cb..97ec9ed0 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1335,12 +1335,6 @@ int Tcl_AppInit(Tcl_Interp *inter) if(change_lw == 1) l_width = 0.0; draw_window=atoi(tclgetvar("draw_window")); incr_hilight=atoi(tclgetvar("incr_hilight")); - if(a3page==-1) - a3page=atoi(tclgetvar("a3page")); - else { - my_snprintf(tmp, S(tmp), "%d",a3page); - tclsetvar("a3page",tmp); - } enable_stretch=atoi(tclgetvar("enable_stretch")); big_grid_points=atoi(tclgetvar("big_grid_points")); draw_grid=atoi(tclgetvar("draw_grid")); diff --git a/src/xschem.h b/src/xschem.h index 1bc2b77b..30b5d07e 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -664,7 +664,6 @@ struct instentry { extern Xschem_ctx *xctx; extern int help; extern char *cad_icon[]; -extern int a3page; extern int manhattan_lines; extern int cadlayers; extern int *active_layer; @@ -701,6 +700,7 @@ extern int fill; /* fill rectangles */ extern int draw_grid; extern int big_grid_points; extern int text_svg; +extern int text_ps; extern double cadgrid; extern double cadhalfdotsize; extern int draw_pixmap; /* pixmap used as 2nd buffer */ diff --git a/src/xschem.tcl b/src/xschem.tcl index 7e386cca..59e7d02c 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -167,16 +167,20 @@ proc netlist {source_file show netlist_file} { # 20161121 proc convert_to_pdf {filename dest} { - global a3page - if { $a3page == 1 } { set paper a3 } else { set paper a4 } - if { ![catch "exec ps2pdf -sPAPERSIZE=$paper $filename" msg] } { - # ps2pdf succeeded, so remove original .ps file - file rename -force [file rootname $filename].pdf $dest - if { ![xschem get debug_var] } { - file delete $filename + # puts "convert_to_pdf: $filename --> $dest" + if { [regexp -nocase {\.pdf$} $dest] } { + set pdffile [file rootname $filename].pdf] + if { ![catch "exec ps2pdf $filename $pdffile" msg] } { + file rename -force $pdffile $dest + # ps2pdf succeeded, so remove original .ps file + if { ![xschem get debug_var] } { + file delete $filename + } + } else { + puts stderr "problems converting postscript to pdf: $msg" } } else { - puts stderr "problems converting postscript to pdf: $msg" + file rename -force $filename $dest } } @@ -3413,7 +3417,6 @@ set_ne netlist_type vhdl set_ne netlist_show 0 set_ne color_ps 0 set_ne only_probes 0 ; # 20110112 -set_ne a3page 0 set_ne fullscreen 0 set_ne unzoom_nodrift 1 set_ne change_lw 1 @@ -3478,8 +3481,8 @@ set_ne cairo_vert_correct 0 set_ne nocairo_vert_correct 0 # Arial, Monospace -set_ne cairo_font_name {Sans Serif} -set_ne svg_font_name {Sans Serif} +set_ne cairo_font_name {Helvetica} +set_ne svg_font_name {Helvetica} # has_cairo set by c program if cairo enabled set has_cairo 0 @@ -3686,7 +3689,7 @@ if { ( $::OS== "Windows" || [string length [lindex [array get env DISPLAY] 1] ] .menubar.file.menu add command -label "Save as symbol" \ -command "xschem saveas {} SYMBOL" -accelerator {Ctrl+Alt+S} # added svg, png 20171022 - .menubar.file.menu add command -label "PDF Export" -command "xschem print pdf" -accelerator {*} + .menubar.file.menu add command -label "PDF/PS Export" -command "xschem print pdf" -accelerator {*} .menubar.file.menu add command -label "PNG Export" -command "xschem print png" -accelerator {Ctrl+*} .menubar.file.menu add command -label "SVG Export" -command "xschem print svg" -accelerator {Alt+*} .menubar.file.menu add separator @@ -3696,10 +3699,6 @@ if { ( $::OS== "Windows" || [string length [lindex [array get env DISPLAY] 1] ] -command { if { $color_ps==1 } {xschem set color_ps 1} else { xschem set color_ps 0} } - .menubar.option.menu add checkbutton -label "A3 page" -variable a3page \ - -command { - if { $a3page==1 } {xschem set a3page 1} else { xschem set a3page 0} - } .menubar.option.menu add checkbutton -label "Debug mode" -variable menu_tcl_debug \ -command { if { $menu_tcl_debug==1 } {xschem debug 1} else { xschem debug 0} diff --git a/xschem_library/examples/mos_power_ampli.sch b/xschem_library/examples/mos_power_ampli.sch index 5a2d2e4b..68c3db58 100644 --- a/xschem_library/examples/mos_power_ampli.sch +++ b/xschem_library/examples/mos_power_ampli.sch @@ -9,7 +9,7 @@ E {} L 15 270 -460 340 -390 {} L 15 270 -330 340 -390 {} T {ANALOG AUDIO AMPLIFIER -N-Channel only power stage} 430 -270 0 0 0.5 0.5 {layer=8 font="Liberation Sans"} +N-Channel only power stage} 430 -270 0 0 0.5 0.5 {layer=8} N 180 -500 180 -470 {lab=E9} N 260 -470 340 -470 {lab=E9} N 340 -500 340 -470 {lab=E9}