version 1.83, 2017/02/17 14:31:52 |
version 1.88, 2017/10/26 18:11:31 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 538 pspdf_alloc(const struct manoutput *outopts) |
|
Line 538 pspdf_alloc(const struct manoutput *outopts) |
|
size_t marginx, marginy, lineheight; |
size_t marginx, marginy, lineheight; |
const char *pp; |
const char *pp; |
|
|
p = mandoc_calloc(1, sizeof(struct termp)); |
p = mandoc_calloc(1, sizeof(*p)); |
|
p->tcol = p->tcols = mandoc_calloc(1, sizeof(*p->tcol)); |
|
p->maxtcol = 1; |
|
|
p->enc = TERMENC_ASCII; |
p->enc = TERMENC_ASCII; |
p->fontq = mandoc_reallocarray(NULL, |
p->fontq = mandoc_reallocarray(NULL, |
(p->fontsz = 8), sizeof(enum termfont)); |
(p->fontsz = 8), sizeof(*p->fontq)); |
p->fontq[0] = p->fontl = TERMFONT_NONE; |
p->fontq[0] = p->fontl = TERMFONT_NONE; |
p->ps = mandoc_calloc(1, sizeof(struct termp_ps)); |
p->ps = mandoc_calloc(1, sizeof(*p->ps)); |
|
|
p->advance = ps_advance; |
p->advance = ps_advance; |
p->begin = ps_begin; |
p->begin = ps_begin; |
Line 593 pspdf_alloc(const struct manoutput *outopts) |
|
Line 596 pspdf_alloc(const struct manoutput *outopts) |
|
|
|
/* Remember millimetres -> AFM units. */ |
/* Remember millimetres -> AFM units. */ |
|
|
pagex = PNT2AFM(p, ((double)pagex * 2.834)); |
pagex = PNT2AFM(p, ((double)pagex * 72.0 / 25.4)); |
pagey = PNT2AFM(p, ((double)pagey * 2.834)); |
pagey = PNT2AFM(p, ((double)pagey * 72.0 / 25.4)); |
|
|
/* Margins are 1/9 the page x and y. */ |
/* Margins are 1/9 the page x and y. */ |
|
|
Line 739 ps_closepage(struct termp *p) |
|
Line 742 ps_closepage(struct termp *p) |
|
ps_printf(p, "%s", p->ps->psmarg); |
ps_printf(p, "%s", p->ps->psmarg); |
|
|
if (TERMTYPE_PS != p->type) { |
if (TERMTYPE_PS != p->type) { |
ps_printf(p, "ET\n"); |
|
|
|
len = p->ps->pdfbytes - p->ps->pdflastpg; |
len = p->ps->pdfbytes - p->ps->pdflastpg; |
base = p->ps->pages * 4 + p->ps->pdfbody; |
base = p->ps->pages * 4 + p->ps->pdfbody; |
|
|
Line 756 ps_closepage(struct termp *p) |
|
Line 757 ps_closepage(struct termp *p) |
|
ps_printf(p, "/Font <<\n"); |
ps_printf(p, "/Font <<\n"); |
for (i = 0; i < (int)TERMFONT__MAX; i++) |
for (i = 0; i < (int)TERMFONT__MAX; i++) |
ps_printf(p, "/F%d %d 0 R\n", i, 3 + i); |
ps_printf(p, "/F%d %d 0 R\n", i, 3 + i); |
ps_printf(p, ">>\n>>\n"); |
ps_printf(p, ">>\n>>\nendobj\n"); |
|
|
/* Page node. */ |
/* Page node. */ |
pdf_obj(p, base + 3); |
pdf_obj(p, base + 3); |
Line 821 ps_end(struct termp *p) |
|
Line 822 ps_end(struct termp *p) |
|
ps_printf(p, "<<\n"); |
ps_printf(p, "<<\n"); |
ps_printf(p, "/Type /Catalog\n"); |
ps_printf(p, "/Type /Catalog\n"); |
ps_printf(p, "/Pages 2 0 R\n"); |
ps_printf(p, "/Pages 2 0 R\n"); |
ps_printf(p, ">>\n"); |
ps_printf(p, ">>\nendobj\n"); |
xref = p->ps->pdfbytes; |
xref = p->ps->pdfbytes; |
ps_printf(p, "xref\n"); |
ps_printf(p, "xref\n"); |
ps_printf(p, "0 %zu\n", base + 1); |
ps_printf(p, "0 %zu\n", base + 1); |
Line 915 ps_begin(struct termp *p) |
|
Line 916 ps_begin(struct termp *p) |
|
ps_printf(p, "/Subtype /Type1\n"); |
ps_printf(p, "/Subtype /Type1\n"); |
ps_printf(p, "/Name /F%d\n", i); |
ps_printf(p, "/Name /F%d\n", i); |
ps_printf(p, "/BaseFont /%s\n", fonts[i].name); |
ps_printf(p, "/BaseFont /%s\n", fonts[i].name); |
ps_printf(p, ">>\n"); |
ps_printf(p, ">>\nendobj\n"); |
} |
} |
} |
} |
|
|
Line 1219 ps_endline(struct termp *p) |
|
Line 1220 ps_endline(struct termp *p) |
|
} |
} |
|
|
ps_closepage(p); |
ps_closepage(p); |
|
|
|
p->tcol->offset -= p->ti; |
|
p->ti = 0; |
} |
} |
|
|
static void |
static void |