=================================================================== RCS file: /cvs/mandoc/term_ps.c,v retrieving revision 1.67 retrieving revision 1.69 diff -u -p -r1.67 -r1.69 --- mandoc/term_ps.c 2014/10/27 20:41:58 1.67 +++ mandoc/term_ps.c 2014/11/20 13:56:20 1.69 @@ -1,4 +1,4 @@ -/* $Id: term_ps.c,v 1.67 2014/10/27 20:41:58 schwarze Exp $ */ +/* $Id: term_ps.c,v 1.69 2014/11/20 13:56:20 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -106,7 +106,7 @@ 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 *, int, size_t); -static struct termp *pspdf_alloc(char *); +static struct termp *pspdf_alloc(const struct mchars *, char *); static void pdf_obj(struct termp *, size_t); /* @@ -507,29 +507,29 @@ static const struct font fonts[TERMFONT__MAX] = { }; void * -pdf_alloc(char *outopts) +pdf_alloc(const struct mchars *mchars, char *outopts) { struct termp *p; - if (NULL != (p = pspdf_alloc(outopts))) + if (NULL != (p = pspdf_alloc(mchars, outopts))) p->type = TERMTYPE_PDF; return(p); } void * -ps_alloc(char *outopts) +ps_alloc(const struct mchars *mchars, char *outopts) { struct termp *p; - if (NULL != (p = pspdf_alloc(outopts))) + if (NULL != (p = pspdf_alloc(mchars, outopts))) p->type = TERMTYPE_PS; return(p); } static struct termp * -pspdf_alloc(char *outopts) +pspdf_alloc(const struct mchars *mchars, char *outopts) { struct termp *p; unsigned int pagex, pagey; @@ -539,6 +539,7 @@ pspdf_alloc(char *outopts) char *v; p = mandoc_calloc(1, sizeof(struct termp)); + p->symtab = mchars; p->enc = TERMENC_ASCII; p->ps = mandoc_calloc(1, sizeof(struct termp_ps)); @@ -634,12 +635,14 @@ ps_setwidth(struct termp *p, int iop, size_t width) size_t lastwidth; lastwidth = p->ps->width; - if (0 < iop) + if (iop > 0) p->ps->width += width; - else if (0 > iop) + else if (iop == 0) + p->ps->width = width ? width : p->ps->lastwidth; + else if (p->ps->width > width) p->ps->width -= width; else - p->ps->width = width ? width : p->ps->lastwidth; + p->ps->width = 0; p->ps->lastwidth = lastwidth; }