From 3e7284e89db6c9a404b4300a7450ac56a61e667f Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 1 Dec 2006 22:15:36 +0000 Subject: [PATCH] Factor out printing a destination (in either an annotation or an outline) into its own function. git-svn-id: svn://svn.tartarus.org/sgt/halibut@6937 cda61777-01e9-0310-a592-d414129be87e --- bk_pdf.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bk_pdf.c b/bk_pdf.c index 67176bf..8b03ae2 100644 --- a/bk_pdf.c +++ b/bk_pdf.c @@ -39,6 +39,7 @@ static void pdf_string(void (*add)(object *, char const *), static void pdf_string_len(void (*add)(object *, char const *), object *, char const *, int); static void objref(object *o, object *dest); +static void objdest(object *o, page_data *p); static char *pdf_outline_convert(wchar_t *s, int *len); static int is_std_font(char const *name); @@ -435,9 +436,8 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords, objtext(opage, "]/Border[0 0 0]\n"); if (xr->dest.type == PAGE) { - objtext(opage, "/Dest["); - objref(opage, (object *)xr->dest.page->spare); - objtext(opage, "/XYZ null null null]"); + objtext(opage, "/Dest"); + objdest(opage, xr->dest.page); } else { objtext(opage, "/A<dest.url); @@ -609,6 +609,12 @@ static void objref(object *o, object *dest) rdaddsc(&o->main, buf); } +static void objdest(object *o, page_data *p) { + objtext(o, "["); + objref(o, (object *)p->spare); + objtext(o, "/XYZ null null null]"); +} + static char const * const stdfonts[] = { "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", "Helvetica", "Helvetica-Bold", "Helvetica-Oblique","Helvetica-BoldOblique", @@ -777,9 +783,9 @@ static int make_outline(object *parent, outline_element *items, int n, sfree(title); objtext(curr, "\n/Parent "); objref(curr, parent); - objtext(curr, "\n/Dest ["); - objref(curr, (object *)items->pdata->first->page->spare); - objtext(curr, " /XYZ null null null]\n"); + objtext(curr, "\n/Dest"); + objdest(curr, items->pdata->first->page); + objtext(curr, "\n"); if (prev) { objtext(curr, "/Prev "); objref(curr, prev); -- 2.11.0