aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ps.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-30 19:47:48 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-30 19:47:48 +0000
commitb1938d01834105572311aa9b06d667939309bee7 (patch)
tree9517f74166bc2092376ceb274bb4e8fdd03eb66c /term_ps.c
parent08b72b8f1a54d84a06924f40ca973826190c215b (diff)
downloadmandoc-b1938d01834105572311aa9b06d667939309bee7.tar.gz
mandoc-b1938d01834105572311aa9b06d667939309bee7.tar.zst
mandoc-b1938d01834105572311aa9b06d667939309bee7.zip
Implement the roff(7) .ll (line length) request.
Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
Diffstat (limited to 'term_ps.c')
-rw-r--r--term_ps.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/term_ps.c b/term_ps.c
index c8010591..9e0743a0 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -1,6 +1,7 @@
-/* $Id: term_ps.c,v 1.56 2014/03/23 11:25:26 schwarze Exp $ */
+/* $Id: term_ps.c,v 1.57 2014/03/30 19:47:48 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -75,6 +76,7 @@ struct termp_ps {
size_t bottom; /* body bottom (AFM units) */
size_t height; /* page height (AFM units */
size_t width; /* page width (AFM units) */
+ size_t lastwidth; /* page width before last ll */
size_t left; /* body left (AFM units) */
size_t header; /* header pos (AFM units) */
size_t footer; /* footer pos (AFM units) */
@@ -104,6 +106,7 @@ __attribute__((__format__ (__printf__, 2, 3)))
static void ps_printf(struct termp *, const char *, ...);
static void ps_putchar(struct termp *, char);
static void ps_setfont(struct termp *, enum termfont);
+static void ps_setwidth(struct termp *, size_t);
static struct termp *pspdf_alloc(char *);
static void pdf_obj(struct termp *, size_t);
@@ -449,6 +452,7 @@ pspdf_alloc(char *outopts)
p->endline = ps_endline;
p->hspan = ps_hspan;
p->letter = ps_letter;
+ p->setwidth = ps_setwidth;
p->width = ps_width;
toks[0] = "paper";
@@ -517,7 +521,7 @@ pspdf_alloc(char *outopts)
lineheight = PNT2AFM(p, ((double)p->ps->scale * 1.4));
- p->ps->width = (size_t)pagex;
+ p->ps->width = p->ps->lastwidth = (size_t)pagex;
p->ps->height = (size_t)pagey;
p->ps->header = pagey - (marginy / 2) - (lineheight / 2);
p->ps->top = pagey - marginy;
@@ -531,6 +535,17 @@ pspdf_alloc(char *outopts)
}
+static void
+ps_setwidth(struct termp *p, size_t width)
+{
+ size_t lastwidth;
+
+ lastwidth = p->ps->width;
+ p->ps->width = width ? width : p->ps->lastwidth;
+ p->ps->lastwidth = lastwidth;
+}
+
+
void
pspdf_free(void *arg)
{