1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 15:04:36 +02:00

gencat/: delegate landscape/portrait setup to library-specific ps_entry

This is for the external Postscript. The overlay is still handled in
pdf.c
This commit is contained in:
Werner Almesberger 2012-07-12 02:41:42 -03:00
parent 7cbd51ee7b
commit c035def16e
4 changed files with 9 additions and 9 deletions

View File

@ -78,8 +78,10 @@ static void comp_add_lib(struct lib *lib, const char *path)
static void comp_ps_entry(FILE *file, const struct lib *lib, static void comp_ps_entry(FILE *file, const struct lib *lib,
const struct entry *e, int unit) const struct entry *e, int unit, int landscape)
{ {
if (!landscape)
fprintf(file, "-120 700 translate -90 rotate\n");
run_cmd("sym2xps '%s' '%s' %d '%s' '%s'", run_cmd("sym2xps '%s' '%s' %d '%s' '%s'",
e->file->path, e->names->s, unit+1, "tmp", "tmp.ps"); e->file->path, e->names->s, unit+1, "tmp", "tmp.ps");
cat(file, "tmp.ps"); cat(file, "tmp.ps");

View File

@ -45,11 +45,11 @@ static void fped_add_lib(struct lib *lib, const char *path)
static void fped_ps_entry(FILE *file, const struct lib *lib, static void fped_ps_entry(FILE *file, const struct lib *lib,
const struct entry *e, int unit) const struct entry *e, int unit, int landscape)
{ {
run_cmd("fped -P '%s' -1 '%s' '%s'", run_cmd("fped -P '%s' -1 '%s' '%s'",
e->file->path, e->names->s, "tmp.ps"); e->file->path, e->names->s, "tmp.ps");
run_cmd("sed -i -e '/^ /s/\\<div\\>/sdiv/' tmp.ps"); // run_cmd("sed -i -e '/^ /s/\\<div\\>/sdiv/' tmp.ps");
cat(file, "tmp.ps"); cat(file, "tmp.ps");
} }

View File

@ -35,7 +35,7 @@ struct lib {
const char *ext; /* file extension, ".lib" or ".fpd" */ const char *ext; /* file extension, ".lib" or ".fpd" */
void (*add_lib)(struct lib *lib, const char *path); void (*add_lib)(struct lib *lib, const char *path);
void (*ps_entry)(FILE *file, const struct lib *lib, void (*ps_entry)(FILE *file, const struct lib *lib,
const struct entry *e, int unit); const struct entry *e, int unit, int landscape);
struct file *files; struct file *files;
}; };

View File

@ -23,7 +23,6 @@
static struct format { static struct format {
const char *file_setup; const char *file_setup;
const char *overlay_setup; const char *overlay_setup;
const char *comp_setup;
int left; int left;
struct text { struct text {
const char *font; const char *font;
@ -38,7 +37,6 @@ static struct format {
} landscape = { } landscape = {
.file_setup = "%%Orientation: Landscape", .file_setup = "%%Orientation: Landscape",
.overlay_setup = "90 rotate", .overlay_setup = "90 rotate",
.comp_setup = "",
.left = 20, .left = 20,
.name = { "Helvetica-Bold", 24, 57 }, .name = { "Helvetica-Bold", 24, 57 },
.path = { "Helvetica-Bold", 18, 30 }, .path = { "Helvetica-Bold", 18, 30 },
@ -53,7 +51,6 @@ static struct format {
}, portrait = { }, portrait = {
.file_setup = "%%Orientation: Portrait", .file_setup = "%%Orientation: Portrait",
.overlay_setup = "0 790 translate", .overlay_setup = "0 790 translate",
.comp_setup = "-120 700 translate -90 rotate",
.left = 20, .left = 20,
.name = { "Helvetica-Bold", 24, 57 }, .name = { "Helvetica-Bold", 24, 57 },
.path = { "Helvetica-Bold", 18, 30 }, .path = { "Helvetica-Bold", 18, 30 },
@ -281,8 +278,9 @@ static void convert_comp(const struct node *node, FILE *out)
make_title(out, node, i); make_title(out, node, i);
if (!i && node->comment) if (!i && node->comment)
print_comment(out, node->comment); print_comment(out, node->comment);
fprintf(out, "gsave %s\n", format->comp_setup); fprintf(out, "gsave\n");
node->e->file->lib->ps_entry(out, lib, node->e, i); node->e->file->lib->ps_entry(out, lib, node->e, i,
format == &landscape);
fprintf(out, "\ngrestore\n"); fprintf(out, "\ngrestore\n");
} }
} }