From 7f0bf741984eaa0c14779127762b8c2a151248f9 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 17 Apr 2012 07:57:03 -0300 Subject: [PATCH] genex/pdf.c: generalized page geometry setup --- genex/pdf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/genex/pdf.c b/genex/pdf.c index 0600a39..884900f 100644 --- a/genex/pdf.c +++ b/genex/pdf.c @@ -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) {