summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-09-16 11:09:29 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-09-16 11:09:29 +0000
commit0f080edb7404a88ee00c2f7372044bb16dc79fd8 (patch)
tree869234c2e87b3ce1abae7d0ef3ae55343e91a800 /Build/source
parent709a77cce65135408285595106c49cdc4f7d136c (diff)
dvipdf-x: Bug fix and new test for annotations and bookmarks
git-svn-id: svn://tug.org/texlive/trunk@31672 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/dvipdf-x/ChangeLog16
-rw-r--r--Build/source/texk/dvipdf-x/Makefile.am7
-rw-r--r--Build/source/texk/dvipdf-x/Makefile.in10
-rwxr-xr-xBuild/source/texk/dvipdf-x/dvipdfm-ann.test16
-rwxr-xr-xBuild/source/texk/dvipdf-x/dvipdfm-bkm.test25
-rwxr-xr-xBuild/source/texk/dvipdf-x/dvipdfmx.test13
-rw-r--r--Build/source/texk/dvipdf-x/src/pdfdoc.c13
-rw-r--r--Build/source/texk/dvipdf-x/src/pdfdoc.h3
-rw-r--r--Build/source/texk/dvipdf-x/src/pdfnames.c4
-rw-r--r--Build/source/texk/dvipdf-x/src/spc_pdfm.c2
-rw-r--r--Build/source/texk/dvipdf-x/tests/bookm.dvibin0 -> 1508 bytes
-rw-r--r--Build/source/texk/dvipdf-x/tests/bookm.tex60
-rwxr-xr-xBuild/source/texk/dvipdf-x/xdvipdfm-ann.test16
-rwxr-xr-xBuild/source/texk/dvipdf-x/xdvipdfm-bkm.test25
-rwxr-xr-xBuild/source/texk/dvipdf-x/xdvipdfmx.test12
15 files changed, 180 insertions, 42 deletions
diff --git a/Build/source/texk/dvipdf-x/ChangeLog b/Build/source/texk/dvipdf-x/ChangeLog
index 9b9819b94f1..dfa54dbdd2b 100644
--- a/Build/source/texk/dvipdf-x/ChangeLog
+++ b/Build/source/texk/dvipdf-x/ChangeLog
@@ -1,3 +1,19 @@
+2013-09-16 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Better handling of annotations and bookmarks.
+ * src/pdfdoc.[ch], src/spc_pdfm.c: Undo change from 2013-08-08.
+ * src/pdfnames.c (pdf_names_lookup_reference): Replace
+ pdf_ref_obj() => pdf_link_obj().
+
+ * (x)dvipdfm-ann.test: Adapted to analog tests in ../dvipdfm-x.
+ * (x)dvipdfmx.test: Adapted to analog tests in ../dvipdfm-x.
+
+ * (x)dvipdfm-bkm.test: Additional tests with bookmarks.
+ * tests/bookm.{dvi,tex}: Additional test input files.
+ * Makefile.am: Adapted.
+
+ * *.test: Sanitize environment variables (from Akira).
+
2013-08-18 Peter Breitenlohner <peb@mppmu.mpg.de>
* xsrc/epdf.c (add_stream_flate): Use z_const.
diff --git a/Build/source/texk/dvipdf-x/Makefile.am b/Build/source/texk/dvipdf-x/Makefile.am
index e75d53fdb40..0e173d95a23 100644
--- a/Build/source/texk/dvipdf-x/Makefile.am
+++ b/Build/source/texk/dvipdf-x/Makefile.am
@@ -307,11 +307,11 @@ DISTCLEANFILES = config.force
## Tests
##
TESTS =
-dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test
+dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bkm.test
if DVIPDFMX
TESTS += $(dvipdfmx_tests)
endif DVIPDFMX
-xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test
+xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bkm.test
if XDVIPDFMX
TESTS += $(xdvipdfmx_tests)
endif XDVIPDFMX
@@ -321,5 +321,6 @@ EXTRA_DIST += tests/dvipdfmx.cfg tests/psfonts.map
EXTRA_DIST += tests/image.jpeg tests/image.pdf tests/image.png
EXTRA_DIST += tests/image.dvi tests/image.tex
EXTRA_DIST += tests/cmr10.pfb tests/cmr10.tfm tests/annot.dvi tests/annot.tex
-DISTCLEANFILES += img*.* pic*.* image*.pdf annot*.pdf
+EXTRA_DIST += tests/bookm.dvi tests/bookm.tex
+DISTCLEANFILES += img*.* pic*.* image*.pdf annot*.pdf bookm*.pdf
diff --git a/Build/source/texk/dvipdf-x/Makefile.in b/Build/source/texk/dvipdf-x/Makefile.in
index da7d4085922..b1d36991489 100644
--- a/Build/source/texk/dvipdf-x/Makefile.in
+++ b/Build/source/texk/dvipdf-x/Makefile.in
@@ -945,13 +945,15 @@ EXTRA_DIST = $(common_sources) $(dvipdfmx_sources) \
tests/dvipdfmx.cfg tests/psfonts.map tests/image.jpeg \
tests/image.pdf tests/image.png tests/image.dvi \
tests/image.tex tests/cmr10.pfb tests/cmr10.tfm \
- tests/annot.dvi tests/annot.tex
+ tests/annot.dvi tests/annot.tex tests/bookm.dvi \
+ tests/bookm.tex
call_dvipdfmx_CPPFLAGS = -DEXEPROG=\"dvipdfmx.exe\"
nodist_call_dvipdfmx_SOURCES = callexe.c
-DISTCLEANFILES = config.force img*.* pic*.* image*.pdf annot*.pdf
+DISTCLEANFILES = config.force img*.* pic*.* image*.pdf annot*.pdf \
+ bookm*.pdf
TESTS = $(am__append_5) $(am__append_6)
-dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test
-xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test
+dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bkm.test
+xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bkm.test
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/Build/source/texk/dvipdf-x/dvipdfm-ann.test b/Build/source/texk/dvipdf-x/dvipdfm-ann.test
index 74e1021692b..09b145d5a24 100755
--- a/Build/source/texk/dvipdf-x/dvipdfm-ann.test
+++ b/Build/source/texk/dvipdf-x/dvipdfm-ann.test
@@ -3,18 +3,18 @@
# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
-# Not really a test, just making sure the program executes.
-
-TEXMFCNF=${srcdir}/../kpathsea
-TEXFONTS=${srcdir}/tests:${srcdir}/data
-DVIPDFMXINPUTS=${srcdir}/tests:${srcdir}/data
-TEXPICTS=${srcdir}/tests
-export TEXMFCNF TEXFONTS DVIPDFMXINPUTS TEXPICTS
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
echo "*** dvipdfmx -v -o annot1.pdf annot" && echo \
- && ./dvipdfmx -v -o annot1.pdf ${srcdir}/tests/annot \
+ && ./dvipdfmx -v -o annot1.pdf $srcdir/tests/annot \
&& echo && echo "dvipdfmx-ann tests OK" && echo \
|| failed="$failed dvipdfmx-ann"
diff --git a/Build/source/texk/dvipdf-x/dvipdfm-bkm.test b/Build/source/texk/dvipdf-x/dvipdfm-bkm.test
new file mode 100755
index 00000000000..3ccdaba7fd2
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/dvipdfm-bkm.test
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
+
+failed=
+
+echo "*** dvipdfmx -v -o bookm1.pdf bookm" && echo \
+ && ./dvipdfmx -v -o bookm1.pdf $srcdir/tests/bookm \
+ && echo && echo "dvipdfmx-bkm tests OK" && echo \
+ || failed="$failed dvipdfmx-bkm"
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
+
diff --git a/Build/source/texk/dvipdf-x/dvipdfmx.test b/Build/source/texk/dvipdf-x/dvipdfmx.test
index 4fb17db507c..fc5ae188d94 100755
--- a/Build/source/texk/dvipdf-x/dvipdfmx.test
+++ b/Build/source/texk/dvipdf-x/dvipdfmx.test
@@ -3,11 +3,12 @@
# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
-TEXMFCNF=${srcdir}/../kpathsea
-TEXFONTS=${srcdir}/tests:${srcdir}/data
-DVIPDFMXINPUTS=${srcdir}/tests:${srcdir}/data
-TEXPICTS=${srcdir}/tests
-export TEXMFCNF TEXFONTS DVIPDFMXINPUTS TEXPICTS
+
+TEXMFCNF=$srcdir/../kpathsea
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
@@ -22,7 +23,7 @@ echo "*** dvipdfmx --help" \
|| failed="$failed dvipdfmx-help"
echo "*** dvipdfmx -v -o image1.pdf image" && echo \
- && ./dvipdfmx -v -o image1.pdf ${srcdir}/tests/image \
+ && ./dvipdfmx -v -o image1.pdf $srcdir/tests/image \
&& echo && echo "dvipdfmx-image tests OK" && echo \
|| failed="$failed dvipdfmx-image"
diff --git a/Build/source/texk/dvipdf-x/src/pdfdoc.c b/Build/source/texk/dvipdf-x/src/pdfdoc.c
index 4b69d17faa4..862789ec714 100644
--- a/Build/source/texk/dvipdf-x/src/pdfdoc.c
+++ b/Build/source/texk/dvipdf-x/src/pdfdoc.c
@@ -1645,7 +1645,7 @@ pdf_doc_close_names (pdf_doc *p)
void
pdf_doc_add_annot (unsigned page_no, const pdf_rect *rect,
- pdf_obj *annot_dict)
+ pdf_obj *annot_dict, int new_annot)
{
pdf_doc *p = &pdoc;
pdf_page *page;
@@ -1686,6 +1686,9 @@ pdf_doc_add_annot (unsigned page_no, const pdf_rect *rect,
pdf_add_array(page->annots, pdf_ref_obj(annot_dict));
+ if (new_annot)
+ pdf_doc_add_goto(annot_dict);
+
return;
}
@@ -2643,9 +2646,10 @@ pdf_doc_end_grabbing (pdf_obj *attrib)
static struct
{
int dirty;
+ int broken;
pdf_obj *annot_dict;
pdf_rect rect;
-} breaking_state = {0, NULL, {0.0, 0.0, 0.0, 0.0}};
+} breaking_state = {0, 0, NULL, {0.0, 0.0, 0.0, 0.0}};
static void
reset_box (void)
@@ -2659,6 +2663,7 @@ void
pdf_doc_begin_annot (pdf_obj *dict)
{
breaking_state.annot_dict = dict;
+ breaking_state.broken = 0;
reset_box();
}
@@ -2679,8 +2684,10 @@ pdf_doc_break_annot (void)
annot_dict = pdf_new_dict();
pdf_merge_dict(annot_dict, breaking_state.annot_dict);
pdf_doc_add_annot(pdf_doc_current_page_number(), &(breaking_state.rect),
- annot_dict);
+ annot_dict, !breaking_state.broken);
pdf_release_obj(annot_dict);
+
+ breaking_state.broken = 1;
}
reset_box();
}
diff --git a/Build/source/texk/dvipdf-x/src/pdfdoc.h b/Build/source/texk/dvipdf-x/src/pdfdoc.h
index 0b9b27553e9..5772758af93 100644
--- a/Build/source/texk/dvipdf-x/src/pdfdoc.h
+++ b/Build/source/texk/dvipdf-x/src/pdfdoc.h
@@ -115,7 +115,8 @@ extern void pdf_doc_end_grabbing (pdf_obj *attrib);
/* Annotation */
extern void pdf_doc_add_annot (unsigned page_no,
const pdf_rect *rect,
- pdf_obj *annot_dict);
+ pdf_obj *annot_dict,
+ int new_annot);
/* Annotation with auto- clip and line (or page) break */
extern void pdf_doc_begin_annot (pdf_obj *dict);
diff --git a/Build/source/texk/dvipdf-x/src/pdfnames.c b/Build/source/texk/dvipdf-x/src/pdfnames.c
index 28082c8b9a9..87ad8898bf9 100644
--- a/Build/source/texk/dvipdf-x/src/pdfnames.c
+++ b/Build/source/texk/dvipdf-x/src/pdfnames.c
@@ -173,7 +173,7 @@ pdf_names_add_object (struct ht_table *names,
}
/*
- * The following routine returns copies, not the original object.
+ * The following routine returns a link to the original object.
*/
pdf_obj *
pdf_names_lookup_reference (struct ht_table *names,
@@ -197,7 +197,7 @@ pdf_names_lookup_reference (struct ht_table *names,
}
ASSERT(object);
- return pdf_ref_obj(object);
+ return pdf_link_obj(object);
}
pdf_obj *
diff --git a/Build/source/texk/dvipdf-x/src/spc_pdfm.c b/Build/source/texk/dvipdf-x/src/spc_pdfm.c
index 0015538e80c..6ae6a94fded 100644
--- a/Build/source/texk/dvipdf-x/src/spc_pdfm.c
+++ b/Build/source/texk/dvipdf-x/src/spc_pdfm.c
@@ -573,7 +573,7 @@ spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args)
if (ident)
spc_push_object(ident, pdf_link_obj(annot_dict));
/* This add reference. */
- pdf_doc_add_annot(pdf_doc_current_page_number(), &rect, annot_dict);
+ pdf_doc_add_annot(pdf_doc_current_page_number(), &rect, annot_dict, 1);
if (ident) {
spc_flush_object(ident);
diff --git a/Build/source/texk/dvipdf-x/tests/bookm.dvi b/Build/source/texk/dvipdf-x/tests/bookm.dvi
new file mode 100644
index 00000000000..7952eaa19fd
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/tests/bookm.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdf-x/tests/bookm.tex b/Build/source/texk/dvipdf-x/tests/bookm.tex
new file mode 100644
index 00000000000..72745154473
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/tests/bookm.tex
@@ -0,0 +1,60 @@
+%
+\special{papersize=10cm,10cm}
+
+\special{pdf:out 1
+ <</Title(Contents)/A<</S/GoTo/D(contents)>>>>}
+\special{pdf:out 1
+ <</Title(1 First section)/A<</S/GoTo/D(section.1)>>>>}
+\special{pdf:out 2
+ <</Title(1.1 First subsection)/A<</S/GoTo/D(subsection.1.1)>>>>}
+\special{pdf:out 1
+ <</Title(2 Second section)/A<</S/GoTo/D(section.2)>>>>}
+
+\noindent Contents
+\special{pdf:dest (contents) [@thispage /XYZ @xpos @ypos null]}
+
+\vskip 5mm
+
+\hbox to 60mm{%
+\special{pdf:bann<</Type/Annot/Subtype/Link/Border[0 0 0]/C[1 0 0]
+ /A<</S/GoTo/D(section.1)>>>>}1 First section\special{pdf:eann}
+\hfill 2}
+
+\hbox to 60mm{\hskip 5mm%
+\special{pdf:bann<</Type/Annot/Subtype/Link/Border[0 0 0]/C[1 0 0]
+ /A<</S/GoTo/D(subsection.1.1)>>>>}1.1 First subsection\special{pdf:eann}
+\hfill 3}
+
+\hbox to 60mm{%
+\special{pdf:bann<</Type/Annot/Subtype/Link/Border[0 0 0]/C[1 0 0]
+ /A<</S/GoTo/D(section.2)>>>>}2 Second section\special{pdf:eann}
+\hfill 4}
+
+\vfill\break
+
+\noindent 1 First section
+\special{pdf:dest (section.1) [@thispage /XYZ @xpos @ypos null]}
+
+\vskip 5mm
+
+\noindent The first section
+
+\vfill\break
+
+\noindent 1.1 First subsection
+\special{pdf:dest (subsection.1.1) [@thispage /XYZ @xpos @ypos null]}
+
+\vskip 5mm
+
+\noindent The first subsection
+
+\vfill\break
+
+\noindent 2 Second section
+\special{pdf:dest (section.2) [@thispage /XYZ @xpos @ypos null]}
+
+\vskip 5mm
+
+\noindent The second section
+
+\bye \ No newline at end of file
diff --git a/Build/source/texk/dvipdf-x/xdvipdfm-ann.test b/Build/source/texk/dvipdf-x/xdvipdfm-ann.test
index 5ea0d0be35a..9a0ae4b8193 100755
--- a/Build/source/texk/dvipdf-x/xdvipdfm-ann.test
+++ b/Build/source/texk/dvipdf-x/xdvipdfm-ann.test
@@ -3,18 +3,18 @@
# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
-# Not really a test, just making sure the program executes.
-
-TEXMFCNF=${srcdir}/../kpathsea
-TEXFONTS=${srcdir}/tests:${srcdir}/data
-DVIPDFMXINPUTS=${srcdir}/tests:${srcdir}/data
-TEXPICTS=${srcdir}/tests
-export TEXMFCNF TEXFONTS DVIPDFMXINPUTS TEXPICTS
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
echo "*** xdvipdfmx -v -o annot2.pdf annot" && echo \
- && ./xdvipdfmx -v -o annot2.pdf ${srcdir}/tests/annot \
+ && ./xdvipdfmx -v -o annot2.pdf $srcdir/tests/annot \
&& echo && echo "xdvipdfmx-ann tests OK" && echo \
|| failed="$failed xdvipdfmx-ann"
diff --git a/Build/source/texk/dvipdf-x/xdvipdfm-bkm.test b/Build/source/texk/dvipdf-x/xdvipdfm-bkm.test
new file mode 100755
index 00000000000..92e4460b2c1
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/xdvipdfm-bkm.test
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
+
+failed=
+
+echo "*** xdvipdfmx -v -o bookm2.pdf bookm" && echo \
+ && ./xdvipdfmx -v -o bookm2.pdf $srcdir/tests/bookm \
+ && echo && echo "xdvipdfmx-bkm tests OK" && echo \
+ || failed="$failed xdvipdfmx-bkm"
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
+
diff --git a/Build/source/texk/dvipdf-x/xdvipdfmx.test b/Build/source/texk/dvipdf-x/xdvipdfmx.test
index 21a4c5a9af9..32b5827b8ea 100755
--- a/Build/source/texk/dvipdf-x/xdvipdfmx.test
+++ b/Build/source/texk/dvipdf-x/xdvipdfmx.test
@@ -3,11 +3,11 @@
# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
-TEXMFCNF=${srcdir}/../kpathsea
-TEXFONTS=${srcdir}/tests:${srcdir}/data
-DVIPDFMXINPUTS=${srcdir}/tests:${srcdir}/data
-TEXPICTS=${srcdir}/tests
-export TEXMFCNF TEXFONTS DVIPDFMXINPUTS TEXPICTS
+TEXMFCNF=$srcdir/../kpathsea
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
@@ -26,7 +26,7 @@ echo "*** xdvipdfmx --help" \
fi
echo "*** xdvipdfmx -v -o image2.pdf image" && echo \
- && ./xdvipdfmx -v -o image2.pdf ${srcdir}/tests/image \
+ && ./xdvipdfmx -v -o image2.pdf $srcdir/tests/image \
&& echo && echo "xdvipdfmx-image tests OK" && echo \
|| failed="$failed xdvipdfmx-image"