1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 12:11:52 +02:00

genex/pdf.c: generalized page geometry setup

This commit is contained in:
Werner Almesberger 2012-04-17 07:57:03 -03:00
parent a553d5896c
commit 7f0bf74198

View File

@ -19,6 +19,9 @@
static struct format {
const char *file_setup;
const char *overlay_setup;
const char *comp_setup;
int left;
struct text {
const char *font;
@ -27,6 +30,9 @@ static struct format {
} name, path, lib, comment;
int comment_line_skip;
} format = {
.file_setup = "",
.overlay_setup = "90 rotate",
.comp_setup = "",
.left = 20,
.name = { "Helvetica-Bold", 24, 57 },
.path = { "Helvetica-Bold", 18, 30 },
@ -74,7 +80,7 @@ static void print_path(FILE *file, const struct node *node)
static void make_title(FILE *file, const struct node *node, int unit)
{
fprintf(file, "gsave 90 rotate 0 setgray\n");
fprintf(file, "gsave %s 0 setgray\n", format.overlay_setup);
fprintf(file, "/%s findfont %d scalefont setfont\n",
format.name.font, format.name.size);
@ -105,7 +111,7 @@ static void print_comment(FILE *file, const struct line *comment)
int lines = 0;
int n;
fprintf(file, "gsave 90 rotate 0 setgray\n");
fprintf(file, "gsave %s 0 setgray\n", format.overlay_setup);
fprintf(file, "/%s findfont %d scalefont setfont\n",
format.comment.font, format.comment.size);
for (line = comment; line; line = line->next)
@ -174,7 +180,9 @@ static void convert_comp(const struct node *node, FILE *out)
fprintf(stderr, "sym2xps returned %d\n", res);
exit(1);
}
fprintf(out, "gsave %s\n", format.comp_setup);
cat(out, "tmp.ps");
fprintf(out, "\ngrestore\n");
}
}
@ -209,6 +217,7 @@ void make_pdf(void)
perror("gs");
exit(1);
}
fprintf(out, "%%!PS\n%s\n", format.file_setup);
convert_tree(tree, out);
res = pclose(out);
if (res < 0) {