=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/term_ps.c,v retrieving revision 1.21 retrieving revision 1.22 diff -c -r1.21 -r1.22 *** src/usr.bin/mandoc/term_ps.c 2014/03/21 22:17:01 1.21 --- src/usr.bin/mandoc/term_ps.c 2014/03/30 19:47:32 1.22 *************** *** 1,6 **** ! /* $Id: term_ps.c,v 1.21 2014/03/21 22:17:01 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above --- 1,7 ---- ! /* $Id: term_ps.c,v 1.22 2014/03/30 19:47:32 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons + * Copyright (c) 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above *************** *** 71,76 **** --- 72,78 ---- 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) */ *************** *** 97,102 **** --- 99,105 ---- 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); *************** *** 442,447 **** --- 445,451 ---- p->endline = ps_endline; p->hspan = ps_hspan; p->letter = ps_letter; + p->setwidth = ps_setwidth; p->width = ps_width; toks[0] = "paper"; *************** *** 510,516 **** lineheight = PNT2AFM(p, ((double)p->ps->scale * 1.4)); ! p->ps->width = (size_t)pagex; p->ps->height = (size_t)pagey; p->ps->header = pagey - (marginy / 2) - (lineheight / 2); p->ps->top = pagey - marginy; --- 514,520 ---- lineheight = PNT2AFM(p, ((double)p->ps->scale * 1.4)); ! 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; *************** *** 521,526 **** --- 525,541 ---- p->defrmargin = pagex - (marginx * 2); return(p); + } + + + 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; }