add xschemrc variable "ps_paper_size" to specify custom paper sizes in ps/pdf exports

This commit is contained in:
stefan schippers 2023-07-12 08:10:00 +02:00
parent b646a0f79f
commit 83b1993c32
7 changed files with 19 additions and 19 deletions

View File

@ -958,27 +958,26 @@ static void fill_ps_colors()
}
#define A4
/* #define A4 */
void create_ps(char **psfile, int what)
{
double dx, dy, scale, scaley;
int landscape=1;
static int numpages = 0;
double margin=10; /* in postscript points, (1/72)". No need to add margin as xschem zoom full already has margins.*/
/* Letter: 612 792, A4: 595 842 */
#ifdef A4
double pagex=842;/* a4, in postscript points, (1/72)" */
double pagey=595;/* a4, in postscript points, (1/72)" */
#else /* Letter */
double pagex=792;/* Letter, in postscript points, (1/72)" */
double pagey=612;/* Letter, in postscript points, (1/72)" */
#endif
char papername[80] = "a4";
double pagex = 842;
double pagey = 595;
xRect boundbox;
int c,i, textlayer;
int old_grid;
const char *textfont;
if(tcleval("info exists ps_paper_size")[0] == '1') {
my_strncpy(papername, tcleval("lindex $ps_paper_size 0"), S(papername));
pagex = my_atod(tcleval("lindex $ps_paper_size 1"));
pagey = my_atod(tcleval("lindex $ps_paper_size 2"));
}
if(what & 1) { /* prolog */
numpages = 0;
if(!(fd = open_tmpfile("psplot_", psfile)) ) {
@ -1019,7 +1018,7 @@ void create_ps(char **psfile, int what)
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, "%%%%DocumentMedia: %s %g %g 80 () ()\n", landscape ? "a4land" : "a4", pagex, pagey); */
fprintf(fd, "%%%%DocumentMedia: %s %g %g 80 () ()\n", "a4", pagex, pagey);
fprintf(fd, "%%%%DocumentMedia: %s %g %g 80 () ()\n", papername, pagex, pagey);
fprintf(fd, "%%%%PageOrientation: %s\n", landscape ? "Landscape" : "Portrait");
fprintf(fd, "%%%%Title: xschem plot\n");
fprintf(fd, "%%%%Creator: xschem\n");

View File

@ -5491,7 +5491,7 @@ set tctx::global_list {
light_colors line_width live_cursor2_backannotate local_netlist_dir lvs_ignore
lvs_netlist measure_text netlist_dir netlist_show
netlist_type no_change_attrs nolist_libs noprint_libs old_selected_tok only_probes path pathlist
persistent_command preserve_unchanged_attrs prev_symbol ps_colors rainbow_colors
persistent_command preserve_unchanged_attrs prev_symbol ps_colors ps_paper_size rainbow_colors
rawfile_loaded rcode recentfile
replace_key retval retval_orig rotated_text search_exact search_found search_schematic
search_select search_value selected_tok show_hidden_texts show_infowindow
@ -6573,6 +6573,7 @@ set_ne split_files 0
set_ne flat_netlist 0
set_ne netlist_show 0
set_ne color_ps 1
set_ne ps_paper_size {a4 842 595}
set_ne transparent_svg 0
set_ne only_probes 0 ; # 20110112
set_ne fullscreen 0

View File

@ -98,8 +98,8 @@
#### If unset $USER_CONF_DIR/simulations is assumed (normally ~/.xschem/simulations)
# set netlist_dir $env(HOME)/.xschem/simulations
##### if this is set to '1' netlists and simulations will go into a simulation/ folder
##### inside the directory containing the top level schematic. Default: not set (0)
#### if this is set to '1' netlists and simulations will go into a simulation/ folder
#### inside the directory containing the top level schematic. Default: not set (0)
# set local_netlist_dir 1
###########################################################################
@ -149,6 +149,11 @@
#### allow color postscript and svg exports. Default: 1, enable color
# set color_ps 1
#### set paper size: name, height, width. Sizes in 1/72 of an inch (typographical points)
#### default: {a4 842 595}
# set ps_paper_size {a4 842 595}
# set ps_paper_size {letter 792 612}
#### initial size of xschem window you can specify also position with (wxh+x+y)
#### this is the default:
# set initial_geometry {900x600}
@ -370,7 +375,6 @@ set tcl_files {}
# lappend tcl_files ${XSCHEM_SHAREDIR}/change_index.tcl
# lappend tcl_files ....
###########################################################################
#### WEB URL DOWNLOAD HELPER APPLICATION
###########################################################################

View File

@ -18,7 +18,6 @@ xschem instance ../../../xschem_library/examples/tesla.sym 160 -230 0 0 {name=x2
xschem instance ../../../xschem_library/examples/test_ne555.sym 160 -190 0 0 {name=x3}
xschem instance ../../../xschem_library/examples/test_lm324.sym 160 -150 0 0 {name=x4}
xschem instance ../../../xschem_library/examples/osc.sym 160 -270 0 0 {name=x5}
xschem instance ../../../xschem_library/devices/title.sym 160 -30 0 0 {name=l1 author="Stefan Schippers"}
xschem instance ../../../xschem_library/examples/cmos_example.sym 160 -350 0 0 {name=x6}
xschem instance ../../../xschem_library/examples/greycnt.sym 160 -390 0 0 {name=x8}
xschem instance ../../../xschem_library/examples/loading.sym 160 -430 0 0 {name=x9}

View File

@ -23,7 +23,6 @@ xschem wire 520 -460 760 -460 {lab=A}
xschem wire 580 -420 760 -420 {lab=B}
xschem wire 580 -420 580 -350 {lab=B}
xschem wire 520 -350 580 -350 {lab=B}
xschem instance ../../../xschem_library/devices/title.sym 160 -30 0 0 {name=l2 author="Stefan"}
xschem instance ../../../xschem_library/pcb/74ls00.sym 420 -350 0 0 {name=U1:2 risedel=100 falldel=200}
xschem instance ../../../xschem_library/pcb/74ls00.sym 870 -440 0 0 {name=U1:1 risedel=100 falldel=200}
xschem instance ../../../xschem_library/devices/lab_pin.sym 970 -440 0 1 {name=p0 lab=OUTPUT_Y}

View File

@ -69,7 +69,6 @@ spiceprefix=X
m=1
url="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=2ahUKEwjs8pzxuozfAhWpz4UKHR4CDnMQFjAAegQIAhAC&url=https%3A%2F%2Fwww.infineon.com%2Fdgdl%2Firlml6402.pdf%3FfileId%3D5546d462533600a401535668c9822638&usg=AOvVaw21fCRax-ssVpLqDeGK8KiC"}
xschem instance ../../../xschem_library/devices/led.sym 650 -290 0 0 {name=x1 model=D1N5765 device=D1N5765 area=1 footprint=acy(300)}
xschem instance ../../../xschem_library/devices/title.sym 160 -30 0 0 {name=l2 author="Igor2"}
xschem instance ../../../xschem_library/devices/lab_pin.sym 170 -340 0 1 {name=p6 lab=VOUT}
xschem instance ../../../xschem_library/devices/lab_pin.sym 170 -360 0 1 {name=p7 lab=VSS}
xschem instance ../../../xschem_library/devices/lab_pin.sym 170 -380 0 1 {name=p8 lab=VCC}

View File

@ -39,7 +39,6 @@ xschem wire 1540 -350 1540 -330 {lab=vss}
xschem wire 1540 -530 1540 -510 {lab=vss}
xschem wire 1720 -180 1720 -160 {lab=vss}
xschem wire 1540 -180 1540 -160 {lab=vss}
xschem instance ../../../xschem_library/devices/title.sym 170 0 0 0 {name=l3 author="Stefan Schippers"}
xschem instance ../../../xschem_library/devices/code.sym 590 -160 0 0 {name=STIMULI value="
.options SCALE=0.10
.param VCC=1.5