summaryrefslogtreecommitdiffstats
path: root/term_ps.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-29 14:53:14 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-29 14:53:14 +0000
commit0e40689d4c03ea1b190df62d254677c1a81b56c2 (patch)
tree324848149cb2833182a20ba79fff946062152307 /term_ps.c
parent8842837488a4e122906083111d6152cb80757ea5 (diff)
downloadmandoc-0e40689d4c03ea1b190df62d254677c1a81b56c2.tar.gz
Add in -Opaper=xxx support for -Tps postscript. This doesn't have any
functional changes beyond the getsubopt() parse in term_ps.c. If you want to test this (it only does -Opaper=a4 and -Opaper=letter; adding more is trivial), make sure you specify (e.g.) -sPAPERSIZE=a4 to gs(1).
Diffstat (limited to 'term_ps.c')
-rw-r--r--term_ps.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/term_ps.c b/term_ps.c
index a7ed2e05..15ee7af5 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -22,6 +22,7 @@
#include <assert.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -373,14 +374,17 @@ static void ps_setfont(struct termp *, enum termfont);
void *
-ps_alloc(void)
+ps_alloc(char *outopts)
{
struct termp *p;
size_t pagex, pagey, margin;
+ const char *toks[2];
+ char *v;
if (NULL == (p = term_alloc(TERMENC_ASCII)))
return(NULL);
+ /* Default is USA letter. */
pagex = 612;
pagey = 792;
margin = 72;
@@ -393,6 +397,24 @@ ps_alloc(void)
p->endline = ps_endline;
p->width = ps_width;
+ toks[0] = "paper";
+ toks[1] = NULL;
+
+ while (outopts && *outopts)
+ switch (getsubopt(&outopts, UNCONST(toks), &v)) {
+ case (0):
+ if (0 == strcasecmp(v, "a4")) {
+ pagex = 595;
+ pagey = 842;
+ } else if (0 == strcasecmp(v, "letter")) {
+ pagex = 612;
+ pagey = 792;
+ }
+ break;
+ default:
+ break;
+ }
+
assert(margin * 2 < pagex);
assert(margin * 2 < pagey);