summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-09-18 09:59:23 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-09-18 09:59:23 +0000
commitfe16d630d11241071f190c9562fb44e9dbfd62ff (patch)
treec65c02df8e34f44a6341a21ca16eea041616d5cd /Build/source/texk
parenta7c9c8ee656a7855f7dce3f33feb4d3a15d2a6df (diff)
dvipdf-x: More test cases and bug fixes
git-svn-id: svn://tug.org/texlive/trunk@31691 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/dvipdf-x/ChangeLog17
-rw-r--r--Build/source/texk/dvipdf-x/Makefile.am8
-rw-r--r--Build/source/texk/dvipdf-x/Makefile.in8
-rwxr-xr-xBuild/source/texk/dvipdf-x/dvipdfm-ann.test4
-rwxr-xr-xBuild/source/texk/dvipdf-x/dvipdfm-bkm.test4
-rwxr-xr-xBuild/source/texk/dvipdf-x/dvipdfm-res.test25
-rw-r--r--Build/source/texk/dvipdf-x/src/pdfnames.c4
-rw-r--r--Build/source/texk/dvipdf-x/src/pdfobj.c41
-rw-r--r--Build/source/texk/dvipdf-x/tests/resrc.dvibin0 -> 1144 bytes
-rw-r--r--Build/source/texk/dvipdf-x/tests/resrc.tex78
-rwxr-xr-xBuild/source/texk/dvipdf-x/xdvipdfm-ann.test4
-rwxr-xr-xBuild/source/texk/dvipdf-x/xdvipdfm-bkm.test4
-rwxr-xr-xBuild/source/texk/dvipdf-x/xdvipdfm-res.test25
13 files changed, 191 insertions, 31 deletions
diff --git a/Build/source/texk/dvipdf-x/ChangeLog b/Build/source/texk/dvipdf-x/ChangeLog
index dfa54dbdd2b..6dfbf0c1223 100644
--- a/Build/source/texk/dvipdf-x/ChangeLog
+++ b/Build/source/texk/dvipdf-x/ChangeLog
@@ -1,18 +1,27 @@
-2013-09-16 Peter Breitenlohner <peb@mppmu.mpg.de>
+2013-09-18 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().
+ * src/pdfobj.c: Remember to whom indirect objects refer.
* (x)dvipdfm-ann.test: Adapted to analog tests in ../dvipdfm-x.
+ Use compression level 0.
* (x)dvipdfmx.test: Adapted to analog tests in ../dvipdfm-x.
+ * *.test: Sanitize environment variables (from Akira).
+
* (x)dvipdfm-bkm.test: Additional tests with bookmarks.
* tests/bookm.{dvi,tex}: Additional test input files.
+ * (x)dvipdfm-res.test: Additional test with resources.
+ * tests/resrc.{dvi,tex}: Additional test input files.
* Makefile.am: Adapted.
- * *.test: Sanitize environment variables (from Akira).
+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().
2013-08-18 Peter Breitenlohner <peb@mppmu.mpg.de>
diff --git a/Build/source/texk/dvipdf-x/Makefile.am b/Build/source/texk/dvipdf-x/Makefile.am
index 0e173d95a23..25f7c8543dc 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 dvipdfm-bkm.test
+dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bkm.test dvipdfm-res.test
if DVIPDFMX
TESTS += $(dvipdfmx_tests)
endif DVIPDFMX
-xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bkm.test
+xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bkm.test xdvipdfm-res.test
if XDVIPDFMX
TESTS += $(xdvipdfmx_tests)
endif XDVIPDFMX
@@ -321,6 +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
-EXTRA_DIST += tests/bookm.dvi tests/bookm.tex
-DISTCLEANFILES += img*.* pic*.* image*.pdf annot*.pdf bookm*.pdf
+EXTRA_DIST += tests/bookm.dvi tests/bookm.tex tests/resrc.dvi tests/resrc.tex
+DISTCLEANFILES += img*.* pic*.* image*.pdf annot*.pdf bookm*.pdf resrc*.pdf
diff --git a/Build/source/texk/dvipdf-x/Makefile.in b/Build/source/texk/dvipdf-x/Makefile.in
index b1d36991489..9e9837f718d 100644
--- a/Build/source/texk/dvipdf-x/Makefile.in
+++ b/Build/source/texk/dvipdf-x/Makefile.in
@@ -946,14 +946,14 @@ EXTRA_DIST = $(common_sources) $(dvipdfmx_sources) \
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/bookm.dvi \
- tests/bookm.tex
+ tests/bookm.tex tests/resrc.dvi tests/resrc.tex
call_dvipdfmx_CPPFLAGS = -DEXEPROG=\"dvipdfmx.exe\"
nodist_call_dvipdfmx_SOURCES = callexe.c
DISTCLEANFILES = config.force img*.* pic*.* image*.pdf annot*.pdf \
- bookm*.pdf
+ bookm*.pdf resrc*.pdf
TESTS = $(am__append_5) $(am__append_6)
-dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bkm.test
-xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bkm.test
+dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bkm.test dvipdfm-res.test
+xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bkm.test xdvipdfm-res.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 09b145d5a24..a59bab11732 100755
--- a/Build/source/texk/dvipdf-x/dvipdfm-ann.test
+++ b/Build/source/texk/dvipdf-x/dvipdfm-ann.test
@@ -13,8 +13,8 @@ export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
-echo "*** dvipdfmx -v -o annot1.pdf annot" && echo \
- && ./dvipdfmx -v -o annot1.pdf $srcdir/tests/annot \
+echo "*** dvipdfmx -v -z0 -o annot1.pdf annot" && echo \
+ && ./dvipdfmx -v -z0 -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
index 3ccdaba7fd2..563a29f0651 100755
--- a/Build/source/texk/dvipdf-x/dvipdfm-bkm.test
+++ b/Build/source/texk/dvipdf-x/dvipdfm-bkm.test
@@ -13,8 +13,8 @@ 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 "*** dvipdfmx -v -z0 -o bookm1.pdf bookm" && echo \
+ && ./dvipdfmx -v -z0 -o bookm1.pdf $srcdir/tests/bookm \
&& echo && echo "dvipdfmx-bkm tests OK" && echo \
|| failed="$failed dvipdfmx-bkm"
diff --git a/Build/source/texk/dvipdf-x/dvipdfm-res.test b/Build/source/texk/dvipdf-x/dvipdfm-res.test
new file mode 100755
index 00000000000..dfb622da211
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/dvipdfm-res.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 -z0 -o resrc1.pdf resrc" && echo \
+ && ./dvipdfmx -v -z0 -o resrc1.pdf $srcdir/tests/resrc \
+ && echo && echo "dvipdfmx-res tests OK" && echo \
+ || failed="$failed dvipdfmx-res"
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
+
diff --git a/Build/source/texk/dvipdf-x/src/pdfnames.c b/Build/source/texk/dvipdf-x/src/pdfnames.c
index 87ad8898bf9..28082c8b9a9 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 a link to the original object.
+ * The following routine returns copies, not 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_link_obj(object);
+ return pdf_ref_obj(object);
}
pdf_obj *
diff --git a/Build/source/texk/dvipdf-x/src/pdfobj.c b/Build/source/texk/dvipdf-x/src/pdfobj.c
index 55cc96912d9..9f87910f718 100644
--- a/Build/source/texk/dvipdf-x/src/pdfobj.c
+++ b/Build/source/texk/dvipdf-x/src/pdfobj.c
@@ -117,6 +117,7 @@ struct pdf_stream
struct pdf_indirect
{
pdf_file *pf;
+ pdf_obj *obj; /* used when PF == NULL */
unsigned long label;
unsigned short generation;
};
@@ -193,6 +194,7 @@ static void release_objstm (pdf_obj *objstm);
static void pdf_out_char (FILE *file, char c);
static void pdf_out (FILE *file, const void *buffer, long length);
+static pdf_obj *pdf_new_ref (pdf_obj *object);
static void release_indirect (pdf_indirect *data);
static void write_indirect (pdf_indirect *indirect, FILE *file);
@@ -680,10 +682,7 @@ pdf_ref_obj (pdf_obj *object)
if (PDF_OBJ_INDIRECTTYPE(object)) {
return pdf_link_obj(object);
} else {
- if (object->label == 0) {
- pdf_label_obj(object);
- }
- return pdf_new_indirect(NULL, object->label, object->generation);
+ return pdf_new_ref(object);
}
}
@@ -2271,6 +2270,7 @@ pdf_new_indirect (pdf_file *pf, unsigned long obj_num, unsigned short obj_gen)
indirect = NEW(1, pdf_indirect);
indirect->pf = pf;
+ indirect->obj = NULL;
indirect->label = obj_num;
indirect->generation = obj_gen;
@@ -2505,9 +2505,24 @@ pdf_get_object (pdf_file *pf, unsigned long obj_num, unsigned short obj_gen)
}
#define OBJ_FILE(o) (((pdf_indirect *)((o)->data))->pf)
+#define OBJ_OBJ(o) (((pdf_indirect *)((o)->data))->obj)
#define OBJ_NUM(o) (((pdf_indirect *)((o)->data))->label)
#define OBJ_GEN(o) (((pdf_indirect *)((o)->data))->generation)
+static pdf_obj *
+pdf_new_ref (pdf_obj *object)
+{
+ pdf_obj *result;
+
+ if (object->label == 0) {
+ pdf_label_obj(object);
+ }
+ result = pdf_new_indirect(NULL, object->label, object->generation);
+ OBJ_OBJ(result) = object;
+ return result;
+}
+
+
/* pdf_deref_obj always returns a link instead of the original */
/* It never return the null object, but the NULL pointer instead */
pdf_obj *
@@ -2520,11 +2535,19 @@ pdf_deref_obj (pdf_obj *obj)
while (PDF_OBJ_INDIRECTTYPE(obj) && --count) {
pdf_file *pf = OBJ_FILE(obj);
- unsigned long obj_num = OBJ_NUM(obj);
- unsigned short obj_gen = OBJ_GEN(obj);
- ASSERT(pf);
- pdf_release_obj(obj);
- obj = pdf_get_object(pf, obj_num, obj_gen);
+ if (pf) {
+ unsigned long obj_num = OBJ_NUM(obj);
+ unsigned short obj_gen = OBJ_GEN(obj);
+ pdf_release_obj(obj);
+ obj = pdf_get_object(pf, obj_num, obj_gen);
+ } else {
+ pdf_obj *next_obj = OBJ_OBJ(obj);
+ if (!next_obj) {
+ ERROR("Undefined object reference");
+ }
+ pdf_release_obj(obj);
+ obj = pdf_link_obj(next_obj);
+ }
}
if (!count)
diff --git a/Build/source/texk/dvipdf-x/tests/resrc.dvi b/Build/source/texk/dvipdf-x/tests/resrc.dvi
new file mode 100644
index 00000000000..8e16467e097
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/tests/resrc.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdf-x/tests/resrc.tex b/Build/source/texk/dvipdf-x/tests/resrc.tex
new file mode 100644
index 00000000000..d82af96a1b5
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/tests/resrc.tex
@@ -0,0 +1,78 @@
+%
+\special{papersize=10cm,10cm}
+
+\special{pdf:obj @pgfcolorspaces <<>>}
+
+\special{pdf:obj @pgfpatterns <<>>}
+
+\special{pdf:put @resources
+ <</Pattern @pgfpatterns /Colorspace @pgfcolorspaces>>}
+
+\special{pdf:put @pgfcolorspaces
+ <</pgfprgb [/Pattern /DeviceRGB]>>}
+
+\special{pdf:put @pgfpatterns
+ <</pgfpat6 @pgf@paternobject@6>>}
+
+\special{pdf:stream @pgf@paternobject@6 (q 0.3985 w 3.08846 0.0 m Q)
+ <</Type/Pattern>>}
+
+\bye
+
+\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 9a0ae4b8193..24d6e6c1025 100755
--- a/Build/source/texk/dvipdf-x/xdvipdfm-ann.test
+++ b/Build/source/texk/dvipdf-x/xdvipdfm-ann.test
@@ -13,8 +13,8 @@ export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
-echo "*** xdvipdfmx -v -o annot2.pdf annot" && echo \
- && ./xdvipdfmx -v -o annot2.pdf $srcdir/tests/annot \
+echo "*** xdvipdfmx -v -z0 -o annot2.pdf annot" && echo \
+ && ./xdvipdfmx -v -z0 -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
index 92e4460b2c1..dd8cb51edf4 100755
--- a/Build/source/texk/dvipdf-x/xdvipdfm-bkm.test
+++ b/Build/source/texk/dvipdf-x/xdvipdfm-bkm.test
@@ -13,8 +13,8 @@ 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 "*** xdvipdfmx -v -z0 -o bookm2.pdf bookm" && echo \
+ && ./xdvipdfmx -v -z0 -o bookm2.pdf $srcdir/tests/bookm \
&& echo && echo "xdvipdfmx-bkm tests OK" && echo \
|| failed="$failed xdvipdfmx-bkm"
diff --git a/Build/source/texk/dvipdf-x/xdvipdfm-res.test b/Build/source/texk/dvipdf-x/xdvipdfm-res.test
new file mode 100755
index 00000000000..ab3b87755cd
--- /dev/null
+++ b/Build/source/texk/dvipdf-x/xdvipdfm-res.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 -z0 -o resrc2.pdf resrc" && echo \
+ && ./xdvipdfmx -v -z0 -o resrc2.pdf $srcdir/tests/resrc \
+ && echo && echo "xdvipdfmx-res tests OK" && echo \
+ || failed="$failed xdvipdfmx-res"
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
+