summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-04-11 23:56:39 +0000
committerKarl Berry <karl@freefriends.org>2009-04-11 23:56:39 +0000
commit60293210a06b53e5f350108251b429122138baee (patch)
treea7a913bb14bff9368e4b8c2539b8130845effb38 /Build/source
parentc6a8d775221e97d8c9d50495cb4d16ce19fad38b (diff)
update dvipdfmx to 20090115
git-svn-id: svn://tug.org/texlive/trunk@12699 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/README114
-rw-r--r--Build/source/texk/README.orig103
-rw-r--r--Build/source/texk/dvipdfmx/ChangeLog129
-rw-r--r--Build/source/texk/dvipdfmx/Makefile.am4
-rw-r--r--Build/source/texk/dvipdfmx/Makefile.in4
-rw-r--r--Build/source/texk/dvipdfmx/config.h.in140
-rwxr-xr-xBuild/source/texk/dvipdfmx/configure40
-rw-r--r--Build/source/texk/dvipdfmx/configure.ac2
-rw-r--r--Build/source/texk/dvipdfmx/data/Makefile.am6
-rw-r--r--Build/source/texk/dvipdfmx/data/Makefile.in6
-rw-r--r--Build/source/texk/dvipdfmx/data/dvipdfmx.cfg3
-rw-r--r--Build/source/texk/dvipdfmx/src/cff.c35
-rw-r--r--Build/source/texk/dvipdfmx/src/cff.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/cff_dict.c8
-rw-r--r--Build/source/texk/dvipdfmx/src/cid.c4
-rw-r--r--Build/source/texk/dvipdfmx/src/cid.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/cidtype0.c14
-rw-r--r--Build/source/texk/dvipdfmx/src/dpxconf.c5
-rw-r--r--Build/source/texk/dvipdfmx/src/dpxconf.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/dpxutil.c11
-rw-r--r--Build/source/texk/dvipdfmx/src/dvi.c4
-rw-r--r--Build/source/texk/dvipdfmx/src/dvi.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/dvipdfmx.c27
-rw-r--r--Build/source/texk/dvipdfmx/src/epdf.c447
-rw-r--r--Build/source/texk/dvipdfmx/src/fontmap.c4
-rw-r--r--Build/source/texk/dvipdfmx/src/fontmap.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/mem.c17
-rw-r--r--Build/source/texk/dvipdfmx/src/mpost.c11
-rw-r--r--Build/source/texk/dvipdfmx/src/numbers.c6
-rw-r--r--Build/source/texk/dvipdfmx/src/numbers.h6
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfcolor.c189
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfcolor.h26
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfdev.c224
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfdev.h13
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfdoc.c453
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfdoc.h14
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfdraw.c77
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfdraw.h14
-rw-r--r--Build/source/texk/dvipdfmx/src/pdffont.c6
-rw-r--r--Build/source/texk/dvipdfmx/src/pdffont.h6
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfnames.c45
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfnames.h6
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfobj.c166
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfobj.h22
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfresource.c6
-rw-r--r--Build/source/texk/dvipdfmx/src/pdfresource.h6
-rw-r--r--Build/source/texk/dvipdfmx/src/pkfont.c20
-rw-r--r--Build/source/texk/dvipdfmx/src/pst_obj.c4
-rw-r--r--Build/source/texk/dvipdfmx/src/pst_obj.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_color.c31
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_color.h7
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_dvips.c20
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_dvips.h5
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_html.c9
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_misc.c25
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_misc.h7
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_pdfm.c37
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_pdfm.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/spc_tpic.c145
-rw-r--r--Build/source/texk/dvipdfmx/src/specials.c28
-rw-r--r--Build/source/texk/dvipdfmx/src/t1_load.c75
-rw-r--r--Build/source/texk/dvipdfmx/src/tfm.c6
-rw-r--r--Build/source/texk/dvipdfmx/src/tfm.h7
-rw-r--r--Build/source/texk/dvipdfmx/src/tt_table.c4
-rw-r--r--Build/source/texk/dvipdfmx/src/tt_table.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/type0.c4
-rw-r--r--Build/source/texk/dvipdfmx/src/type0.h4
-rw-r--r--Build/source/texk/dvipdfmx/src/type1.c15
-rw-r--r--Build/source/texk/dvipdfmx/src/type1c.c17
-rw-r--r--Build/source/texk/dvipdfmx/src/xbb.c147
70 files changed, 1503 insertions, 1569 deletions
diff --git a/Build/source/texk/README b/Build/source/texk/README
index 11a2f86f10c..4623878de4b 100644
--- a/Build/source/texk/README
+++ b/Build/source/texk/README
@@ -1,10 +1,108 @@
-chktex:
- http://mirror.sourceshare.org/savannah/chktex/chktex-1.6.3.tar.gz
- http://savannah.nongnu.org/download/chktex/chktex-1.6.3.tar.gz
+$Id$
+Copyright 2006, 2007, 2008, 2009 TeX Users Group.
+You may freely use, modify and/or distribute this file.
-dvipdfm:
- ftp://ftp.kettering.edu/pub/outgoing/mwicks/dvipdfm/dvipdfm-0.13.2d.tar.gz
- http://gaspra.kettering.edu/dvipdfm/dvipdfm-0.13.2d.tar.gz
+This TeX Live directory contains the programs that use the kpathsea
+library for configuration and path searching, and the library itself.
-lcdf-typetools:
- http://www.lcdf.org/type/lcdf-typetools-2.75.tar.gz
+Some programs can be built on their own, but others, including kpathsea
+itself, cannot. Instead, try using the script ../../Build or the
+equivalent configure && make. In general, for TeX Live we only test
+configuring the whole tree.
+
+Upstream sources and last-checked versions follow. If a url is given,
+that is the upstream, although this does not mean the program is
+actively maintained. Programs marked with a "?" are not (knowingly)
+maintained here, but the upstream is unknown. If a program is knowingly
+maintained here in the TL repo, that is explicitly stated.
+
+Anyone -- please research and update any of this information.
+
+
+afm2pl 0.7.03 - ok 28apr08
+ http://tex.aanhet.net/afm2pl/
+
+bibtex8 - ?
+
+chktex - ok 12apr09
+ http://mirror.sourceshare.org/savannah/chktex/chktex-1.6.3.tar.gz
+ http://savannah.nongnu.org/download/chktex/chktex-1.6.3.tar.gz
+
+cjkutils - Werner Lemberg
+ ctan
+
+detex - ?
+
+devnag - from devnag package installed in texmf-dist.
+
+djgpp - ?
+
+dtl - ?
+
+dvi2tty 5.3.1 - needs update 18may07
+ http://www.mesa.nl/pub/dvi2tty/
+
+dvidvi - ?
+
+dviljk - maintained here, by Joachim Schrod
+
+dvipdfm 0.13.2d - ok 12apr09
+ http://gaspra.kettering.edu/dvipdfm/dvipdfm-0.13.2d.tar.gz
+ ftp://ftp.kettering.edu/pub/outgoing/mwicks/dvipdfm/dvipdfm-0.13.2d.tar.gz
+ (until dvipdfmx is a 100% replacement we cannot drop it.)
+
+dvipdfmx 20080607 - ok 12apr09
+ http://project.ktug.or.kr/dvipdfmx/snapshot/latest/
+ http://project.ktug.or.kr/dvipdfmx/snapshot/latest/dvipdfmx-20090115.tar.gz
+ dvipdfmx@project.ktug.or.kr (ChoF, Hirata, Matthias)
+
+dvipng 1.11 - ok 15may08
+ http://www.ctan.org/tex-archive/dviware/dvipng/
+
+dvipos - ?
+
+dvipsk - maintained here by Tom Rokicki, Karl Berry, Akira Kakuto, ...
+
+etc - random additional files
+
+gsftopk - from Paul Vojta's xdvi?
+
+kpathsea - maintained here by Karl Berry, Akira Kakuto, ...
+
+lacheck - ?
+
+lcdf-typetools - needs update
+ http://www.lcdf.org/type/lcdf-typetools-2.75.tar.gz
+
+m4 - maintained here, part of our build
+
+make - maintained here, part of our build
+
+makeindexk - maintained here (but should it be?)
+
+musixflx - ?
+
+ps2pkm - ?
+
+seetexk - ?
+
+tex4htk
+ http://www.cse.ohio-state.edu/~gurari/TeX4ht/
+
+texlive - maintained here, scripts
+
+ttf2pk -
+ http://ctan.org/fonts/utilities/ttf2pk
+
+ttfdump - ?
+
+web2c - maintained here by Karl Berry et al. - core web2c, plain tex, omega.
+ The TeX variant dirs (pdftexdir, xetexdir, etc.)
+ updated here by their respective maintainers.
+
+xdv2pdf - Jonathan Kew
+
+xdvik 22.84.14 - ok 01jul08
+ ftp://tug.org/tex/
+
+xdvipdfmx - Jonathan Kew
diff --git a/Build/source/texk/README.orig b/Build/source/texk/README.orig
deleted file mode 100644
index 16a9f34c35f..00000000000
--- a/Build/source/texk/README.orig
+++ /dev/null
@@ -1,103 +0,0 @@
-$Id$
-Copyright 2006, 2007, 2008, 2009 TeX Users Group.
-You may freely use, modify and/or distribute this file.
-
-This TeX Live directory contains the programs that use the kpathsea
-library for configuration and path searching, and the library itself.
-
-Some programs can be built on their own, but others, including kpathsea
-itself, cannot. Instead, try configure --enable-tetex-build in ../, or
-using the Build script there. In general, for TeX Live we only test
-configuring the whole tree.
-
-Upstream sources and last-checked versions follow. If a url is given,
-that is the upstream, although this does not mean the program is
-actively maintained. Programs marked with a "?" are not (knowingly)
-maintained here, but the upstream is unknown. If a program is knowingly
-maintained here in the TL repo, that is explicitly stated.
-
-Anyone -- please research and update any of this information.
-
-
-afm2pl 0.7.03 - ok 28apr08
- http://tex.aanhet.net/afm2pl/
-
-bibtex8 - ?
-
-chktex - ?
-
-cjkutils - Werner Lemberg
-
-detex - ?
-
-devnag - from devnag package installed in texmf-dist.
-
-djgpp - ?
-
-dtl - ?
-
-dvi2tty 5.3.1 - needs update 18may07
- http://www.mesa.nl/pub/dvi2tty/
-
-dvidvi - ?
-
-dviljk - maintained here, by Joachim Schrod
-
-dvipdfm 0.13.2d - ok 5jun08
- http://gaspra.kettering.edu/dvipdfm/dvipdfm-0.13.2d.tar.gz
- until dvipdfmx is a 100% replacement we cannot drop it.
-
-dvipdfmx 20080607 - ok 9jun08
- http://project.ktug.or.kr/dvipdfmx/snapshot/latest/
- dvipdfmx@project.ktug.or.kr (ChoF, Hirata, Matthias)
-
-dvipng 1.11 - ok 15may08
- http://www.ctan.org/tex-archive/dviware/dvipng/
-
-dvipos - ?
-
-dvipsk - maintained here by Tom Rokicki, Karl Berry, Akira Kakuto, ...
-
-etc - random additional files
-
-gsftopk - from Paul Vojta's xdvi?
-
-kpathsea - maintained here by Karl Berry, Akira Kakuto, ...
-
-lacheck - ?
-
-lcdf-typetools 2.69 - ok 6may08
- http://www.lcdf.org/type/
-
-m4 - maintained here, part of our build
-
-make - maintained here, part of our build
-
-makeindexk - maintained here (but should it be?)
-
-musixflx - ?
-
-ps2pkm - ?
-
-seetexk - ?
-
-tex4htk
- http://www.cse.ohio-state.edu/~gurari/TeX4ht/
-
-texlive - maintained here, scripts
-
-ttf2pk -
- http://ctan.org/fonts/utilities/ttf2pk
-
-ttfdump - ?
-
-web2c - maintained here by Karl Berry et al. - core web2c, plain tex, omega.
- The TeX variant dirs (pdftexdir, xetexdir, etc.)
- updated here by their respective maintainers.
-
-xdv2pdf - Jonathan Kew
-
-xdvik 22.84.14 - ok 01jul08
- ftp://tug.org/tex/
-
-xdvipdfmx - Jonathan Kew
diff --git a/Build/source/texk/dvipdfmx/ChangeLog b/Build/source/texk/dvipdfmx/ChangeLog
index 3475b2a6ab6..7726d83e96a 100644
--- a/Build/source/texk/dvipdfmx/ChangeLog
+++ b/Build/source/texk/dvipdfmx/ChangeLog
@@ -1,8 +1,135 @@
-$Header: /home/cvsroot/dvipdfmx/ChangeLog,v 1.213 2008/06/07 09:59:38 chofchof Exp $
+$Header: /home/cvsroot/dvipdfmx/ChangeLog,v 1.234 2009/01/15 21:09:29 chofchof Exp $
ChangeLog: Changes for DVIPDFMx
===============================
+2009-01-15 Jin-Hwan Cho
+
+ * specials.c:
+ Apply Jonathan Kew's fix reported on August 7, 2008.
+ (Sorry that it was too late!)
+
+2008-12-11 Matthias Franz
+
+ * xbb.c:
+ Fixed an off-by-one and an off-by-two error in the generation
+ of output file names for extractbb.
+ (Debian bug #506329, reported by G\'abor Braun.)
+
+ * mpost.c, pdfcolor.c, pdfcolor.h, pdfdev.c, pdfdev.h, pdfdoc.c, pdfdraw.c, pdfdraw.h, spc_color.c, spc_pdfm.c:
+ Polished the code for color support. PDF color operators will
+ not be generated any more if old and new color coincide.
+
+2008-11-30 Matthias Franz
+
+ * spc_tpic.c:
+ Polished code.
+
+ * pdfdev.c, spc_html.c:
+ Concatenated transformation matrices for images.
+
+ * data/dvipdfmx.cfg, dvipdfmx.c, pdfdoc.c:
+ Fixed two problems with removal of PDF destinations: Non-link
+ annotations produced a warning, and broken links were not
+ detected if no valid destination existed.
+ Removing unused destinations is now default behaviour and can
+ be prevented by using the flag "-C 0x10". Since the feature
+ is still new, this flag is set in dvipdfmx.cfg.
+
+ * spc_color.c, spc_color.h, spc_dvips.c, spc_dvips.h, spc_misc.c, spc_misc.h, spc_pdfm.c, spc_pdfm.h, specials.c:
+ Removed unnecessary (no-op) handlers for specials.
+
+ * cid.c, cid.h, dpxconf.c, dpxconf.h, dvi.c, dvi.h, fontmap.c, fontmap.h, numbers.c, numbers.h, pdfcolor.c, pdfcolor.h, pdfdev.c, pdfdev.h, pdfdoc.c, pdfdoc.h, pdfdraw.c, pdfdraw.h, pdffont.c, pdffont.h, pdfobj.c, pdfobj.h, pdfresource.c, pdfresource.h, pst_obj.c, pst_obj.h, tfm.c, tfm.h, tt_table.c, tt_table.h, type0.c, type0.h:
+ Commented out unused functions.
+
+2008-11-08 Matthias Franz
+
+ * pdfcolor.c, pdfcolor.h, spc_tpic.c:
+ Made tpic specials respect color settings. Before, they
+ always used black for drawing commands.
+ (Debian bug #485567, reported by Daniel Skorka.)
+
+2008-11-03 Matthias Franz
+
+ * dpxutil.c, dvipdfmx.c, mem.c, pdfdoc.c, pdfdoc.h, pdfnames.c, pdfnames.h:
+ Remove unused PDF destinations. (Packages like hyperref
+ create destinations regardless of whether they are used
+ or not.) This option is currently turned off by default;
+ it can be enabled with "-C 0x10".
+
+ * dvipdfmx.c:
+ Improved parsing of "-v" command line option; contributed
+ by Akira Kakuto. Note that there are still problems if an
+ argument to an option (or the name of the DVI file) starts
+ with a minus sign
+
+ * pkfont.c:
+ Corrected bounding box computation for PK fonts. Before,
+ it was always [0, 0, 0, 0]. Also removed a redundant call
+ to pdf_encoding_add_usedchars.
+
+2008-10-13 Matthias Franz
+
+ * cff.c, cff.h, cff_dict.c, cidtype0.c, pdfdev.c, t1_load.c, type1.c, type1c.c:
+ Various speed improvements:
+ cff.c: cff_add_string now has an option to avoid checking for
+ duplicate strings.
+ pdfdev.c: p_dtoa does not call library functions any more.
+ t1_load.c: t1_decrypt is not called for each byte seperately
+ any more. (Well, this does not make a big difference.)
+
+2008-09-29 Matthias Franz
+
+ * epdf.c, pdfdoc.c, pdfdoc.h, pdfobj.c, pdfobj.h, xbb.c:
+ Made PDF parsing more robust. In particular, we can now
+ detect (illegal) loops in a PDF document hierarchy.
+ Also, much of the PDF parsing code in epdf.c and xbb.c has
+ been combined to the function pdf_doc_get_page in pdfdoc.c.
+ Loops in PDF page trees are detected as well.
+ Moreover, the various bounding boxes of a page are now
+ handled correctly: MediaBox and CropBox are inherited,
+ but not the others.
+
+2008-08-31 Matthias Franz
+
+ * type1.c:
+ Fixed a bug when processing "seac" operators in Type 1
+ fonts. If the base or accent char were not used otherwise,
+ an "Invalid SID" error could occur.
+
+2008-08-05 Matthias Franz
+
+ * type1c.c:
+ Fixed a buffer overflow when using 256 glyphs of a CFF font
+ (plus ".notdef").
+
+2008-08-04 Matthias Franz
+
+ * type1c.c:
+ Fixed a segfault when processing CFF fonts.
+
+2008-07-16 Matthias Franz
+
+ * pdfnames.c, pdfobj.c, pdfobj.h:
+ Replaced pdf_copy_object by the (almost) equivalent,
+ but simpler function pdf_transfer_label. Simplified
+ pdf_compare_reference.
+
+ * pdfnames.c:
+ Reintroduced warning about duplicate object keys.
+
+2008-06-20 Jin-Hwan Cho
+
+ * spc_pdfm.c:
+ Fixed a bug on beads with nonzero depth; reported by
+ Alexander Grahn.
+
+2008-06-13 Jin-Hwan Cho
+
+ * spc_pdfm.c:
+ Fixed a bug on annotations with nonzero depth; reported by
+ Alexander Grahn.
+
2008-06-07 Jin-Hwan Cho
* contrib/latex/movie15.sty.sample:
diff --git a/Build/source/texk/dvipdfmx/Makefile.am b/Build/source/texk/dvipdfmx/Makefile.am
index eea486dc358..faef0d05e71 100644
--- a/Build/source/texk/dvipdfmx/Makefile.am
+++ b/Build/source/texk/dvipdfmx/Makefile.am
@@ -1,7 +1,5 @@
-##
-ACLOCAL_AMFLAGS = -I ../../m4
-
SUBDIRS = data src
+ACLOCAL_AMFLAGS = -I ../../m4
EXTRA_DIST = ChangeLog.TL
diff --git a/Build/source/texk/dvipdfmx/Makefile.in b/Build/source/texk/dvipdfmx/Makefile.in
index 97f37995235..7ab55463f29 100644
--- a/Build/source/texk/dvipdfmx/Makefile.in
+++ b/Build/source/texk/dvipdfmx/Makefile.in
@@ -44,7 +44,7 @@ DIST_COMMON = README $(am__configure_deps) \
../../build-aux/install-sh ../../build-aux/ltmain.sh \
../../build-aux/missing ../../build-aux/texinfo.tex \
../../build-aux/ylwrap AUTHORS COPYING ChangeLog INSTALL NEWS \
- TODO
+ TODO compile depcomp install-sh missing mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../m4/cho-kpse.m4 \
$(top_srcdir)/../../m4/cho-libs.m4 \
@@ -210,8 +210,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-ACLOCAL_AMFLAGS = -I ../../m4
SUBDIRS = data src
+ACLOCAL_AMFLAGS = -I ../../m4
EXTRA_DIST = ChangeLog.TL Makefile.am.orig configure.in.orig
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/Build/source/texk/dvipdfmx/config.h.in b/Build/source/texk/dvipdfmx/config.h.in
index be3f6d5b5a4..575e3101aa9 100644
--- a/Build/source/texk/dvipdfmx/config.h.in
+++ b/Build/source/texk/dvipdfmx/config.h.in
@@ -1,170 +1,70 @@
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
-/* Define to 1 if the `closedir' function returns void instead of `int'. */
-#undef CLOSEDIR_VOID
-
-/* Define to 1 if you have the <assert.h> header file. */
-#undef HAVE_ASSERT_H
+/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `basename' function. */
#undef HAVE_BASENAME
-/* Define to 1 if you have the `bcmp' function. */
-#undef HAVE_BCMP
-
-/* Define to 1 if you have the `bcopy' function. */
-#undef HAVE_BCOPY
-
-/* Define to 1 if you have the `bzero' function. */
-#undef HAVE_BZERO
-
/* Define to 1 if you have the `close' function. */
#undef HAVE_CLOSE
-/* Define to 1 if you have the `compress' function. */
-#undef HAVE_COMPRESS
-
-/* Define to 1 if you have the `compress2' function. */
-#undef HAVE_COMPRESS2
-
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
*/
#undef HAVE_DECL_TZNAME
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
- */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <float.h> header file. */
-#undef HAVE_FLOAT_H
-
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
-/* Define to 1 if you have the `getcwd' function. */
-#undef HAVE_GETCWD
-
/* Define to 1 if you have the `getenv' function. */
#undef HAVE_GETENV
-/* Define to 1 if you have the `getwd' function. */
-#undef HAVE_GETWD
-
-/* Define to 1 if you have the `index' function. */
-#undef HAVE_INDEX
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the `kpathsea' library (-lkpathsea). */
+#undef HAVE_LIBKPATHSEA
+
/* Define if you have libpaper */
#undef HAVE_LIBPAPER
-/* Define if you have libpng and its headers. */
+/* Define if you have libpng */
#undef HAVE_LIBPNG
-/* Define to 1 if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define to 1 if you have the `memcmp' function. */
-#undef HAVE_MEMCMP
-
-/* Define to 1 if you have the `memcpy' function. */
-#undef HAVE_MEMCPY
-
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#undef HAVE_NDIR_H
-
/* Define to 1 if you have the `open' function. */
#undef HAVE_OPEN
-/* Define to 1 if you have the `png_get_image_width' function. */
-#undef HAVE_PNG_GET_IMAGE_WIDTH
-
-/* Define to 1 if you are using GNU libc or otherwise have global variables
- `program_invocation_name' and `program_invocation_short_name'. */
-#undef HAVE_PROGRAM_INVOCATION_NAME
-
-/* Define to 1 if your compiler understands prototypes. */
-#undef HAVE_PROTOTYPES
-
-/* Define to 1 if you have the `putenv' function. */
-#undef HAVE_PUTENV
-
-/* Define to 1 if you have the <pwd.h> header file. */
-#undef HAVE_PWD_H
-
-/* Define to 1 if you have the `rindex' function. */
-#undef HAVE_RINDEX
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
-/* Define to 1 if you have the `strrchr' function. */
-#undef HAVE_STRRCHR
-
-/* Define to 1 if you have the `strstr' function. */
-#undef HAVE_STRSTR
-
-/* Define to 1 if you have the `strtol' function. */
-#undef HAVE_STRTOL
-
-/* Define to 1 if `st_mtim' is member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_MTIM
-
/* Define to 1 if `tm_zone' is member of `struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
/* Define to 1 if you have the `system' function. */
#undef HAVE_SYSTEM
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
- */
-#undef HAVE_SYS_DIR_H
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
- */
-#undef HAVE_SYS_NDIR_H
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
-/* Define if <time.h> has timezone as an external variable. */
+/* external timezone variable */
#undef HAVE_TIMEZONE
-/* Define if struct tm has tm_gmtoff as a member. */
+/* struct tz has tm_gmtoff */
#undef HAVE_TM_GMTOFF
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
@@ -178,15 +78,14 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Define if you have zlib and its headers. */
+/* Define if you have zlib and its headers */
#undef HAVE_ZLIB
-/* Define if your zlib has the compress2 function. */
+/* Define if your zlib has the compress2 function */
#undef HAVE_ZLIB_COMPRESS2
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
-#undef LT_OBJDIR
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
@@ -227,17 +126,9 @@
/* Version number of package */
#undef VERSION
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-# undef WORDS_BIGENDIAN
-# endif
-#endif
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@@ -248,8 +139,7 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
-/* Define as 0x200406L if your libkpathsea supports enc formats, or as
- 0x200302L otherwise. */
+/* Define if your libkpathsea supports enc formats */
#undef __TDS_VERSION__
/* Define to empty if `const' does not conform to ANSI C. */
diff --git a/Build/source/texk/dvipdfmx/configure b/Build/source/texk/dvipdfmx/configure
index 5e40ad32785..d299bc8fe8c 100755
--- a/Build/source/texk/dvipdfmx/configure
+++ b/Build/source/texk/dvipdfmx/configure
@@ -1,8 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for dvipdfmx 20080607.
+# Generated by GNU Autoconf 2.63 for dvipdfmx 20090115.
#
-# Report bugs to <tex-k@tug.org>.
+# Report bugs to <dvipdfmx@project.ktug.or.kr>.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -745,9 +745,9 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='dvipdfmx'
PACKAGE_TARNAME='dvipdfmx'
-PACKAGE_VERSION='20080607'
-PACKAGE_STRING='dvipdfmx 20080607'
-PACKAGE_BUGREPORT='tex-k@tug.org'
+PACKAGE_VERSION='20090115'
+PACKAGE_STRING='dvipdfmx 20090115'
+PACKAGE_BUGREPORT='dvipdfmx@project.ktug.or.kr'
ac_unique_file="src/dvipdfmx.c"
# Factoring default headers for most tests.
@@ -1493,7 +1493,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dvipdfmx 20080607 to adapt to many kinds of systems.
+\`configure' configures dvipdfmx 20090115 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1563,7 +1563,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dvipdfmx 20080607:";;
+ short | recursive ) echo "Configuration of dvipdfmx 20090115:";;
esac
cat <<\_ACEOF
@@ -1617,7 +1617,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to <tex-k@tug.org>.
+Report bugs to <dvipdfmx@project.ktug.or.kr>.
_ACEOF
ac_status=$?
fi
@@ -1680,7 +1680,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dvipdfmx configure 20080607
+dvipdfmx configure 20090115
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1694,7 +1694,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dvipdfmx $as_me 20080607, which was
+It was created by dvipdfmx $as_me 20090115, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -6787,7 +6787,7 @@ fi
# Define the identity of the package.
PACKAGE='dvipdfmx'
- VERSION='20080607'
+ VERSION='20090115'
cat >>confdefs.h <<_ACEOF
@@ -12200,9 +12200,9 @@ $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ---------------------------- ##
-## Report this to tex-k@tug.org ##
-## ---------------------------- ##
+## ------------------------------------------ ##
+## Report this to dvipdfmx@project.ktug.or.kr ##
+## ------------------------------------------ ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -13160,9 +13160,9 @@ $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ---------------------------- ##
-## Report this to tex-k@tug.org ##
-## ---------------------------- ##
+## ------------------------------------------ ##
+## Report this to dvipdfmx@project.ktug.or.kr ##
+## ------------------------------------------ ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -16255,7 +16255,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-dvipdfmx config.lt 20080607
+dvipdfmx config.lt 20090115
configured by $0, generated by GNU Autoconf 2.63.
Copyright (C) 2008 Free Software Foundation, Inc.
@@ -18615,7 +18615,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dvipdfmx $as_me 20080607, which was
+This file was extended by dvipdfmx $as_me 20090115, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18678,7 +18678,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-dvipdfmx config.status 20080607
+dvipdfmx config.status 20090115
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/Build/source/texk/dvipdfmx/configure.ac b/Build/source/texk/dvipdfmx/configure.ac
index 0c90760c6b1..dbe7f5f91f2 100644
--- a/Build/source/texk/dvipdfmx/configure.ac
+++ b/Build/source/texk/dvipdfmx/configure.ac
@@ -6,7 +6,7 @@ dnl This file is free software; the copyright holder
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
-AC_INIT([dvipdfmx], [20080607], [tex-k@tug.org])
+AC_INIT([dvipdfmx], [20090115], [dvipdfmx@project.ktug.or.kr])
AC_PREREQ([2.63])
AC_CONFIG_SRCDIR([src/dvipdfmx.c])
AC_CONFIG_AUX_DIR([../../build-aux])
diff --git a/Build/source/texk/dvipdfmx/data/Makefile.am b/Build/source/texk/dvipdfmx/data/Makefile.am
index 45183b7f382..30a0ef6c465 100644
--- a/Build/source/texk/dvipdfmx/data/Makefile.am
+++ b/Build/source/texk/dvipdfmx/data/Makefile.am
@@ -1,12 +1,12 @@
-configdatadir = ${prefix}/texmf/dvipdfmx
+configdatadir = $(prefix)/texmf/dvipdfmx
dist_configdata_DATA = \
$(srcdir)/dvipdfmx.cfg
-glyphlistdatadir = ${prefix}/texmf-dist/fonts/map/glyphlist
+glyphlistdatadir = $(prefix)/texmf-dist/fonts/map/glyphlist
dist_glyphlistdata_DATA = \
$(srcdir)/glyphlist.txt \
$(srcdir)/pdfglyphlist.txt
-mapdatadir = ${prefix}/texmf/fonts/map/dvipdfm/dvipdfmx
+mapdatadir = $(prefix)/texmf/fonts/map/dvipdfm/dvipdfmx
dist_mapdata_DATA = \
$(srcdir)/cid-x.map
diff --git a/Build/source/texk/dvipdfmx/data/Makefile.in b/Build/source/texk/dvipdfmx/data/Makefile.in
index c6c67f00519..868ff3674d5 100644
--- a/Build/source/texk/dvipdfmx/data/Makefile.in
+++ b/Build/source/texk/dvipdfmx/data/Makefile.in
@@ -190,16 +190,16 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-configdatadir = ${prefix}/texmf/dvipdfmx
+configdatadir = $(prefix)/texmf/dvipdfmx
dist_configdata_DATA = \
$(srcdir)/dvipdfmx.cfg
-glyphlistdatadir = ${prefix}/texmf-dist/fonts/map/glyphlist
+glyphlistdatadir = $(prefix)/texmf-dist/fonts/map/glyphlist
dist_glyphlistdata_DATA = \
$(srcdir)/glyphlist.txt \
$(srcdir)/pdfglyphlist.txt
-mapdatadir = ${prefix}/texmf/fonts/map/dvipdfm/dvipdfmx
+mapdatadir = $(prefix)/texmf/fonts/map/dvipdfm/dvipdfmx
dist_mapdata_DATA = \
$(srcdir)/cid-x.map
diff --git a/Build/source/texk/dvipdfmx/data/dvipdfmx.cfg b/Build/source/texk/dvipdfmx/data/dvipdfmx.cfg
index 9b884bbff3a..f9537aaca8a 100644
--- a/Build/source/texk/dvipdfmx/data/dvipdfmx.cfg
+++ b/Build/source/texk/dvipdfmx/data/dvipdfmx.cfg
@@ -25,8 +25,9 @@
%% This is only for backward compatibility. Don't use that.
%% 0x0008 Do not replace duplicate fontmap entries.
%% Dvipdfm's (not 'x') behaviour.
+%% 0x0010 Do not remove unused PDF destinations (experimental).
-%C 0x0000
+C 0x0010
%%
%% PDF Document Settings
diff --git a/Build/source/texk/dvipdfmx/src/cff.c b/Build/source/texk/dvipdfmx/src/cff.c
index 70adb996fcd..6dbcaf6094f 100644
--- a/Build/source/texk/dvipdfmx/src/cff.c
+++ b/Build/source/texk/dvipdfmx/src/cff.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/cff.c,v 1.15 2004/09/11 14:50:28 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/cff.c,v 1.16 2008/10/13 19:42:48 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -553,11 +553,13 @@ void cff_update_string (cff_font *cff)
cff->_string = NULL;
}
-s_SID cff_add_string (cff_font *cff, char *str)
+s_SID cff_add_string (cff_font *cff, const char *str, int unique)
+/* Setting unique == 1 eliminates redundant or predefined strings. */
{
card16 idx;
cff_index *strings;
l_offset offset, size;
+ long len = strlen(str);
if (cff == NULL)
ERROR("CFF font not opened.");
@@ -566,28 +568,29 @@ s_SID cff_add_string (cff_font *cff, char *str)
cff->_string = cff_new_index(0);
strings = cff->_string;
- for (idx = 0; idx < strings->count; idx++) {
- size = strings->offset[idx+1] - strings->offset[idx];
- offset = strings->offset[idx];
- if (size == strlen(str) &&
- !memcmp(strings->data+offset-1, str, strlen(str)))
- return (idx + CFF_STDSTR_MAX);
+ if (unique) {
+ /* TODO: do binary search to speed things up */
+ for (idx = 0; idx < CFF_STDSTR_MAX; idx++) {
+ if (cff_stdstr[idx] && !strcmp(cff_stdstr[idx], str))
+ return idx;
+ }
+ for (idx = 0; idx < strings->count; idx++) {
+ size = strings->offset[idx+1] - strings->offset[idx];
+ offset = strings->offset[idx];
+ if (size == len && !memcmp(strings->data+offset-1, str, len))
+ return (idx + CFF_STDSTR_MAX);
+ }
}
- for (idx = 0; idx < CFF_STDSTR_MAX; idx++) {
- if (cff_stdstr[idx] &&
- !strcmp(cff_stdstr[idx], str))
- return idx;
- }
offset = (strings->count > 0) ? strings->offset[strings->count] : 1;
strings->offset = RENEW(strings->offset, strings->count+2, l_offset);
if (strings->count == 0)
strings->offset[0] = 1;
idx = strings->count;
strings->count += 1;
- strings->offset[strings->count] = offset + strlen(str);
- strings->data = RENEW(strings->data, offset+strlen(str)-1, card8);
- memcpy(strings->data+offset-1, str, strlen(str));
+ strings->offset[strings->count] = offset + len;
+ strings->data = RENEW(strings->data, offset+len-1, card8);
+ memcpy(strings->data+offset-1, str, len);
return (idx + CFF_STDSTR_MAX);
}
diff --git a/Build/source/texk/dvipdfmx/src/cff.h b/Build/source/texk/dvipdfmx/src/cff.h
index de0bee71963..03174386ba0 100644
--- a/Build/source/texk/dvipdfmx/src/cff.h
+++ b/Build/source/texk/dvipdfmx/src/cff.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/cff.h,v 1.9 2004/09/11 14:50:28 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/cff.h,v 1.10 2008/10/13 19:42:48 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -137,7 +137,7 @@ extern long cff_read_private (cff_font *cff);
extern int cff_match_string (cff_font *cff, const char *str, s_SID sid);
extern char *cff_get_string (cff_font *cff, s_SID id);
extern long cff_get_sid (cff_font *cff, char *str);
-extern s_SID cff_add_string (cff_font *cff, char *str);
+extern s_SID cff_add_string (cff_font *cff, const char *str, int unique);
extern void cff_update_string (cff_font *cff);
#define cff_is_stdstr(s) (cff_get_sid(NULL, (s)) >= 0)
diff --git a/Build/source/texk/dvipdfmx/src/cff_dict.c b/Build/source/texk/dvipdfmx/src/cff_dict.c
index 764c392bd8d..5d360e4ecfc 100644
--- a/Build/source/texk/dvipdfmx/src/cff_dict.c
+++ b/Build/source/texk/dvipdfmx/src/cff_dict.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/cff_dict.c,v 1.16 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/cff_dict.c,v 1.17 2008/10/13 19:42:48 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -698,14 +698,14 @@ void cff_dict_update (cff_dict *dict, cff_font *cff)
id = (dict->entries)[i].id;
if (dict_operator[id].argtype == CFF_TYPE_SID) {
str = cff_get_string(cff, (dict->entries)[i].values[0]);
- (dict->entries)[i].values[0] = cff_add_string(cff, str);
+ (dict->entries)[i].values[0] = cff_add_string(cff, str, 1);
RELEASE(str);
} else if (dict_operator[id].argtype == CFF_TYPE_ROS) {
str = cff_get_string(cff, (dict->entries)[i].values[0]);
- (dict->entries)[i].values[0] = cff_add_string(cff, str);
+ (dict->entries)[i].values[0] = cff_add_string(cff, str, 1);
RELEASE(str);
str = cff_get_string(cff, (dict->entries)[i].values[1]);
- (dict->entries)[i].values[1] = cff_add_string(cff, str);
+ (dict->entries)[i].values[1] = cff_add_string(cff, str, 1);
RELEASE(str);
}
}
diff --git a/Build/source/texk/dvipdfmx/src/cid.c b/Build/source/texk/dvipdfmx/src/cid.c
index 9e22650194f..b7a56494b75 100644
--- a/Build/source/texk/dvipdfmx/src/cid.c
+++ b/Build/source/texk/dvipdfmx/src/cid.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/cid.c,v 1.31 2008/05/17 04:18:47 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/cid.c,v 1.32 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -113,11 +113,13 @@ CIDFont_set_verbose (void)
__verbose++;
}
+#if 0
int
CIDFont_require_version (void)
{
return PDF_CID_SUPPORT_MIN;
}
+#endif
CIDFont *
CIDFont_new (void)
diff --git a/Build/source/texk/dvipdfmx/src/cid.h b/Build/source/texk/dvipdfmx/src/cid.h
index f068749544a..257bbe3dce1 100644
--- a/Build/source/texk/dvipdfmx/src/cid.h
+++ b/Build/source/texk/dvipdfmx/src/cid.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/cid.h,v 1.13 2004/09/02 12:23:06 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/cid.h,v 1.14 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -39,7 +39,9 @@ extern CIDSysInfo CSI_UNICODE;
typedef struct CIDFont CIDFont;
extern void CIDFont_set_verbose (void);
+#if 0
extern int CIDFont_require_version (void);
+#endif
extern void CIDFont_set_flags (long flags);
#define CIDFONT_FORCE_FIXEDPITCH (1 << 1)
diff --git a/Build/source/texk/dvipdfmx/src/cidtype0.c b/Build/source/texk/dvipdfmx/src/cidtype0.c
index 4987b4f52d6..5f61602ad6f 100644
--- a/Build/source/texk/dvipdfmx/src/cidtype0.c
+++ b/Build/source/texk/dvipdfmx/src/cidtype0.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/cidtype0.c,v 1.38 2008/05/17 04:18:47 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/cidtype0.c,v 1.39 2008/10/13 19:42:48 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -983,7 +983,7 @@ CIDFont_type0_t1cdofont (CIDFont *font)
cffont->fdarray[0] = cff_new_dict();
cff_dict_add(cffont->fdarray[0], "FontName", 1);
cff_dict_set(cffont->fdarray[0], "FontName", 0,
- (double) cff_add_string(cffont, font->fontname + 7)); /* FIXME: Skip XXXXXX+ */
+ (double) cff_add_string(cffont, font->fontname + 7, 1)); /* FIXME: Skip XXXXXX+ */
cff_dict_add(cffont->fdarray[0], "Private", 2);
cff_dict_set(cffont->fdarray[0], "Private", 0, 0.0);
cff_dict_set(cffont->fdarray[0], "Private", 0, 0.0);
@@ -1062,8 +1062,8 @@ CIDFont_type0_t1cdofont (CIDFont *font)
cff_dict_remove((cffont->private)[0], "Subrs"); /* no Subrs */
}
- cff_add_string(cffont, (char *)"Adobe");
- cff_add_string(cffont, (char *)"Identity");
+ cff_add_string(cffont, "Adobe", 1);
+ cff_add_string(cffont, "Identity", 1);
cff_dict_update(cffont->topdict, cffont);
cff_dict_update(cffont->private[0], cffont);
@@ -1921,7 +1921,7 @@ CIDFont_type0_t1dofont (CIDFont *font)
cffont->fdarray[0] = cff_new_dict();
cff_dict_add(cffont->fdarray[0], "FontName", 1);
cff_dict_set(cffont->fdarray[0], "FontName", 0,
- (double) cff_add_string(cffont, font->fontname + 7)); /* FIXME: Skip XXXXXX+ */
+ (double) cff_add_string(cffont, font->fontname + 7, 1)); /* FIXME: Skip XXXXXX+ */
cff_dict_add(cffont->fdarray[0], "Private", 2);
cff_dict_set(cffont->fdarray[0], "Private", 0, 0.0);
cff_dict_set(cffont->fdarray[0], "Private", 0, 0.0);
@@ -1998,8 +1998,8 @@ CIDFont_type0_t1dofont (CIDFont *font)
RELEASE(CIDToGIDMap);
- cff_add_string(cffont, (char *)"Adobe");
- cff_add_string(cffont, (char *)"Identity");
+ cff_add_string(cffont, "Adobe", 1);
+ cff_add_string(cffont, "Identity", 1);
cff_dict_update(cffont->topdict, cffont);
cff_dict_update(cffont->private[0], cffont);
diff --git a/Build/source/texk/dvipdfmx/src/dpxconf.c b/Build/source/texk/dvipdfmx/src/dpxconf.c
index 29193df1032..03a22589003 100644
--- a/Build/source/texk/dvipdfmx/src/dpxconf.c
+++ b/Build/source/texk/dvipdfmx/src/dpxconf.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/dpxconf.c,v 1.2 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/dpxconf.c,v 1.3 2008/11/30 21:12:27 matthias Exp $
This is DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks.
@@ -94,6 +94,7 @@ paperinfo (const char *ppformat)
#endif /* HAVE_LIBPAPER */
+#if 0
void
dumppaperinfo (void)
{
@@ -108,4 +109,4 @@ dumppaperinfo (void)
ppinfo = papernext(ppinfo);
}
}
-
+#endif
diff --git a/Build/source/texk/dvipdfmx/src/dpxconf.h b/Build/source/texk/dvipdfmx/src/dpxconf.h
index 8e097d93533..63a73ddef4f 100644
--- a/Build/source/texk/dvipdfmx/src/dpxconf.h
+++ b/Build/source/texk/dvipdfmx/src/dpxconf.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/dpxconf.h,v 1.1 2005/07/20 10:41:54 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/dpxconf.h,v 1.2 2008/11/30 21:12:27 matthias Exp $
This is DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks.
@@ -55,6 +55,8 @@ extern const struct paper *paperinfo (const char *ppformat);
#define systempapersizefile() NULL
#endif /* HAVE_LIBPAPER */
+#if 0
extern void dumppaperinfo (void);
+#endif
#endif /* _DPXCONF_H_ */
diff --git a/Build/source/texk/dvipdfmx/src/dpxutil.c b/Build/source/texk/dvipdfmx/src/dpxutil.c
index a30a3269dfa..e153d050476 100644
--- a/Build/source/texk/dvipdfmx/src/dpxutil.c
+++ b/Build/source/texk/dvipdfmx/src/dpxutil.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/dpxutil.c,v 1.8 2007/11/14 03:36:01 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/dpxutil.c,v 1.9 2008/11/03 22:49:29 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -185,7 +185,7 @@ ht_clear_table (struct ht_table *ht, void (*hval_free_fn) (void *))
hent = ht->table[i];
while (hent) {
- if (hent->value) {
+ if (hent->value && hval_free_fn) {
hval_free_fn(hent->value);
}
hent->value = NULL;
@@ -262,7 +262,9 @@ ht_remove_table (struct ht_table *ht,
RELEASE(hent->key);
hent->key = NULL;
hent->keylen = 0;
- hval_free_fn(hent->value);
+ if (hent->value && hval_free_fn) {
+ hval_free_fn(hent->value);
+ }
hent->value = NULL;
if (prev) {
prev->next = hent->next;
@@ -299,7 +301,8 @@ ht_insert_table (struct ht_table *ht,
hent = hent->next;
}
if (hent) {
- hval_free_fn(hent->value);
+ if (hent->value && hval_free_fn)
+ hval_free_fn(hent->value);
hent->value = value;
} else {
hent = NEW(1, struct ht_entry);
diff --git a/Build/source/texk/dvipdfmx/src/dvi.c b/Build/source/texk/dvipdfmx/src/dvi.c
index 232efca6d14..571489c15e5 100644
--- a/Build/source/texk/dvipdfmx/src/dvi.c
+++ b/Build/source/texk/dvipdfmx/src/dvi.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/dvi.c,v 1.38 2006/12/06 12:50:40 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/dvi.c,v 1.39 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -483,11 +483,13 @@ dvi_do_special (const void *buffer, UNSIGNED_QUAD size)
return;
}
+#if 0
double
dvi_unit_size (void)
{
return dvi2pts;
}
+#endif
int
diff --git a/Build/source/texk/dvipdfmx/src/dvi.h b/Build/source/texk/dvipdfmx/src/dvi.h
index cfbae65f41c..13ae1526a96 100644
--- a/Build/source/texk/dvipdfmx/src/dvi.h
+++ b/Build/source/texk/dvipdfmx/src/dvi.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/dvi.h,v 1.13 2006/12/06 12:50:40 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/dvi.h,v 1.14 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -37,7 +37,9 @@ extern double dvi_init (const char *dvi_filename, double mag);
extern void dvi_close (void); /* Closes data structures created by dvi_open */
extern double dvi_tell_mag (void);
+#if 0
extern double dvi_unit_size (void);
+#endif
extern double dvi_dev_xpos (void);
extern double dvi_dev_ypos (void);
extern unsigned dvi_npages (void);
diff --git a/Build/source/texk/dvipdfmx/src/dvipdfmx.c b/Build/source/texk/dvipdfmx/src/dvipdfmx.c
index 08fdabcfc08..27b0792afa2 100644
--- a/Build/source/texk/dvipdfmx/src/dvipdfmx.c
+++ b/Build/source/texk/dvipdfmx/src/dvipdfmx.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/dvipdfmx.c,v 1.64 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/dvipdfmx.c,v 1.68 2009/01/15 21:46:08 chofchof Exp $
This is DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks.
@@ -68,6 +68,7 @@ static long opt_flags = 0;
#define OPT_TPIC_TRANSPARENT_FILL (1 << 1)
#define OPT_CIDFONT_FIXEDPITCH (1 << 2)
#define OPT_FONTMAP_FIRST_MATCH (1 << 3)
+#define OPT_PDFDOC_NO_DEST_REMOVE (1 << 4)
static char ignore_colors = 0;
static double annot_grow = 0.0;
@@ -126,7 +127,7 @@ usage (void)
{
fprintf (stdout, "\nThis is %s-%s by the DVIPDFMx project team,\n", PACKAGE, VERSION);
fprintf (stdout, "an extended version of dvipdfm-0.13.2c developed by Mark A. Wicks.\n");
- fprintf (stdout, "\nCopyright (C) 2002-2008 by the DVIPDFMx project team\n");
+ fprintf (stdout, "\nCopyright (C) 2002-2009 by the DVIPDFMx project team\n");
fprintf (stdout, "\nThis is free software; you can redistribute it and/or modify\n");
fprintf (stdout, "it under the terms of the GNU General Public License as published by\n");
fprintf (stdout, "the Free Software Foundation; either version 2 of the License, or\n");
@@ -156,6 +157,7 @@ usage (void)
fprintf (stdout, "\t\t\t instead of opaque gray color. (requires PDF 1.4)\n");
fprintf (stdout, "\t\t 0x0004 Treat all CIDFont as fixed-pitch font.\n");
fprintf (stdout, "\t\t 0x0008 Do not replace duplicate fontmap entries.\n");
+ fprintf (stdout, "\t\t 0x0010 Do not remove unused PDF destinations.\n");
fprintf (stdout, "\t\tPositive values are always ORed with previously given flags.\n");
fprintf (stdout, "\t\tAnd negative values replace old values.\n");
fprintf (stdout, "-D template\tPS->PDF conversion command line template [none]\n");
@@ -316,14 +318,16 @@ select_pages (const char *pagespec)
static void
set_verbose (int argc, char *argv[])
{
- while (argc > 0 && *argv[0] == '-') {
- char *flag;
-
- for (flag = argv[0] + 1; *flag != 0; flag++) {
- if (*flag == 'q')
- really_quiet = 1;
- if (*flag == 'v')
- verbose++;
+ while (argc > 0) {
+ if(*argv[0] == '-') {
+ char *flag;
+
+ for (flag = argv[0] + 1; *flag != 0; flag++) {
+ if (*flag == 'q')
+ really_quiet = 1;
+ if (*flag == 'v')
+ verbose++;
+ }
}
POP_ARG();
}
@@ -859,7 +863,8 @@ main (int argc, char *argv[])
* bookmark_open: Miximal depth of open bookmarks.
*/
pdf_open_document(pdf_filename, do_encryption,
- paper_width, paper_height, annot_grow, bookmark_open);
+ paper_width, paper_height, annot_grow, bookmark_open,
+ !(opt_flags & OPT_PDFDOC_NO_DEST_REMOVE));
/* Ignore_colors placed here since
* they are considered as device's capacity.
diff --git a/Build/source/texk/dvipdfmx/src/epdf.c b/Build/source/texk/dvipdfmx/src/epdf.c
index 31b938a9ca3..0da13e58a7b 100644
--- a/Build/source/texk/dvipdfmx/src/epdf.c
+++ b/Build/source/texk/dvipdfmx/src/epdf.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/epdf.c,v 1.23 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/epdf.c,v 1.25 2008/10/01 00:48:46 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -42,396 +42,161 @@
#include "pdfobj.h"
#include "pdfdev.h"
+#include "pdfdoc.h"
#include "pdfximage.h"
#include "epdf.h"
-static int rect_equal (pdf_obj *rect1, pdf_obj *rect2);
-
-/*
- * From PDFReference15_v6.pdf (p.119 and p.834)
- *
- * MediaBox rectangle (Required; inheritable)
- *
- * The media box defines the boundaries of the physical medium on which the
- * page is to be printed. It may include any extended area surrounding the
- * finished page for bleed, printing marks, or other such purposes. It may
- * also include areas close to the edges of the medium that cannot be marked
- * because of physical limitations of the output device. Content falling
- * outside this boundary can safely be discarded without affecting the
- * meaning of the PDF file.
- *
- * CropBox rectangle (Optional; inheritable)
- *
- * The crop box defines the region to which the contents of the page are to be
- * clipped (cropped) when displayed or printed. Unlike the other boxes, the
- * crop box has no defined meaning in terms of physical page geometry or
- * intended use; it merely imposes clipping on the page contents. However,
- * in the absence of additional information (such as imposition instructions
- * specified in a JDF or PJTF job ticket), the crop box will determine how
- * the page’s contents are to be positioned on the output medium. The default
- * value is the page’s media box.
- *
- * BleedBox rectangle (Optional; PDF 1.3)
- *
- * The bleed box (PDF 1.3) defines the region to which the contents of the
- * page should be clipped when output in a production environment. This may
- * include any extra “bleed area” needed to accommodate the physical
- * limitations of cutting, folding, and trimming equipment. The actual printed
- * page may include printing marks that fall outside the bleed box.
- * The default value is the page’s crop box.
- *
- * TrimBox rectangle (Optional; PDF 1.3)
- *
- * The trim box (PDF 1.3) defines the intended dimensions of the finished page
- * after trimming. It may be smaller than the media box, to allow for
- * production-related content such as printing instructions, cut marks, or
- * color bars. The default value is the page’s crop box.
- *
- * ArtBox rectangle (Optional; PDF 1.3)
- *
- * The art box (PDF 1.3) defines the extent of the page’s meaningful content
- * (including potential white space) as intended by the page’s creator.
- * The default value is the page’s crop box.
- *
- * Rotate integer (Optional; inheritable)
- *
- * The number of degrees by which the page should be rotated clockwise when
- * displayed or printed. The value must be a multiple of 90. Default value: 0.
- */
-
-static int
-rect_equal (pdf_obj *rect1, pdf_obj *rect2)
-{
- int i;
-
- if (!rect1 || !rect2)
- return 0;
- for (i = 0; i < 4; i++) {
- if (pdf_number_value(pdf_get_array(rect1, i)) !=
- pdf_number_value(pdf_get_array(rect2, i)))
- return 0;
- }
-
- return 1;
-}
-
int
pdf_include_page (pdf_ximage *ximage, FILE *image_file)
{
char *ident = pdf_ximage_get_ident(ximage);
pdf_file *pf;
xform_info info;
- pdf_obj *contents, *contents_dict;
- pdf_obj *page_tree;
- pdf_obj *bbox = NULL, *resources = NULL, *rotate = NULL, *matrix;
- long page_no, page_idx;
+ pdf_obj *trailer, *contents = NULL;
+ pdf_obj *page = NULL, *resources = NULL, *markinfo = NULL;
+ long page_no, count;
pdf_ximage_init_form_info(&info);
- /*
- * Get Page Tree.
- */
- page_tree = NULL;
- {
- pdf_obj *trailer, *catalog;
- pdf_obj *markinfo, *tmp;
-
- pf = pdf_open(ident, image_file);
- if (!pf)
- return -1;
-
- trailer = pdf_file_get_trailer(pf);
-
- if (pdf_lookup_dict(trailer, "Encrypt")) {
- WARN("This PDF document is encrypted.");
- pdf_release_obj(trailer);
- pdf_close(pf);
- return -1;
- }
-
- catalog = pdf_deref_obj(pdf_lookup_dict(trailer, "Root"));
- if (!PDF_OBJ_DICTTYPE(catalog)) {
- WARN("Can't read document catalog.");
- pdf_release_obj(trailer);
- if (catalog)
- pdf_release_obj(catalog);
- pdf_close(pf);
- return -1;
- }
- pdf_release_obj(trailer);
-
- markinfo = pdf_deref_obj(pdf_lookup_dict(catalog, "MarkInfo"));
- if (markinfo) {
- tmp = pdf_lookup_dict(markinfo, "Marked");
- if (PDF_OBJ_BOOLEANTYPE(tmp) && pdf_boolean_value(tmp))
- WARN("File contains tagged PDF. Ignoring tags.");
- pdf_release_obj(markinfo);
- }
-
- page_tree = pdf_deref_obj(pdf_lookup_dict(catalog, "Pages"));
- pdf_release_obj(catalog);
- }
- if (!page_tree) {
- WARN("Page tree not found.");
- pdf_close(pf);
- return -1;
- }
-
- /*
- * Negative page numbers are counted from the back.
- */
- {
- long count = pdf_number_value(pdf_lookup_dict(page_tree, "Count"));
- page_no = pdf_ximage_get_page(ximage);
- page_idx = page_no + (page_no >= 0 ? -1 : count);
- if (page_idx < 0 || page_idx >= count) {
- WARN("Page %ld does not exist.", page_no);
- pdf_release_obj(page_tree);
- pdf_close(pf);
- return -1;
- }
- page_no = page_idx+1;
- pdf_ximage_set_page(ximage, page_no, count);
- }
-
- /*
- * Seek correct page. Get Media/Crop Box.
- * Media box and resources can be inherited.
- */
- {
- pdf_obj *kids_ref, *kids;
- pdf_obj *crop_box = NULL;
- pdf_obj *tmp;
-
- tmp = pdf_lookup_dict(page_tree, "Resources");
- resources = tmp ? pdf_deref_obj(tmp) : pdf_new_dict();
-
- while (1) {
- long kids_length, i;
-
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "MediaBox")))) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "BleedBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "TrimBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "ArtBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "CropBox")))) {
- if (crop_box)
- pdf_release_obj(crop_box);
- crop_box = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Rotate")))) {
- if (rotate)
- pdf_release_obj(rotate);
- rotate = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Resources")))) {
-#if 0
- pdf_merge_dict(tmp, resources);
-#endif
- if (resources)
- pdf_release_obj(resources);
- resources = tmp;
- }
- kids_ref = pdf_lookup_dict(page_tree, "Kids");
- if (!kids_ref)
- break;
- kids = pdf_deref_obj(kids_ref);
- kids_length = pdf_array_length(kids);
-
- for (i = 0; i < kids_length; i++) {
- long count;
-
- pdf_release_obj(page_tree);
- page_tree = pdf_deref_obj(pdf_get_array(kids, i));
+ pf = pdf_open(ident, image_file);
+ if (!pf)
+ return -1;
- tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Count"));
- if (tmp) {
- /* Pages object */
- count = pdf_number_value(tmp);
- pdf_release_obj(tmp);
- } else
- /* Page object */
- count = 1;
+ trailer = pdf_file_get_trailer(pf);
- if (page_idx < count)
- break;
+ page_no = pdf_ximage_get_page(ximage);
- page_idx -= count;
- }
-
- pdf_release_obj(kids);
-
- if (i == kids_length) {
- WARN("Page %ld not found! Broken PDF file?", page_no);
- if (bbox)
- pdf_release_obj(bbox);
- if (crop_box)
- pdf_release_obj(crop_box);
- if (rotate)
- pdf_release_obj(rotate);
- pdf_release_obj(resources);
- pdf_release_obj(page_tree);
- pdf_close(pf);
- return -1;
- }
- }
- if (crop_box) {
- pdf_release_obj(bbox);
- bbox = crop_box;
- }
- }
+ page = pdf_doc_get_page(trailer, &page_no, &count,
+ &info.bbox, &resources, &markinfo);
- if (!bbox) {
- WARN("No BoundingBox information available.");
- pdf_release_obj(page_tree);
- pdf_release_obj(resources);
- if (rotate)
- pdf_release_obj(rotate);
- pdf_close(pf);
- return -1;
- }
+ if(!page)
+ goto error_silent;
- if (rotate) {
- if (pdf_number_value(rotate) != 0.0)
- WARN("<< /Rotate %d >> found. (Not supported yet)", (int)pdf_number_value(rotate));
- pdf_release_obj(rotate);
- rotate = NULL;
+ if (markinfo) {
+ pdf_obj *tmp = pdf_deref_obj(pdf_lookup_dict(markinfo, "Marked"));
+ pdf_release_obj(markinfo);
+ if (!PDF_OBJ_BOOLEANTYPE(tmp)) {
+ if (tmp)
+ pdf_release_obj(tmp);
+ goto error;
+ } else if (pdf_boolean_value(tmp))
+ WARN("File contains tagged PDF. Ignoring tags.");
+ pdf_release_obj(tmp);
}
- {
- pdf_obj *tmp;
+ /*
+ * We must update ximage because page_no might have been changed
+ * by pdf_doc_get_page from negative to positive.
+ */
+ pdf_ximage_set_page(ximage, page_no, count);
- tmp = pdf_deref_obj(pdf_get_array(bbox, 0));
- info.bbox.llx = pdf_number_value(tmp);
- pdf_release_obj(tmp);
- tmp = pdf_deref_obj(pdf_get_array(bbox, 1));
- info.bbox.lly = pdf_number_value(tmp);
- pdf_release_obj(tmp);
- tmp = pdf_deref_obj(pdf_get_array(bbox, 2));
- info.bbox.urx = pdf_number_value(tmp);
- pdf_release_obj(tmp);
- tmp = pdf_deref_obj(pdf_get_array(bbox, 3));
- info.bbox.ury = pdf_number_value(tmp);
- pdf_release_obj(tmp);
- }
+ contents = pdf_deref_obj(pdf_lookup_dict(page, "Contents"));
+ pdf_release_obj(page);
/*
* Handle page content stream.
- * page_tree is now set to the correct page.
*/
{
- contents = pdf_deref_obj(pdf_lookup_dict(page_tree, "Contents"));
- pdf_release_obj(page_tree);
+ pdf_obj *content_new;
if (!contents) {
- /* empty page */
- if (contents)
- pdf_release_obj(contents);
+ /*
+ * Empty page
+ */
+ content_new = pdf_new_stream(0);
/* TODO: better don't include anything if the page is empty */
- contents = pdf_new_stream(0);
+ } else if (PDF_OBJ_STREAMTYPE(contents)) {
+ /*
+ * We must import the stream because its dictionary
+ * may contain indirect references.
+ */
+ content_new = pdf_import_object(contents);
} else if (PDF_OBJ_ARRAYTYPE(contents)) {
/*
* Concatenate all content streams.
*/
- pdf_obj *content_seg, *content_new;
- int idx = 0;
+ int idx, len = pdf_array_length(contents);
content_new = pdf_new_stream(STREAM_COMPRESS);
- for (;;) {
- content_seg = pdf_deref_obj(pdf_get_array(contents, idx));
- if (!content_seg)
- break;
- else if (!PDF_OBJ_STREAMTYPE(content_seg)) {
- WARN("Page content not a stream object. Broken PDF file?");
- pdf_release_obj(content_new);
- pdf_release_obj(bbox);
- pdf_close(pf);
- return -1;
- } else if (pdf_concat_stream(content_new, content_seg) < 0) {
- WARN("Could not handle content stream with multiple segment.");
+ for (idx = 0; idx < len; idx++) {
+ pdf_obj *content_seg = pdf_deref_obj(pdf_get_array(contents, idx));
+ if (!PDF_OBJ_STREAMTYPE(content_seg) ||
+ pdf_concat_stream(content_new, content_seg) < 0) {
+ pdf_release_obj(content_seg);
pdf_release_obj(content_new);
- pdf_release_obj(bbox);
- pdf_close(pf);
- return -1;
+ goto error;
}
pdf_release_obj(content_seg);
- idx++;
}
+ } else
+ goto error;
+
+ if (contents)
pdf_release_obj(contents);
- contents = content_new;
- } else if (pdf_obj_typeof(contents) != PDF_STREAM) {
- WARN("Page content not a stream object.");
- pdf_release_obj(contents);
- pdf_release_obj(bbox);
- pdf_close(pf);
- return -1;
- }
+ contents = content_new;
}
+ /*
+ * Add entries to contents stream dictionary.
+ */
{
- pdf_obj *tmp;
-
- tmp = pdf_import_object(resources);
+ pdf_obj *contents_dict, *bbox, *matrix;
+
+ contents_dict = pdf_stream_dict(contents);
+ pdf_add_dict(contents_dict,
+ pdf_new_name("Type"),
+ pdf_new_name("XObject"));
+ pdf_add_dict(contents_dict,
+ pdf_new_name("Subtype"),
+ pdf_new_name("Form"));
+ pdf_add_dict(contents_dict,
+ pdf_new_name("FormType"),
+ pdf_new_number(1.0));
+
+ bbox = pdf_new_array();
+ pdf_add_array(bbox, pdf_new_number(info.bbox.llx));
+ pdf_add_array(bbox, pdf_new_number(info.bbox.lly));
+ pdf_add_array(bbox, pdf_new_number(info.bbox.urx));
+ pdf_add_array(bbox, pdf_new_number(info.bbox.ury));
+
+ pdf_add_dict(contents_dict, pdf_new_name("BBox"), bbox);
+
+ matrix = pdf_new_array();
+ pdf_add_array(matrix, pdf_new_number(1.0));
+ pdf_add_array(matrix, pdf_new_number(0.0));
+ pdf_add_array(matrix, pdf_new_number(0.0));
+ pdf_add_array(matrix, pdf_new_number(1.0));
+ pdf_add_array(matrix, pdf_new_number(0.0));
+ pdf_add_array(matrix, pdf_new_number(0.0));
+
+ pdf_add_dict(contents_dict, pdf_new_name("Matrix"), matrix);
+
+ pdf_add_dict(contents_dict,
+ pdf_new_name("Resources"),
+ pdf_import_object(resources));
pdf_release_obj(resources);
- resources = tmp;
- tmp = pdf_import_object(bbox);
- pdf_release_obj(bbox);
- bbox = tmp;
}
pdf_close(pf);
- contents_dict = pdf_stream_dict(contents);
- pdf_add_dict(contents_dict,
- pdf_new_name("Type"),
- pdf_new_name("XObject"));
- pdf_add_dict(contents_dict,
- pdf_new_name("Subtype"),
- pdf_new_name("Form"));
- pdf_add_dict(contents_dict,
- pdf_new_name("FormType"),
- pdf_new_number(1.0));
-
- pdf_add_dict(contents_dict, pdf_new_name("BBox"), bbox);
-
- matrix = pdf_new_array();
- pdf_add_array(matrix, pdf_new_number(1.0));
- pdf_add_array(matrix, pdf_new_number(0.0));
- pdf_add_array(matrix, pdf_new_number(0.0));
- pdf_add_array(matrix, pdf_new_number(1.0));
- pdf_add_array(matrix, pdf_new_number(0.0));
- pdf_add_array(matrix, pdf_new_number(0.0));
+ pdf_ximage_set_form(ximage, &info, contents);
- pdf_add_dict(contents_dict, pdf_new_name("Matrix"), matrix);
+ return 0;
- pdf_add_dict(contents_dict, pdf_new_name("Resources"), resources);
+ error:
+ WARN("Cannot parse document. Broken PDF file?");
+ error_silent:
+ if (resources)
+ pdf_release_obj(resources);
+ if (markinfo)
+ pdf_release_obj(markinfo);
+ if (page)
+ pdf_release_obj(page);
+ if (contents)
+ pdf_release_obj(contents);
- pdf_ximage_set_form(ximage, &info, contents);
+ pdf_close(pf);
- return 0;
+ return -1;
}
diff --git a/Build/source/texk/dvipdfmx/src/fontmap.c b/Build/source/texk/dvipdfmx/src/fontmap.c
index 2076eaedb97..7215ea6dea5 100644
--- a/Build/source/texk/dvipdfmx/src/fontmap.c
+++ b/Build/source/texk/dvipdfmx/src/fontmap.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/fontmap.c,v 1.40 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/fontmap.c,v 1.41 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -1111,12 +1111,14 @@ pdf_close_fontmaps (void)
release_sfd_record();
}
+#if 0
void
pdf_clear_fontmaps (void)
{
pdf_close_fontmaps();
pdf_init_fontmaps();
}
+#endif
/* CIDFont options
*
diff --git a/Build/source/texk/dvipdfmx/src/fontmap.h b/Build/source/texk/dvipdfmx/src/fontmap.h
index b8314ab8f71..2445373dca0 100644
--- a/Build/source/texk/dvipdfmx/src/fontmap.h
+++ b/Build/source/texk/dvipdfmx/src/fontmap.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/fontmap.h,v 1.22 2008/05/18 08:09:09 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/fontmap.h,v 1.23 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -75,7 +75,9 @@ typedef struct fontmap_rec {
extern void pdf_fontmap_set_verbose (void);
extern void pdf_init_fontmaps (void);
+#if 0
extern void pdf_clear_fontmaps (void);
+#endif
extern void pdf_close_fontmaps (void);
extern void pdf_init_fontmap_record (fontmap_rec *mrec);
diff --git a/Build/source/texk/dvipdfmx/src/mem.c b/Build/source/texk/dvipdfmx/src/mem.c
index 97e46cdd0d9..a5435cee40d 100644
--- a/Build/source/texk/dvipdfmx/src/mem.c
+++ b/Build/source/texk/dvipdfmx/src/mem.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/mem.c,v 1.5 2007/11/17 18:08:58 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/mem.c,v 1.6 2008/11/03 22:49:29 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -169,10 +169,15 @@ void *new (size_t size)
void *renew (void *mem, size_t size)
{
- void *result = realloc (mem, size);
- if (!result) {
- ERROR("Out of memory - asked for %lu bytes\n", (unsigned long) size);
+ if (size) {
+ void *result = realloc (mem, size);
+ if (!result) {
+ ERROR("Out of memory - asked for %lu bytes\n", (unsigned long) size);
+ }
+ return result;
+ } else {
+ /* realloc may not return NULL if size == 0 */
+ free(mem);
+ return NULL;
}
-
- return result;
}
diff --git a/Build/source/texk/dvipdfmx/src/mpost.c b/Build/source/texk/dvipdfmx/src/mpost.c
index a123c5a049e..5f5dc74d260 100644
--- a/Build/source/texk/dvipdfmx/src/mpost.c
+++ b/Build/source/texk/dvipdfmx/src/mpost.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/mpost.c,v 1.41 2008/06/05 06:27:42 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/mpost.c,v 1.42 2008/12/11 16:03:04 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -1213,7 +1213,8 @@ do_operator (const char *token, double x_user, double y_user)
pdf_color_cmykcolor(&color,
values[0], values[1],
values[2], values[3]);
- pdf_dev_set_color(&color);
+ pdf_dev_set_strokingcolor(&color);
+ pdf_dev_set_nonstrokingcolor(&color);
}
break;
case SETGRAY:
@@ -1221,7 +1222,8 @@ do_operator (const char *token, double x_user, double y_user)
error = pop_get_numbers(values, 1);
if (!error) {
pdf_color_graycolor(&color, values[0]);
- pdf_dev_set_color(&color);
+ pdf_dev_set_strokingcolor(&color);
+ pdf_dev_set_nonstrokingcolor(&color);
}
break;
case SETRGBCOLOR:
@@ -1229,7 +1231,8 @@ do_operator (const char *token, double x_user, double y_user)
if (!error) {
pdf_color_rgbcolor(&color,
values[0], values[1], values[2]);
- pdf_dev_set_color(&color);
+ pdf_dev_set_strokingcolor(&color);
+ pdf_dev_set_nonstrokingcolor(&color);
}
break;
diff --git a/Build/source/texk/dvipdfmx/src/numbers.c b/Build/source/texk/dvipdfmx/src/numbers.c
index 2a0b2c3a0c2..4b1a56524d3 100644
--- a/Build/source/texk/dvipdfmx/src/numbers.c
+++ b/Build/source/texk/dvipdfmx/src/numbers.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/numbers.c,v 1.8 2004/03/03 13:19:00 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/numbers.c,v 1.9 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -35,10 +35,12 @@ UNSIGNED_BYTE get_unsigned_byte (FILE *file)
return (UNSIGNED_BYTE) ch;
}
+#if 0
UNSIGNED_BYTE sget_unsigned_byte (char *s)
{
return *((unsigned char *) s);
}
+#endif
SIGNED_BYTE get_signed_byte (FILE *file)
{
@@ -168,6 +170,7 @@ SIGNED_QUAD sqxfw (SIGNED_QUAD sq, fixword fw)
return (sign > 0) ? result : result * -1L;
}
+#if 0
SIGNED_QUAD axboverc (SIGNED_QUAD n1, SIGNED_QUAD n2, SIGNED_QUAD divide)
{
int sign = 1;
@@ -221,4 +224,5 @@ SIGNED_QUAD axboverc (SIGNED_QUAD n1, SIGNED_QUAD n2, SIGNED_QUAD divide)
result += 1;
return (sign>0)?result:-result;
}
+#endif
diff --git a/Build/source/texk/dvipdfmx/src/numbers.h b/Build/source/texk/dvipdfmx/src/numbers.h
index 9e6b2306508..485794cd5be 100644
--- a/Build/source/texk/dvipdfmx/src/numbers.h
+++ b/Build/source/texk/dvipdfmx/src/numbers.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/numbers.h,v 1.9 2005/07/20 10:41:54 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/numbers.h,v 1.10 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -35,7 +35,9 @@ typedef long UNSIGNED_TRIPLE, SIGNED_TRIPLE, SIGNED_QUAD;
typedef unsigned long UNSIGNED_QUAD;
extern UNSIGNED_BYTE get_unsigned_byte (FILE *);
+#if 0
extern UNSIGNED_BYTE sget_unsigned_byte (char *);
+#endif
extern SIGNED_BYTE get_signed_byte (FILE *);
extern UNSIGNED_PAIR get_unsigned_pair (FILE *);
extern UNSIGNED_PAIR sget_unsigned_pair (unsigned char *);
@@ -48,7 +50,9 @@ extern UNSIGNED_QUAD get_unsigned_quad (FILE *);
typedef signed long fixword;
extern SIGNED_QUAD sqxfw (SIGNED_QUAD sq, fixword fw);
+#if 0
extern SIGNED_QUAD axboverc (SIGNED_QUAD n1, SIGNED_QUAD n2, SIGNED_QUAD divide);
+#endif
#ifndef MAX
# define MAX(a,b) ((a)>(b)?(a):(b))
diff --git a/Build/source/texk/dvipdfmx/src/pdfcolor.c b/Build/source/texk/dvipdfmx/src/pdfcolor.c
index ab908079ec3..e44ca6176f3 100644
--- a/Build/source/texk/dvipdfmx/src/pdfcolor.c
+++ b/Build/source/texk/dvipdfmx/src/pdfcolor.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfcolor.c,v 1.14 2007/11/22 11:45:39 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfcolor.c,v 1.17 2008/12/11 16:03:04 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -36,7 +36,7 @@
#include "dpxfile.h"
#include "pdfdoc.h"
-#include "pdfdev.h"
+#include "pdfdraw.h"
#include "pdfcolor.h"
@@ -48,6 +48,17 @@ pdf_color_set_verbose (void)
verbose++;
}
+/* This function returns PDF_COLORSPACE_TYPE_GRAY,
+ * PDF_COLORSPACE_TYPE_RGB or PDF_COLORSPACE_TYPE_CMYK.
+ */
+int
+pdf_color_type (const pdf_color *color)
+{
+ ASSERT(color);
+
+ return -color->num_components;
+}
+
int
pdf_color_rgbcolor (pdf_color *color, double r, double g, double b)
{
@@ -133,39 +144,54 @@ pdf_color_copycolor (pdf_color *color1, const pdf_color *color2)
memcpy(color1, color2, sizeof(pdf_color));
}
+/* Brighten up a color. f == 0 means no change, f == 1 means white. */
+void
+pdf_color_brighten_color (pdf_color *dst, const pdf_color *src, double f)
+{
+ ASSERT(dst && src);
+
+ if (f == 1.0) {
+ pdf_color_white(dst);
+ } else {
+ double f0, f1;
+ int n;
+
+ n = dst->num_components = src->num_components;
+ f1 = n == 4 ? 0.0 : f; /* n == 4 is CMYK, others are RGB and Gray */
+ f0 = 1.0-f;
+
+ while (n--)
+ dst->values[n] = f0 * src->values[n] + f1;
+ }
+}
+
int
-pdf_color_is_white (pdf_color *color)
+pdf_color_is_white (const pdf_color *color)
{
- int is_white = 0;
+ int n;
+ double f;
ASSERT(color);
- switch (color->num_components) {
- case 1:
- if (color->values[0] == 1.0)
- is_white = 1;
- break;
- case 4:
- if (color->values[0] == 0.0 &&
- color->values[1] == 0.0 &&
- color->values[2] == 0.0 &&
- color->values[3] == 0.0) {
- is_white = 1;
- }
- break;
- case 3:
- if (color->values[0] == 1.0 &&
- color->values[1] == 1.0 &&
- color->values[2] == 1.0) {
- is_white = 1;
- }
- break;
- default:
- is_white = 0;
- break;
- }
+ n = color->num_components;
+ f = n == 4 ? 0.0 : 1.0; /* n == 4 is CMYK, others are RGB and Gray */
+
+ while (n--)
+ if (color->values[n] != f)
+ return 0;
+
+ return 1;
+}
- return is_white;
+int
+pdf_color_to_string (const pdf_color *color, char *buffer)
+{
+ int i, len = 0;
+
+ for (i = 0; i < color->num_components; i++) {
+ len += sprintf(buffer+len, " %g", ROUND(color->values[i], 0.001));
+ }
+ return len;
}
pdf_color current_fill = {
@@ -178,83 +204,48 @@ pdf_color current_stroke = {
{0.0, 0.0, 0.0, 0.0}
};
-#if 0
/*
* This routine is not a real color matching.
*/
-static int
-compare_color (const pdf_color *color1, const pdf_color *color2)
+int
+pdf_color_compare (const pdf_color *color1, const pdf_color *color2)
{
- if (color1->num_components != color2->num_components)
+ int n = color1->num_components;
+
+ if (n != color2->num_components)
return -1;
- switch (color1->num_components) {
- case 4:
- if (color1->values[0] == color2->values[0] &&
- color1->values[1] == color2->values[1] &&
- color1->values[2] == color2->values[2] &&
- color1->values[3] == color2->values[3])
- return 0;
- break;
- case 3:
- if (color1->values[0] == color2->values[0] &&
- color1->values[1] == color2->values[1] &&
- color1->values[2] == color2->values[2])
- return 0;
- break;
- case 1:
- if (color1->values[0] == color2->values[0])
- return 0;
- break;
- }
+ while (n--)
+ if (color1->values[n] != color2->values[n])
+ return -1;
- return -1;
+ return 0;
}
-#endif
int
-pdf_color_is_valid (pdf_color *color)
+pdf_color_is_valid (const pdf_color *color)
{
- int i, num_components;
+ int n;
- num_components = color->num_components;
- if (num_components != 1 &&
- num_components != 3 &&
- num_components != 4) {
- ERROR("Only RGB/CMYK/Gray currently supported.");
+ n = color->num_components;
+ if (n != 1 && n != 3 && n != 4)
return 0;
- }
- for (i = 0; i < num_components; i++) {
- if (color->values[i] < 0.0 || color->values[i] > 1.0) {
- WARN("Invalid color value: %g", color->values[i]);
+ while (n--)
+ if (color->values[n] < 0.0 || color->values[n] > 1.0)
return 0;
- }
- }
+
return 1;
}
/* Dvipdfm special */
-pdf_color default_color = {
- 1,
- {0.0, 0.0, 0.0, 0.0}
-};
-
-void
-pdf_color_set_default (const pdf_color *color)
-{
- pdf_color_copycolor(&default_color, color);
-}
-
#define DEV_COLOR_STACK_MAX 128
static struct {
int current;
pdf_color stroke[DEV_COLOR_STACK_MAX];
pdf_color fill[DEV_COLOR_STACK_MAX];
-} color_stack = {
- 0,
-};
+} color_stack;
void
pdf_color_clear_stack (void)
@@ -263,21 +254,27 @@ pdf_color_clear_stack (void)
WARN("You've mistakenly made a global color change within nested colors.");
}
color_stack.current = 0;
- pdf_color_copycolor(&color_stack.stroke[color_stack.current], &default_color);
- pdf_color_copycolor(&color_stack.fill[color_stack.current], &default_color);
+ pdf_color_black(color_stack.stroke);
+ pdf_color_black(color_stack.fill);
return;
}
void
+pdf_color_set (pdf_color *sc, pdf_color *fc)
+{
+ pdf_color_copycolor(&color_stack.stroke[color_stack.current], sc);
+ pdf_color_copycolor(&color_stack.fill[color_stack.current], fc);
+ pdf_dev_reset_color(0);
+}
+
+void
pdf_color_push (pdf_color *sc, pdf_color *fc)
{
if (color_stack.current >= DEV_COLOR_STACK_MAX-1) {
WARN("Color stack overflow. Just ignore.");
} else {
color_stack.current++;
- pdf_color_copycolor(&color_stack.stroke[color_stack.current], sc);
- pdf_color_copycolor(&color_stack.fill[color_stack.current], fc);
- pdf_dev_reset_color();
+ pdf_color_set(sc, fc);
}
return;
}
@@ -289,7 +286,7 @@ pdf_color_pop (void)
WARN("Color stack underflow. Just ignore.");
} else {
color_stack.current--;
- pdf_dev_reset_color();
+ pdf_dev_reset_color(0);
}
return;
}
@@ -302,20 +299,6 @@ pdf_color_get_current (pdf_color **sc, pdf_color **fc)
return;
}
-/* BUG (20060330): color change does not effect on the next page.
- * The problem is due to the part of grestore because it restores
- * the color values in the state of gsave which are not correct
- * if the color values are changed inside of a page.
- */
-void
-pdf_dev_preserve_color (void)
-{
- if (color_stack.current > 0) {
- current_stroke = color_stack.stroke[color_stack.current];
- current_fill = color_stack.fill[color_stack.current];
- }
-}
-
/***************************** COLOR SPACE *****************************/
static int pdf_colorspace_defineresource (const char *ident,
@@ -1121,6 +1104,7 @@ iccp_load_profile (const char *ident,
return cspc_id;
}
+#if 0
#define WBUF_SIZE 4096
static unsigned char wbuf[WBUF_SIZE];
@@ -1289,6 +1273,7 @@ pdf_colorspace_load_ICCBased (const char *ident, const char *filename)
return cspc_id;
}
+#endif
typedef struct {
char *ident;
@@ -1452,6 +1437,7 @@ pdf_get_colorspace_reference (int cspc_id)
return pdf_link_obj(colorspace->reference);
}
+#if 0
int
pdf_get_colorspace_num_components (int cspc_id)
{
@@ -1496,6 +1482,7 @@ pdf_get_colorspace_subtype (int cspc_id)
return colorspace->subtype;
}
+#endif
void
pdf_init_colors (void)
diff --git a/Build/source/texk/dvipdfmx/src/pdfcolor.h b/Build/source/texk/dvipdfmx/src/pdfcolor.h
index 769d7e52a5c..6cbc8eeadce 100644
--- a/Build/source/texk/dvipdfmx/src/pdfcolor.h
+++ b/Build/source/texk/dvipdfmx/src/pdfcolor.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfcolor.h,v 1.8 2007/11/22 11:45:39 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfcolor.h,v 1.11 2008/12/11 16:03:04 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -51,15 +51,24 @@ typedef struct
extern void pdf_color_set_verbose (void);
+extern int pdf_color_type (const pdf_color *color);
extern int pdf_color_rgbcolor (pdf_color *color,
double r, double g, double b);
extern int pdf_color_cmykcolor (pdf_color *color,
double c, double m, double y, double k);
extern int pdf_color_graycolor (pdf_color *color, double g);
+#define pdf_color_black(c) pdf_color_graycolor(c, 0.0);
+#define pdf_color_white(c) pdf_color_graycolor(c, 1.0);
+
extern void pdf_color_copycolor (pdf_color *color1, const pdf_color *color2);
+extern void pdf_color_brighten_color (pdf_color *dst, const pdf_color *src, double f);
+
+extern int pdf_color_compare (const pdf_color *color1, const pdf_color *color2);
+
+extern int pdf_color_is_white (const pdf_color *color);
+extern int pdf_color_is_valid (const pdf_color *color);
-extern int pdf_color_is_white (pdf_color *color);
-extern int pdf_color_is_valid (pdf_color *color);
+extern int pdf_color_to_string (const pdf_color *color, char *buffer);
/* Not check size */
extern pdf_obj *iccp_get_rendering_intent (const void *profile, long proflen);
@@ -74,26 +83,23 @@ extern void pdf_init_colors (void);
extern void pdf_close_colors (void);
extern pdf_obj *pdf_get_colorspace_reference (int cspc_id);
+#if 0
extern int pdf_get_colorspace_num_components (int cspc_id);
extern int pdf_get_colorspace_subtype (int cspc_id);
/* Not working */
extern int pdf_colorspace_load_ICCBased (const char *ident,
const char *profile_filename);
+#endif
-/* Color special
+/* Color specials & color stack
* See remark in spc_color.c.
*/
-extern void pdf_color_set_default (const pdf_color *color);
+extern void pdf_color_set (pdf_color *sc, pdf_color *fc);
extern void pdf_color_push (pdf_color *sc, pdf_color *fc);
extern void pdf_color_pop (void);
-/* Color stack
- */
extern void pdf_color_clear_stack (void);
extern void pdf_color_get_current (pdf_color **sc, pdf_color **fc);
-/* Reinstall color */
-extern void pdf_dev_preserve_color(void);
-
#endif /* _PDF_COLOR_H_ */
diff --git a/Build/source/texk/dvipdfmx/src/pdfdev.c b/Build/source/texk/dvipdfmx/src/pdfdev.c
index 0232f3901b1..21ea4e781a7 100644
--- a/Build/source/texk/dvipdfmx/src/pdfdev.c
+++ b/Build/source/texk/dvipdfmx/src/pdfdev.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.c,v 1.66 2008/06/05 06:27:42 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.c,v 1.70 2008/12/11 16:03:04 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -142,30 +142,57 @@ p_itoa (long value, char *buf)
static int
p_dtoa (double value, int prec, char *buf)
{
- int n;
- char *p, *q;
-
- n = sprintf(buf, "%.*f", prec, value);
- /* find decimal-point */
- for (p = buf + n - 1; p > buf && *p != '.'; p--);
- if (p > buf) {
- /* chop trailing zeros */
- for (q = buf + n - 1; q > p && *q == '0'; q--) {
- *q = '\0'; n--;
+ const long p[10] = { 1, 10, 100, 1000, 10000,
+ 100000, 1000000, 10000000, 100000000, 1000000000 };
+ long i, f;
+ char *c = buf;
+ int n;
+
+ if (value < 0) {
+ value = -value;
+ *c++ = '-';
+ n = 1;
+ } else
+ n = 0;
+
+ i = (long) value;
+ f = (long) ((value-i)*p[prec] + 0.5);
+
+ if (f == p[prec]) {
+ f = 0;
+ i++;
+ }
+
+ if (i) {
+ int m = p_itoa(i, c);
+ c += m;
+ n += m;
+ } else if (!f) {
+ *(c = buf) = '0';
+ n = 1;
+ }
+
+ if (f) {
+ int j = prec;
+
+ *c++ = '.';
+
+ while (j--) {
+ c[j] = (f % 10) + '0';
+ f /= 10;
}
- /* If a decimal point appears, at least one digit appears
- * before it.
- */
- if (q == p) {
- *q = '\0'; n--;
+ c += prec-1;
+ n += 1+prec;
+
+ while (*c == '0') {
+ c--;
+ n--;
}
}
- /* -0 --> 0 */
- if (n == 2 && buf[0] == '-' && buf[1] == '0') {
- buf[0] = '0'; buf[1] = '\0'; n = 1;
- }
- return n;
+ *(++c) = 0;
+
+ return n;
}
static int
@@ -824,6 +851,7 @@ dev_set_font (int font_id)
/* Access text state parameters.
*/
+#if 0
int
pdf_dev_currentfont (void)
{
@@ -842,6 +870,7 @@ pdf_dev_get_font_ptsize (int font_id)
return 1.0;
}
+#endif
int
pdf_dev_get_font_wmode (int font_id)
@@ -1207,148 +1236,7 @@ pdf_dev_reset_fonts (void)
text_state.is_mb = 0;
}
-void
-pdf_dev_reset_color(void)
-{
- pdf_color *sc, *fc;
-
- if (pdf_dev_get_param(PDF_DEV_PARAM_COLORMODE)) {
- pdf_color_get_current(&sc, &fc);
- pdf_dev_set_strokingcolor(sc);
- pdf_dev_set_nonstrokingcolor(fc);
- }
- return;
-}
-
-static int
-color_to_string (pdf_color *color, char *buffer)
-{
- int i, len = 0;
-
- for (i = 0; i < color->num_components; i++) {
- len += sprintf(format_buffer+len, " %g", ROUND(color->values[i], 0.001));
- }
- return len;
-}
-
-void
-pdf_dev_set_color (pdf_color *color)
-{
- int len;
-
- if (!pdf_dev_get_param(PDF_DEV_PARAM_COLORMODE)) {
- WARN("Ignore color option was set. Just ignore.");
- return;
- } else if (!(color && pdf_color_is_valid(color))) {
- WARN("No valid color is specified. Just ignore.");
- return;
- }
-
- graphics_mode();
- len = color_to_string(color, format_buffer);
- format_buffer[len++] = ' ';
- switch (color->num_components) {
- case 3:
- format_buffer[len++] = 'R';
- format_buffer[len++] = 'G';
- break;
- case 4:
- format_buffer[len++] = 'K';
- break;
- case 1:
- format_buffer[len++] = 'G';
- break;
- default: /* already verified the given color */
- break;
- }
- strncpy(format_buffer+len, format_buffer, len);
- len = len << 1;
- switch (color->num_components) {
- case 3:
- format_buffer[len-2] = 'r';
- format_buffer[len-1] = 'g';
- break;
- case 4:
- format_buffer[len-1] = 'k';
- break;
- case 1:
- format_buffer[len-1] = 'g';
- break;
- default: /* already verified the given color */
- break;
- }
- pdf_doc_add_page_content(format_buffer, len);
- return;
-}
-
-void
-pdf_dev_set_strokingcolor (pdf_color *color)
-{
- int len;
-
- if (!pdf_dev_get_param(PDF_DEV_PARAM_COLORMODE)) {
- WARN("Ignore color option was set. Just ignore.");
- return;
- } else if (!(color && pdf_color_is_valid(color))) {
- WARN("No valid color is specified. Just ignore.");
- return;
- }
-
- graphics_mode();
- len = color_to_string(color, format_buffer);
- format_buffer[len++] = ' ';
- switch (color->num_components) {
- case 3:
- format_buffer[len++] = 'R';
- format_buffer[len++] = 'G';
- break;
- case 4:
- format_buffer[len++] = 'K';
- break;
- case 1:
- format_buffer[len++] = 'G';
- break;
- default: /* already verified the given color */
- break;
- }
- pdf_doc_add_page_content(format_buffer, len);
- return;
-}
-
-void
-pdf_dev_set_nonstrokingcolor (pdf_color *color)
-{
- int len;
-
- if (!pdf_dev_get_param(PDF_DEV_PARAM_COLORMODE)) {
- WARN("Ignore color option was set. Just ignore.");
- return;
- } else if (!(color && pdf_color_is_valid(color))) {
- WARN("No valid color is specified. Just ignore.");
- return;
- }
-
- graphics_mode();
- len = color_to_string(color, format_buffer);
- format_buffer[len++] = ' ';
- switch (color->num_components) {
- case 3:
- format_buffer[len++] = 'r';
- format_buffer[len++] = 'g';
- break;
- case 4:
- format_buffer[len++] = 'k';
- break;
- case 1:
- format_buffer[len++] = 'g';
- break;
- default: /* already verified the given color */
- break;
- }
- pdf_doc_add_page_content(format_buffer, len);
- return;
-}
-
+#if 0
/* Not working */
void
pdf_dev_set_origin (double phys_x, double phys_y)
@@ -1363,6 +1251,7 @@ pdf_dev_set_origin (double phys_x, double phys_y)
pdf_dev_concat(&M1);
}
+#endif
void
pdf_dev_bop (const pdf_tmatrix *M)
@@ -1375,7 +1264,7 @@ pdf_dev_bop (const pdf_tmatrix *M)
pdf_dev_concat(M);
pdf_dev_reset_fonts();
- pdf_dev_reset_color();
+ pdf_dev_reset_color(0);
}
void
@@ -1807,7 +1696,7 @@ pdf_dev_put_image (int id,
double ref_y)
{
char *res_name;
- pdf_tmatrix M;
+ pdf_tmatrix M, M1;
pdf_rect r;
int len = 0;
@@ -1829,9 +1718,8 @@ pdf_dev_put_image (int id,
graphics_mode();
pdf_dev_gsave();
- pdf_dev_concat(&M);
-
- pdf_ximage_scale_image(id, &M, &r, p);
+ pdf_ximage_scale_image(id, &M1, &r, p);
+ pdf_concatmatrix(&M, &M1);
pdf_dev_concat(&M);
/* Clip */
diff --git a/Build/source/texk/dvipdfmx/src/pdfdev.h b/Build/source/texk/dvipdfmx/src/pdfdev.h
index 4934f053e5e..895236858ea 100644
--- a/Build/source/texk/dvipdfmx/src/pdfdev.h
+++ b/Build/source/texk/dvipdfmx/src/pdfdev.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.h,v 1.23 2008/06/05 06:27:42 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.h,v 1.25 2008/12/11 16:03:05 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -158,14 +158,18 @@ extern int pdf_dev_setfont (const char *font_name, spt_t ptsize);
/* The following two routines are NOT WORKING.
* Dvipdfmx doesn't manage gstate well..
*/
+#if 0
/* pdf_dev_translate() or pdf_dev_concat() should be used. */
extern void pdf_dev_set_origin (double orig_x, double orig_y);
+#endif
/* Always returns 1.0, please rename this. */
extern double pdf_dev_scale (void);
/* Access text state parameters. */
+#if 0
extern int pdf_dev_currentfont (void); /* returns font_id */
extern double pdf_dev_get_font_ptsize (int font_id);
+#endif
extern int pdf_dev_get_font_wmode (int font_id); /* ps: special support want this (pTeX). */
/* Text composition (direction) mode
@@ -200,15 +204,10 @@ extern void pdf_dev_set_param (int param_type, int value);
* For pdf_doc, pdf_draw and others.
*/
-/* Force reselecting font and color:
+/* Force reselecting font:
* XFrom (content grabbing) and Metapost support want them.
*/
extern void pdf_dev_reset_fonts (void);
-extern void pdf_dev_reset_color (void);
-
-extern void pdf_dev_set_color (pdf_color *color);
-extern void pdf_dev_set_strokingcolor (pdf_color *color);
-extern void pdf_dev_set_nonstrokingcolor (pdf_color *color);
/* Initialization of transformation matrix with M and others.
* They are called within pdf_doc_begin_page() and pdf_doc_end_page().
diff --git a/Build/source/texk/dvipdfmx/src/pdfdoc.c b/Build/source/texk/dvipdfmx/src/pdfdoc.c
index 797f2dd820b..38f33fb5a43 100644
--- a/Build/source/texk/dvipdfmx/src/pdfdoc.c
+++ b/Build/source/texk/dvipdfmx/src/pdfdoc.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.c,v 1.57 2008/06/05 06:27:42 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.c,v 1.65 2008/12/11 16:03:05 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -235,6 +235,9 @@ typedef struct pdf_doc
struct name_dict *names;
+ int check_gotos;
+ struct ht_table gotos;
+
struct {
int outline_open_depth;
double annot_grow;
@@ -367,9 +370,11 @@ doc_get_page_entry (pdf_doc *p, unsigned long page_no)
static void pdf_doc_init_page_tree (pdf_doc *p, double media_width, double media_height);
static void pdf_doc_close_page_tree (pdf_doc *p);
-static void pdf_doc_init_names (pdf_doc *p);
+static void pdf_doc_init_names (pdf_doc *p, int check_gotos);
static void pdf_doc_close_names (pdf_doc *p);
+static void pdf_doc_add_gotos (pdf_obj *annot_dict);
+
static void pdf_doc_init_docinfo (pdf_doc *p);
static void pdf_doc_close_docinfo (pdf_doc *p);
@@ -871,6 +876,264 @@ pdf_doc_close_page_tree (pdf_doc *p)
return;
}
+/*
+ * From PDFReference15_v6.pdf (p.119 and p.834)
+ *
+ * MediaBox rectangle (Required; inheritable)
+ *
+ * The media box defines the boundaries of the physical medium on which the
+ * page is to be printed. It may include any extended area surrounding the
+ * finished page for bleed, printing marks, or other such purposes. It may
+ * also include areas close to the edges of the medium that cannot be marked
+ * because of physical limitations of the output device. Content falling
+ * outside this boundary can safely be discarded without affecting the
+ * meaning of the PDF file.
+ *
+ * CropBox rectangle (Optional; inheritable)
+ *
+ * The crop box defines the region to which the contents of the page are to be
+ * clipped (cropped) when displayed or printed. Unlike the other boxes, the
+ * crop box has no defined meaning in terms of physical page geometry or
+ * intended use; it merely imposes clipping on the page contents. However,
+ * in the absence of additional information (such as imposition instructions
+ * specified in a JDF or PJTF job ticket), the crop box will determine how
+ * the page's contents are to be positioned on the output medium. The default
+ * value is the page's media box.
+ *
+ * BleedBox rectangle (Optional; PDF 1.3)
+ *
+ * The bleed box (PDF 1.3) defines the region to which the contents of the
+ * page should be clipped when output in a production environment. This may
+ * include any extra "bleed area" needed to accommodate the physical
+ * limitations of cutting, folding, and trimming equipment. The actual printed
+ * page may include printing marks that fall outside the bleed box.
+ * The default value is the page's crop box.
+ *
+ * TrimBox rectangle (Optional; PDF 1.3)
+ *
+ * The trim box (PDF 1.3) defines the intended dimensions of the finished page
+ * after trimming. It may be smaller than the media box, to allow for
+ * production-related content such as printing instructions, cut marks, or
+ * color bars. The default value is the page's crop box.
+ *
+ * ArtBox rectangle (Optional; PDF 1.3)
+ *
+ * The art box (PDF 1.3) defines the extent of the page's meaningful content
+ * (including potential white space) as intended by the page's creator.
+ * The default value is the page's crop box.
+ *
+ * Rotate integer (Optional; inheritable)
+ *
+ * The number of degrees by which the page should be rotated clockwise when
+ * displayed or printed. The value must be a multiple of 90. Default value: 0.
+ */
+
+pdf_obj *
+pdf_doc_get_page (pdf_obj *trailer, long *page_p, long *count_p,
+ pdf_rect *bbox, pdf_obj **resources_p,
+ pdf_obj **markinfo_p) {
+ pdf_obj *page_tree = NULL;
+ pdf_obj *resources = NULL, *box = NULL, *rotate = NULL;
+ pdf_obj *catalog;
+ long page_no = *page_p, page_idx;
+
+ if (pdf_lookup_dict(trailer, "Encrypt")) {
+ WARN("This PDF document is encrypted.");
+ pdf_release_obj(trailer);
+ goto error_silent;
+ }
+
+ catalog = pdf_deref_obj(pdf_lookup_dict(trailer, "Root"));
+ pdf_release_obj(trailer);
+ if (!PDF_OBJ_DICTTYPE(catalog)) {
+ if (catalog)
+ pdf_release_obj(catalog);
+ goto error;
+ }
+
+ if (markinfo_p)
+ *markinfo_p = pdf_deref_obj(pdf_lookup_dict(catalog, "MarkInfo"));
+
+ page_tree = pdf_deref_obj(pdf_lookup_dict(catalog, "Pages"));
+ pdf_release_obj(catalog);
+
+ if (!PDF_OBJ_DICTTYPE(page_tree))
+ goto error;
+
+ /*
+ * Negative page numbers are counted from the back.
+ */
+ {
+ pdf_obj *tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Count"));
+ if (!PDF_OBJ_NUMBERTYPE(tmp)) {
+ if (tmp)
+ pdf_release_obj(tmp);
+ goto error;
+ }
+ long count = pdf_number_value(tmp);
+ pdf_release_obj(tmp);
+ page_idx = page_no + (page_no >= 0 ? -1 : count);
+ if (page_idx < 0 || page_idx >= count) {
+ WARN("Page %ld does not exist.", page_no);
+ goto error_silent;
+ }
+ page_no = page_idx+1;
+ *page_p = page_no;
+ *count_p = count;
+ }
+
+ /*
+ * Seek correct page. Get MediaBox, CropBox and Resources.
+ * (Note that these entries can be inherited.)
+ */
+ {
+ pdf_obj *media_box = NULL, *crop_box = NULL, *kids, *tmp;
+ int depth = PDF_OBJ_MAX_DEPTH;
+ long kids_length = 1, i = 0;
+
+ while (--depth && i != kids_length) {
+ if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "MediaBox")))) {
+ if (media_box)
+ pdf_release_obj(media_box);
+ media_box = tmp;
+ }
+
+ if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "CropBox")))) {
+ if (crop_box)
+ pdf_release_obj(crop_box);
+ crop_box = tmp;
+ }
+
+ if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Rotate")))) {
+ if (rotate)
+ pdf_release_obj(rotate);
+ rotate = tmp;
+ }
+
+ if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Resources")))) {
+ if (resources)
+ pdf_release_obj(resources);
+ resources = tmp;
+ }
+
+ kids = pdf_deref_obj(pdf_lookup_dict(page_tree, "Kids"));
+ if (!kids)
+ break;
+ else if (!PDF_OBJ_ARRAYTYPE(kids)) {
+ pdf_release_obj(kids);
+ goto error;
+ }
+ kids_length = pdf_array_length(kids);
+
+ for (i = 0; i < kids_length; i++) {
+ long count;
+
+ pdf_release_obj(page_tree);
+ page_tree = pdf_deref_obj(pdf_get_array(kids, i));
+ if (!PDF_OBJ_DICTTYPE(page_tree))
+ goto error;
+
+ tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "Count"));
+ if (PDF_OBJ_NUMBERTYPE(tmp)) {
+ /* Pages object */
+ count = pdf_number_value(tmp);
+ pdf_release_obj(tmp);
+ } else if (!tmp)
+ /* Page object */
+ count = 1;
+ else {
+ pdf_release_obj(tmp);
+ goto error;
+ }
+
+ if (page_idx < count)
+ break;
+
+ page_idx -= count;
+ }
+
+ pdf_release_obj(kids);
+ }
+
+ if (!depth || kids_length == i) {
+ if (media_box)
+ pdf_release_obj(media_box);
+ if (crop_box)
+ pdf_release_obj(crop_box);
+ goto error;
+ }
+
+ if (crop_box)
+ box = crop_box;
+ else
+ if (!(box = pdf_deref_obj(pdf_lookup_dict(page_tree, "ArtBox"))) &&
+ !(box = pdf_deref_obj(pdf_lookup_dict(page_tree, "TrimBox"))) &&
+ !(box = pdf_deref_obj(pdf_lookup_dict(page_tree, "BleedBox"))) &&
+ media_box) {
+ box = media_box;
+ media_box = NULL;
+ }
+ if (media_box)
+ pdf_release_obj(media_box);
+ }
+
+ if (!PDF_OBJ_ARRAYTYPE(box) || pdf_array_length(box) != 4 ||
+ !PDF_OBJ_DICTTYPE(resources))
+ goto error;
+
+ if (PDF_OBJ_NUMBERTYPE(rotate)) {
+ if (pdf_number_value(rotate))
+ WARN("<< /Rotate %d >> found. (Not supported yet)",
+ (int) pdf_number_value(rotate));
+ pdf_release_obj(rotate);
+ rotate = NULL;
+ } else if (rotate)
+ goto error;
+
+ {
+ int i;
+
+ for (i = 4; --i; ) {
+ double x;
+ pdf_obj *tmp = pdf_deref_obj(pdf_get_array(box, i));
+ if (!PDF_OBJ_NUMBERTYPE(tmp)) {
+ pdf_release_obj(tmp);
+ goto error;
+ }
+ x = pdf_number_value(tmp);
+ switch (i) {
+ case 0: bbox->llx = x; break;
+ case 1: bbox->lly = x; break;
+ case 2: bbox->urx = x; break;
+ case 3: bbox->ury = x; break;
+ }
+ pdf_release_obj(tmp);
+ }
+ }
+
+ pdf_release_obj(box);
+
+ if (resources_p)
+ *resources_p = resources;
+ else if (resources)
+ pdf_release_obj(resources);
+
+ return page_tree;
+
+ error:
+ WARN("Cannot parse document. Broken PDF file?");
+ error_silent:
+ if (box)
+ pdf_release_obj(box);
+ if (rotate)
+ pdf_release_obj(rotate);
+ if (resources)
+ pdf_release_obj(resources);
+ if (page_tree)
+ pdf_release_obj(page_tree);
+
+ return NULL;
+}
#ifndef BOOKMARKS_OPEN_DEFAULT
#define BOOKMARKS_OPEN_DEFAULT 0
@@ -1118,6 +1381,8 @@ pdf_doc_bookmarks_add (pdf_obj *dict, int is_open)
p->outlines.current = item;
+ pdf_doc_add_gotos(dict);
+
return;
}
@@ -1160,7 +1425,7 @@ static const char *name_dict_categories[] = {
#define NUM_NAME_CATEGORY (sizeof(name_dict_categories)/sizeof(name_dict_categories[0]))
static void
-pdf_doc_init_names (pdf_doc *p)
+pdf_doc_init_names (pdf_doc *p, int check_gotos)
{
int i;
@@ -1169,11 +1434,19 @@ pdf_doc_init_names (pdf_doc *p)
p->names = NEW(NUM_NAME_CATEGORY + 1, struct name_dict);
for (i = 0; i < NUM_NAME_CATEGORY; i++) {
p->names[i].category = (char *) name_dict_categories[i];
- p->names[i].data = NULL;
+ p->names[i].data = strcmp(name_dict_categories[i], "Dests") ?
+ NULL : pdf_new_name_tree();
+ /*
+ * We need a non-null entry for PDF destinations in order to find
+ * broken links even if no destination is defined in the DVI file.
+ */
}
p->names[NUM_NAME_CATEGORY].category = NULL;
p->names[NUM_NAME_CATEGORY].data = NULL;
+ p->check_gotos = check_gotos;
+ ht_init_table(&p->gotos);
+
return;
}
@@ -1201,6 +1474,119 @@ pdf_doc_add_names (const char *category,
}
static void
+pdf_doc_add_gotos (pdf_obj *annot_dict)
+{
+ pdf_obj *subtype, *A, *S, *D = NULL, *tmp;
+ char *dest;
+
+ if (!pdoc.check_gotos)
+ return;
+
+ /*
+ * We cannot use pdf_deref_obj because if it return NULL
+ * we don't know whether a dictionary does not exist
+ * or has been declared as @foo and not yet defined. (As
+ * long as @foo is undefined, it is stored as "null" object.)
+ */
+
+ /*
+ * An annotation dictionary coming from an annotation special
+ * must have a "Subtype". An annotation dictionary coming from
+ * an outline special has none.
+ */
+ subtype = pdf_lookup_dict(annot_dict, "Subtype");
+ if (PDF_OBJ_INDIRECTTYPE(subtype))
+ goto indirect;
+ else if (subtype && !PDF_OBJ_NULLTYPE(subtype)) {
+ if (!PDF_OBJ_NAMETYPE(subtype))
+ goto error;
+ else if (strcmp(pdf_name_value(subtype), "Link"))
+ return;
+ }
+
+ A = pdf_lookup_dict(annot_dict, "A");
+ if (PDF_OBJ_DICTTYPE(A)) {
+ S = pdf_lookup_dict(A, "S");
+ if (PDF_OBJ_INDIRECTTYPE(S))
+ goto indirect;
+ else if (!PDF_OBJ_NAMETYPE(S))
+ goto error;
+ else if (strcmp(pdf_name_value(S), "GoTo"))
+ return;
+
+ D = pdf_lookup_dict(A, "D");
+ if (PDF_OBJ_NULLTYPE(D))
+ D = NULL;
+ } else if (PDF_OBJ_INDIRECTTYPE(A))
+ goto indirect;
+ else if (A && !PDF_OBJ_NULLTYPE(A))
+ goto error;
+
+ tmp = pdf_lookup_dict(annot_dict, "Dest");
+ if (PDF_OBJ_NULLTYPE(tmp))
+ tmp = NULL;
+
+ if (tmp) {
+ if (D)
+ goto error;
+ else
+ D = tmp;
+ }
+
+ if (PDF_OBJ_STRINGTYPE(D))
+ dest = (char *) pdf_string_value(D);
+#if 0
+ /* Names as destinations are not supported by dvipdfmx */
+ else if (PDF_OBJ_NAMETYPE(D))
+ dest = pdf_name_value(D);
+#endif
+ else if (PDF_OBJ_ARRAYTYPE(D))
+ return;
+ else if (PDF_OBJ_INDIRECTTYPE(D))
+ goto indirect;
+ else
+ goto error;
+
+ ht_insert_table(&pdoc.gotos, dest, strlen(dest), NULL+1, NULL);
+ /* NULL+1 is just some non-null pointer */
+ return;
+
+ indirect:
+ pdoc.check_gotos = 0;
+ if (verbose)
+ MESG("\nFound unexpected annotation format."
+ " Will not remove PDF destinations\n");
+ return;
+
+ error:
+ WARN("Unknown PDF annotation format.");
+ return;
+}
+
+static void
+warn_undef_dests (struct ht_table *dests, struct ht_table *gotos)
+{
+ struct ht_iter iter;
+
+ if (ht_set_iter(gotos, &iter) < 0)
+ return;
+
+ do {
+ int keylen;
+ char *key = ht_iter_getkey(&iter, &keylen);
+ if (!ht_lookup_table(dests, key, keylen)) {
+ char *dest = NEW(keylen+1, char);
+ memcpy(dest, key, keylen);
+ dest[keylen] = 0;
+ WARN("PDF destination \"%s\" not defined.", dest);
+ RELEASE(dest);
+ }
+ } while (ht_iter_next(&iter) >= 0);
+
+ ht_clear_iter(&iter);
+}
+
+static void
pdf_doc_close_names (pdf_doc *p)
{
pdf_obj *tmp;
@@ -1208,15 +1594,30 @@ pdf_doc_close_names (pdf_doc *p)
for (i = 0; p->names[i].category != NULL; i++) {
if (p->names[i].data) {
+ struct ht_table *data = p->names[i].data;
pdf_obj *name_tree;
+ long count;
+
+ if (!pdoc.check_gotos || strcmp(p->names[i].category, "Dests"))
+ name_tree = pdf_names_create_tree(data, &count, NULL);
+ else {
+ name_tree = pdf_names_create_tree(data, &count, &pdoc.gotos);
+
+ if (verbose && count < data->count)
+ MESG("\nRemoved %ld unused PDF destinations\n", data->count-count);
- name_tree = pdf_names_create_tree(p->names[i].data);
- if (!p->root.names) {
- p->root.names = pdf_new_dict();
+ if (count < pdoc.gotos.count)
+ warn_undef_dests(data, &pdoc.gotos);
+ }
+
+ if (name_tree) {
+ if (!p->root.names)
+ p->root.names = pdf_new_dict();
+ pdf_add_dict(p->root.names,
+ pdf_new_name(p->names[i].category),
+ pdf_ref_obj(name_tree));
+ pdf_release_obj(name_tree);
}
- pdf_add_dict(p->root.names,
- pdf_new_name(p->names[i].category), pdf_ref_obj(name_tree));
- pdf_release_obj(name_tree);
pdf_delete_name_tree(&p->names[i].data);
}
}
@@ -1243,6 +1644,8 @@ pdf_doc_close_names (pdf_doc *p)
RELEASE(p->names);
p->names = NULL;
+ ht_clear_table(&p->gotos, NULL);
+
return;
}
@@ -1291,6 +1694,8 @@ pdf_doc_add_annot (unsigned page_no, const pdf_rect *rect, pdf_obj *annot_dict)
pdf_add_array(page->annots, pdf_ref_obj(annot_dict));
+ pdf_doc_add_gotos(annot_dict);
+
return;
}
@@ -1338,11 +1743,13 @@ pdf_doc_begin_article (const char *article_id, pdf_obj *article_info)
return;
}
+#if 0
void
pdf_doc_end_article (const char *article_id)
{
return; /* no-op */
}
+#endif
static pdf_bead *
find_bead (pdf_article *article, const char *bead_id)
@@ -1872,14 +2279,15 @@ pdf_doc_finish_page (pdf_doc *p)
}
-static pdf_color bgcolor = { 1, { 1.0 } };
+static pdf_color bgcolor;
+
void
pdf_doc_set_bgcolor (const pdf_color *color)
{
if (color)
- memcpy(&bgcolor, color, sizeof(pdf_color));
+ pdf_color_copycolor(&bgcolor, color);
else { /* as clear... */
- pdf_color_graycolor(&bgcolor, 1.0);
+ pdf_color_white(&bgcolor);
}
}
@@ -1908,10 +2316,8 @@ doc_fill_page_background (pdf_doc *p)
currentpage->contents = currentpage->background;
pdf_dev_gsave();
- //pdf_color_push();
pdf_dev_set_nonstrokingcolor(&bgcolor);
pdf_dev_rectfill(r.llx, r.lly, r.urx - r.llx, r.ury - r.lly);
- //pdf_color_pop();
pdf_dev_grestore();
currentpage->contents = saved_content;
@@ -1972,7 +2378,8 @@ void
pdf_open_document (const char *filename,
int do_encryption,
double media_width, double media_height,
- double annot_grow_amount, int bookmark_open_depth)
+ double annot_grow_amount, int bookmark_open_depth,
+ int check_gotos)
{
pdf_doc *p = &pdoc;
@@ -1999,9 +2406,11 @@ pdf_open_document (const char *filename,
pdf_doc_init_bookmarks(p, bookmark_open_depth);
pdf_doc_init_articles (p);
- pdf_doc_init_names (p);
+ pdf_doc_init_names (p, check_gotos);
pdf_doc_init_page_tree(p, media_width, media_height);
+ pdf_doc_set_bgcolor(NULL);
+
if (do_encryption) {
pdf_obj *encrypt = pdf_encrypt_obj();
pdf_set_encrypt(encrypt, pdf_enc_id_array());
@@ -2135,6 +2544,8 @@ pdf_doc_begin_grabbing (const char *ident,
struct form_list_node *fnode;
xform_info info;
+ pdf_dev_push_gstate();
+
fnode = NEW(1, struct form_list_node);
fnode->prev = p->pending_forms;
@@ -2185,7 +2596,7 @@ pdf_doc_begin_grabbing (const char *ident,
* current font and color to the object stream.
*/
pdf_dev_reset_fonts();
- pdf_dev_reset_color();
+ pdf_dev_reset_color(1); /* force color operators to be added to stream */
return xobj_id;
}
@@ -2227,9 +2638,11 @@ pdf_doc_end_grabbing (pdf_obj *attrib)
if (attrib) pdf_release_obj(attrib);
p->pending_forms = fnode->prev;
+
+ pdf_dev_pop_gstate();
- /* Here we do not need pdf_dev_reset_color(). */
pdf_dev_reset_fonts();
+ pdf_dev_reset_color(0);
RELEASE(fnode);
@@ -2293,6 +2706,7 @@ pdf_doc_expand_box (const pdf_rect *rect)
breaking_state.dirty = 1;
}
+#if 0
/* This should be number tree */
void
pdf_doc_set_pagelabel (long pg_start,
@@ -2325,3 +2739,4 @@ pdf_doc_set_pagelabel (long pg_start,
return;
}
+#endif
diff --git a/Build/source/texk/dvipdfmx/src/pdfdoc.h b/Build/source/texk/dvipdfmx/src/pdfdoc.h
index 2ce1054b376..2056c84c35e 100644
--- a/Build/source/texk/dvipdfmx/src/pdfdoc.h
+++ b/Build/source/texk/dvipdfmx/src/pdfdoc.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.h,v 1.24 2008/06/05 06:27:42 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.h,v 1.28 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -35,7 +35,8 @@ extern void pdf_doc_set_verbose (void);
extern void pdf_open_document (const char *filename,
int do_encryption,
double media_width, double media_height,
- double annot_grow_amount, int bookmark_open_depth);
+ double annot_grow_amount, int bookmark_open_depth,
+ int check_gotos);
extern void pdf_close_document (void);
@@ -55,6 +56,11 @@ extern pdf_obj *pdf_doc_get_reference (const char *category);
#define pdf_doc_names() pdf_doc_get_dictionary("Names")
#define pdf_doc_this_page() pdf_doc_get_dictionary("@THISPAGE")
+extern pdf_obj *pdf_doc_get_page (pdf_obj *trailer,
+ long *page_p, long *count_p,
+ pdf_rect *bbox, pdf_obj **resources_p,
+ pdf_obj **markinfo_p);
+
extern long pdf_doc_current_page_number (void);
extern pdf_obj *pdf_doc_current_page_resources (void);
@@ -85,7 +91,9 @@ extern void pdf_doc_add_page_resource (const char *category,
/* Article thread */
extern void pdf_doc_begin_article (const char *article_id, pdf_obj *info);
+#if 0
extern void pdf_doc_end_article (const char *article_id); /* Do nothing... */
+#endif
extern void pdf_doc_make_article (const char *article_id,
const char **bead_order, int num_beads);
extern void pdf_doc_add_bead (const char *article_id,
@@ -120,11 +128,13 @@ extern void pdf_doc_expand_box (const pdf_rect *rect);
/* Manual thumbnail */
extern void pdf_doc_enable_manual_thumbnails (void);
+#if 0
/* PageLabels - */
extern void pdf_doc_set_pagelabel (long page_start,
const char *type,
const void *prefix, int pfrx_len,
long counter_start);
+#endif
/* Similar to bop_content */
#include "pdfcolor.h"
diff --git a/Build/source/texk/dvipdfmx/src/pdfdraw.c b/Build/source/texk/dvipdfmx/src/pdfdraw.c
index 671dbbf5d25..5bbc8d39ab5 100644
--- a/Build/source/texk/dvipdfmx/src/pdfdraw.c
+++ b/Build/source/texk/dvipdfmx/src/pdfdraw.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.c,v 1.15 2008/05/22 11:03:09 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.c,v 1.18 2008/12/11 16:03:05 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -138,6 +138,7 @@ pdf_coord__transform (pdf_coord *p, const pdf_tmatrix *M)
return 0;
}
+#if 0
static /* __inline__ */ int
pdf_coord__itransform (pdf_coord *p, const pdf_tmatrix *M)
{
@@ -155,6 +156,7 @@ pdf_coord__itransform (pdf_coord *p, const pdf_tmatrix *M)
return 0;
}
+#endif
static /* __inline__ */ int
pdf_coord__dtransform (pdf_coord *p, const pdf_tmatrix *M)
@@ -999,8 +1001,8 @@ init_a_gstate (pdf_gstate *gs)
pdf_setmatrix(&gs->matrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
- pdf_color_graycolor(&gs->strokecolor, 0.0);
- pdf_color_graycolor(&gs->fillcolor, 0.0);
+ pdf_color_black(&gs->strokecolor);
+ pdf_color_black(&gs->fillcolor);
gs->linedash.num_dash = 0;
gs->linedash.offset = 0;
@@ -1098,15 +1100,11 @@ int
pdf_dev_gsave (void)
{
pdf_gstate *gs0, *gs1;
- pdf_color *sc, *fc;
gs0 = m_stack_top(&gs_stack);
gs1 = NEW(1, pdf_gstate);
init_a_gstate(gs1);
copy_a_gstate(gs1, gs0);
- pdf_color_get_current(&sc, &fc);
- pdf_color_copycolor(&gs1->strokecolor, sc);
- pdf_color_copycolor(&gs1->fillcolor, fc);
m_stack_push(&gs_stack, gs1);
pdf_doc_add_page_content(" q", 2);
@@ -1245,6 +1243,61 @@ pdf_dev_currentcolor (pdf_color *color, int is_fill)
}
#endif /* 0 */
+/*
+ * mask == 0 means stroking color, mask == 0x20 nonstroking color
+ *
+ * force == 1 means that operators will be generated even if
+ * the color is the same as the current graphics state color
+ */
+void
+pdf_dev_set_color (const pdf_color *color, char mask, int force)
+{
+ int len;
+
+ pdf_gstate *gs = m_stack_top(&gs_stack);
+ pdf_color *current = mask ? &gs->fillcolor : &gs->strokecolor;
+
+ ASSERT(pdf_color_is_valid(color));
+
+ if (!(pdf_dev_get_param(PDF_DEV_PARAM_COLORMODE) &&
+ (force || pdf_color_compare(color, current))))
+ /* If "color" is already the current color, then do nothing
+ * unless a color operator is forced
+ */
+ return;
+
+ graphics_mode();
+ len = pdf_color_to_string(color, fmt_buf);
+ fmt_buf[len++] = ' ';
+ switch (pdf_color_type(color)) {
+ case PDF_COLORSPACE_TYPE_RGB:
+ fmt_buf[len++] = 'R' | mask;
+ fmt_buf[len++] = 'G' | mask;
+ break;
+ case PDF_COLORSPACE_TYPE_CMYK:
+ fmt_buf[len++] = 'K' | mask;
+ break;
+ case PDF_COLORSPACE_TYPE_GRAY:
+ fmt_buf[len++] = 'G' | mask;
+ break;
+ default: /* already verified the given color */
+ break;
+ }
+ pdf_doc_add_page_content(fmt_buf, len);
+
+ pdf_color_copycolor(current, color);
+}
+
+void
+pdf_dev_reset_color (int force)
+{
+ pdf_color *sc, *fc;
+
+ pdf_color_get_current(&sc, &fc);
+ pdf_dev_set_color(sc, 0, force);
+ pdf_dev_set_color(fc, 0x20, force);
+}
+
int
pdf_dev_concat (const pdf_tmatrix *M)
{
@@ -1253,7 +1306,7 @@ pdf_dev_concat (const pdf_tmatrix *M)
pdf_path *cpa = &gs->path;
pdf_coord *cpt = &gs->cp;
pdf_tmatrix *CTM = &gs->matrix;
- pdf_tmatrix W;
+ pdf_tmatrix W = {0, 0, 0, 0, 0, 0}; /* Init to avoid compiler warning */
char *buf = FORMAT_BUFF_PTR(NULL);
int len = 0;
@@ -1396,6 +1449,7 @@ pdf_dev_setdash (int count, double *pattern, double offset)
return 0;
}
+#if 0
int
pdf_dev_setflat (int flatness)
{
@@ -1415,7 +1469,8 @@ pdf_dev_setflat (int flatness)
return 0;
}
-
+#endif
+
/* ZSYUEDVEDEOF */
int
pdf_dev_clip (void)
@@ -1619,6 +1674,7 @@ pdf_dev_transform (pdf_coord *p, const pdf_tmatrix *M)
return;
}
+#if 0
void
pdf_dev_itransform (pdf_coord *p, const pdf_tmatrix *M)
{
@@ -1632,6 +1688,7 @@ pdf_dev_itransform (pdf_coord *p, const pdf_tmatrix *M)
return;
}
+#endif
int
pdf_dev_arc (double c_x , double c_y, double r,
@@ -1704,6 +1761,7 @@ pdf_dev_bspline (double x0, double y0,
}
+#if 0
int
pdf_dev_rectstroke (double x, double y,
double w, double h,
@@ -1719,6 +1777,7 @@ pdf_dev_rectstroke (double x, double y,
return pdf_dev__rectshape(NULL, &r, M, 'S');
}
+#endif
int
pdf_dev_rectfill (double x, double y,
diff --git a/Build/source/texk/dvipdfmx/src/pdfdraw.h b/Build/source/texk/dvipdfmx/src/pdfdraw.h
index cd6d01f0f1c..8e9ee9c0ce7 100644
--- a/Build/source/texk/dvipdfmx/src/pdfdraw.h
+++ b/Build/source/texk/dvipdfmx/src/pdfdraw.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.h,v 1.12 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.h,v 1.14 2008/12/11 16:03:05 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -71,7 +71,9 @@ extern int pdf_dev_setlinejoin (int style);
extern int pdf_dev_setdash (int count,
double *pattern,
double offset);
+#if 0
extern int pdf_dev_setflat (int flatness);
+#endif
/* Path Construction */
extern int pdf_dev_moveto (double x , double y);
@@ -101,10 +103,12 @@ extern int pdf_dev_clip (void);
extern int pdf_dev_eoclip (void);
+#if 0
extern int pdf_dev_rectstroke (double x, double y,
double w, double h,
const pdf_tmatrix *M /* optional */
);
+#endif
extern int pdf_dev_rectfill (double x, double y, double w, double h);
extern int pdf_dev_rectclip (double x, double y, double w, double h);
@@ -120,7 +124,9 @@ extern int pdf_dev_concat (const pdf_tmatrix *M);
extern void pdf_dev_dtransform (pdf_coord *p, const pdf_tmatrix *M);
extern void pdf_dev_idtransform (pdf_coord *p, const pdf_tmatrix *M);
extern void pdf_dev_transform (pdf_coord *p, const pdf_tmatrix *M);
+#if 0
extern void pdf_dev_itransform (pdf_coord *p, const pdf_tmatrix *M);
+#endif
extern int pdf_dev_gsave (void);
extern int pdf_dev_grestore (void);
@@ -153,7 +159,9 @@ extern int pdf_dev_current_depth (void);
extern void pdf_dev_grestore_to (int depth);
#define pdf_dev_grestoreall() pdf_dev_grestore_to(0);
-extern int pdf_dev_currentcolor (pdf_color *color, int is_fill);
-extern int pdf_dev_setcolor (const pdf_color *color, int is_fill);
+extern void pdf_dev_set_color (const pdf_color *color, char mask, int force);
+#define pdf_dev_set_strokingcolor(c) pdf_dev_set_color(c, 0, 0);
+#define pdf_dev_set_nonstrokingcolor(c) pdf_dev_set_color(c, 0x20, 0);
+extern void pdf_dev_reset_color (int force);
#endif /* _PDF_DRAW_H_ */
diff --git a/Build/source/texk/dvipdfmx/src/pdffont.c b/Build/source/texk/dvipdfmx/src/pdffont.c
index 02e1f1962df..e7a056ff0fa 100644
--- a/Build/source/texk/dvipdfmx/src/pdffont.c
+++ b/Build/source/texk/dvipdfmx/src/pdffont.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdffont.c,v 1.23 2008/05/18 14:49:20 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdffont.c,v 1.24 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -365,6 +365,7 @@ pdf_get_font_subtype (int font_id)
return font->subtype;
}
+#if 0
char *
pdf_get_font_fontname (int font_id)
{
@@ -376,6 +377,7 @@ pdf_get_font_fontname (int font_id)
return font->fontname;
}
+#endif
int
pdf_get_font_encoding (int font_id)
@@ -889,6 +891,7 @@ pdf_font_get_flag (pdf_font *font, int mask)
return ((font->flags & mask) ? 1 : 0);
}
+#if 0
int
pdf_font_get_flags (pdf_font *font)
{
@@ -896,6 +899,7 @@ pdf_font_get_flags (pdf_font *font)
return font->flags;
}
+#endif
double
pdf_font_get_param (pdf_font *font, int param_type)
diff --git a/Build/source/texk/dvipdfmx/src/pdffont.h b/Build/source/texk/dvipdfmx/src/pdffont.h
index 6fdc2c8f9f9..168d06b94f5 100644
--- a/Build/source/texk/dvipdfmx/src/pdffont.h
+++ b/Build/source/texk/dvipdfmx/src/pdffont.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdffont.h,v 1.10 2008/05/18 14:49:20 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdffont.h,v 1.11 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -66,7 +66,9 @@ extern int pdf_get_font_subtype (int font_id);
extern pdf_obj *pdf_get_font_reference (int font_id);
extern char *pdf_get_font_usedchars (int font_id);
+#if 0
extern char *pdf_get_font_fontname (int font_id); /* without unique tag */
+#endif
extern int pdf_get_font_encoding (int font_id);
extern int pdf_get_font_wmode (int font_id);
@@ -86,7 +88,9 @@ extern char *pdf_font_get_usedchars (pdf_font *font);
extern int pdf_font_get_encoding (pdf_font *font);
extern int pdf_font_get_flag (pdf_font *font, int mask);
+#if 0
extern int pdf_font_get_flags (pdf_font *font);
+#endif
extern double pdf_font_get_param (pdf_font *font, int type);
extern int pdf_font_get_index (pdf_font *font);
diff --git a/Build/source/texk/dvipdfmx/src/pdfnames.c b/Build/source/texk/dvipdfmx/src/pdfnames.c
index 1d3b6116e3c..ed7a9b7c6a2 100644
--- a/Build/source/texk/dvipdfmx/src/pdfnames.c
+++ b/Build/source/texk/dvipdfmx/src/pdfnames.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfnames.c,v 1.3 2008/06/18 15:11:45 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfnames.c,v 1.5 2008/11/03 22:49:29 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -170,13 +170,13 @@ pdf_names_add_object (struct ht_table *names,
} else {
if (value->reserve) {
/* null object is used for undefined objects */
- pdf_copy_object(value->object, object);
- pdf_release_obj(object); /* PLEASE FIX THIS!!! */
+ pdf_transfer_label(object, value->object);
+ pdf_release_obj(value->object);
+ value->object = object;
} else {
if (value->object || value->object_ref) {
- if (pdf_obj_get_verbose()) {
- WARN("Object reference with key \"%s\" is in use.", printable_key(key, keylen));
- }
+ WARN("Object reference with key \"%s\" is in use.",
+ printable_key(key, keylen));
pdf_release_obj(object);
return -1;
} else {
@@ -415,7 +415,8 @@ build_name_tree (struct named_object *first, long num_leaves, int is_root)
}
static struct named_object *
-flat_table (struct ht_table *ht_tab, long *num_entries)
+flat_table (struct ht_table *ht_tab, long *num_entries,
+ struct ht_table *filter)
{
struct named_object *objects;
struct ht_iter iter;
@@ -423,16 +424,19 @@ flat_table (struct ht_table *ht_tab, long *num_entries)
ASSERT(ht_tab);
- *num_entries = count = ht_tab->count;
- objects = NEW(count, struct named_object);
+ objects = NEW(ht_tab->count, struct named_object);
+ count = 0;
if (ht_set_iter(ht_tab, &iter) >= 0) {
do {
char *key;
int keylen;
struct obj_data *value;
- count--;
key = ht_iter_getkey(&iter, &keylen);
+
+ if (filter && !ht_lookup_table(filter, key, keylen))
+ continue;
+
value = ht_iter_getval(&iter);
if (value->reserve) {
WARN("Named object \"%s\" not defined!!!",
@@ -457,30 +461,31 @@ flat_table (struct ht_table *ht_tab, long *num_entries)
objects[count].keylen = keylen;
objects[count].value = pdf_new_null();
}
- } while (ht_iter_next(&iter) >= 0 && count > 0);
+
+ count++;
+ } while (ht_iter_next(&iter) >= 0);
ht_clear_iter(&iter);
}
+ *num_entries = count;
+ objects = RENEW(objects, count, struct named_object);
+
return objects;
}
pdf_obj *
-pdf_names_create_tree (struct ht_table *names)
+pdf_names_create_tree (struct ht_table *names, long *count,
+ struct ht_table *filter)
{
pdf_obj *name_tree;
struct named_object *flat;
- long count;
- flat = flat_table(names, &count);
+ flat = flat_table(names, count, filter);
if (!flat)
name_tree = NULL;
else {
- if (count < 1)
- name_tree = NULL;
- else {
- qsort(flat, count, sizeof(struct named_object), cmp_key);
- name_tree = build_name_tree(flat, count, 1);
- }
+ qsort(flat, *count, sizeof(struct named_object), cmp_key);
+ name_tree = build_name_tree(flat, *count, 1);
RELEASE(flat);
}
diff --git a/Build/source/texk/dvipdfmx/src/pdfnames.h b/Build/source/texk/dvipdfmx/src/pdfnames.h
index 50dff170b64..e02e0eb29f9 100644
--- a/Build/source/texk/dvipdfmx/src/pdfnames.h
+++ b/Build/source/texk/dvipdfmx/src/pdfnames.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfnames.h,v 1.1 2004/09/02 12:23:07 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfnames.h,v 1.2 2008/11/03 22:49:29 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -45,7 +45,9 @@ extern int pdf_names_close_object (struct ht_table *names,
const void *key, int keylen);
/* Really create name tree... */
-extern pdf_obj *pdf_names_create_tree (struct ht_table *names);
+extern pdf_obj *pdf_names_create_tree (struct ht_table *names,
+ long *count,
+ struct ht_table *filter);
extern char *printable_key (const char *key, int keylen);
diff --git a/Build/source/texk/dvipdfmx/src/pdfobj.c b/Build/source/texk/dvipdfmx/src/pdfobj.c
index c9862c6fbce..e25d481f7c5 100644
--- a/Build/source/texk/dvipdfmx/src/pdfobj.c
+++ b/Build/source/texk/dvipdfmx/src/pdfobj.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfobj.c,v 1.59 2008/06/07 09:54:38 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfobj.c,v 1.63 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -583,7 +583,7 @@ void pdf_out_white (FILE *file)
#define INVALIDOBJ(o) ((o) == NULL || (o)->type <= 0 || (o)->type > PDF_INDIRECT)
-pdf_obj *
+static pdf_obj *
pdf_new_obj(int type)
{
pdf_obj *result;
@@ -627,6 +627,21 @@ pdf_label_obj (pdf_obj *object)
}
/*
+ * Transfer the label assigned to the object src to the object dst.
+ * The object dst must not yet have been labeled.
+ */
+void
+pdf_transfer_label (pdf_obj *dst, pdf_obj *src)
+{
+ ASSERT(dst && !dst->label && src);
+
+ dst->label = src->label;
+ dst->generation = src->generation;
+ src->label = 0;
+ src->generation = 0;
+}
+
+/*
* This doesn't really copy the object, but allows it to be used without
* fear that somebody else will free it.
*/
@@ -734,6 +749,7 @@ write_boolean (pdf_boolean *data, FILE *file)
}
}
+#if 0
void
pdf_set_boolean (pdf_obj *object, char value)
{
@@ -744,6 +760,7 @@ pdf_set_boolean (pdf_obj *object, char value)
data = object->data;
data->value = value;
}
+#endif
char
pdf_boolean_value (pdf_obj *object)
@@ -1063,6 +1080,7 @@ release_name (pdf_name *data)
RELEASE(data);
}
+#if 0
void
pdf_set_name (pdf_obj *object, const char *name)
{
@@ -1084,6 +1102,7 @@ pdf_set_name (pdf_obj *object, const char *name)
data->name = NULL;
}
}
+#endif
char *
pdf_name_value (pdf_obj *object)
@@ -1208,6 +1227,7 @@ pdf_add_array (pdf_obj *array, pdf_obj *object)
return;
}
+#if 0
void
pdf_put_array (pdf_obj *array, unsigned idx, pdf_obj *object)
{
@@ -1260,6 +1280,7 @@ pdf_shift_array (pdf_obj *array)
return result;
}
+#endif
/* Prepend an object to an array */
void
@@ -1281,6 +1302,7 @@ pdf_unshift_array (pdf_obj *array, pdf_obj *object)
data->size++;
}
+#if 0
pdf_obj *
pdf_pop_array (pdf_obj *array)
{
@@ -1299,6 +1321,7 @@ pdf_pop_array (pdf_obj *array)
return result;
}
+#endif
static void
@@ -1389,6 +1412,7 @@ pdf_add_dict (pdf_obj *dict, pdf_obj *key, pdf_obj *value)
return 0;
}
+#if 0
void
pdf_put_dict (pdf_obj *dict, const char *key, pdf_obj *value)
{
@@ -1431,6 +1455,7 @@ pdf_put_dict (pdf_obj *dict, const char *key, pdf_obj *value)
data->value = value;
}
}
+#endif
/* pdf_merge_dict makes a link for each item in dict2 before stealing it */
void
@@ -1867,6 +1892,7 @@ pdf_stream_uncompress (pdf_obj *src) {
return dst;
}
+#if 0
void
pdf_stream_set_flags (pdf_obj *stream, int flags)
{
@@ -1889,6 +1915,7 @@ pdf_stream_get_flags (pdf_obj *stream)
return data->_flags;
}
+#endif
static void
pdf_write_obj (pdf_obj *object, FILE *file)
@@ -2088,102 +2115,6 @@ pdf_release_obj (pdf_obj *object)
}
}
-/* Copy object data without changing object label. */
-void
-pdf_copy_object (pdf_obj *dst, pdf_obj *src)
-{
- if (!dst || !src)
- return;
-
- switch (dst->type) {
- case PDF_BOOLEAN: release_boolean(dst->data); break;
- case PDF_NULL: release_null(dst->data); break;
- case PDF_NUMBER: release_number(dst->data); break;
- case PDF_STRING: release_string(dst->data); break;
- case PDF_NAME: release_name(dst->data); break;
- case PDF_ARRAY: release_array(dst->data); break;
- case PDF_DICT: release_dict(dst->data); break;
- case PDF_STREAM: release_stream(dst->data); break;
- case PDF_INDIRECT: release_indirect(dst->data); break;
- }
-
- dst->type = src->type;
- switch (src->type) {
- case PDF_BOOLEAN:
- dst->data = NEW(1, pdf_boolean);
- pdf_set_boolean(dst, pdf_boolean_value(src));
- break;
- case PDF_NULL:
- dst->data = NULL;
- break;
- case PDF_NUMBER:
- dst->data = NEW(1, pdf_number);
- pdf_set_number(dst, pdf_number_value(src));
- break;
- case PDF_STRING:
- dst->data = NEW(1, pdf_string);
- pdf_set_string(dst,
- pdf_string_value(src),
- pdf_string_length(src));
- break;
- case PDF_NAME:
- dst->data = NEW(1, pdf_name);
- pdf_set_name(dst, pdf_name_value(src));
- break;
- case PDF_ARRAY:
- {
- pdf_array *data;
- unsigned long i;
-
- dst->data = data = NEW(1, pdf_array);
- data->size = 0;
- data->max = 0;
- data->values = NULL;
- for (i = 0; i < pdf_array_length(src); i++) {
- pdf_add_array(dst, pdf_link_obj(pdf_get_array(src, i)));
- }
- }
- break;
- case PDF_DICT:
- {
- pdf_dict *data;
-
- dst->data = data = NEW(1, pdf_dict);
- data->key = NULL;
- data->value = NULL;
- data->next = NULL;
- pdf_merge_dict(dst, src);
- }
- break;
- case PDF_STREAM:
- {
- pdf_stream *data;
-
- dst->data = data = NEW(1, pdf_stream);
- data->dict = pdf_new_dict();
- data->_flags = ((pdf_stream *)src->data)->_flags;
- data->stream_length = 0;
- data->max_length = 0;
-
- pdf_add_stream(dst, pdf_stream_dataptr(src), pdf_stream_length(src));
- pdf_merge_dict(data->dict, pdf_stream_dict(src));
- }
- break;
- case PDF_INDIRECT:
- {
- pdf_indirect *data;
-
- dst->data = data = NEW(1, pdf_indirect);
- data->pf = ((pdf_indirect *) (src->data))->pf;
- data->label = ((pdf_indirect *) (src->data))->label;
- data->generation = ((pdf_indirect *) (src->data))->generation;
- }
- break;
- }
-
- return;
-}
-
static int
backup_line (FILE *pdf_input_file)
{
@@ -2551,19 +2482,23 @@ pdf_get_object (pdf_file *pf, unsigned long obj_num, unsigned short obj_gen)
pdf_obj *
pdf_deref_obj (pdf_obj *obj)
{
+ int count = PDF_OBJ_MAX_DEPTH;
+
if (obj)
obj = pdf_link_obj(obj);
- while (PDF_OBJ_INDIRECTTYPE(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);
- if (!pf)
- ERROR("Tried to deref a non-file object");
+ ASSERT(pf);
pdf_release_obj(obj);
- obj = pdf_get_object(pf, obj_num, obj_gen);
+ obj = pdf_get_object(pf, obj_num, obj_gen);
}
+ if (!count)
+ ERROR("Loop in object hierarchy detected. Broken PDF file?");
+
if (PDF_OBJ_NULLTYPE(obj)) {
pdf_release_obj(obj);
return NULL;
@@ -3014,6 +2949,8 @@ import_dict (pdf_obj *key, pdf_obj *value, void *pdata)
return 0;
}
+static pdf_obj loop_marker = { PDF_OBJ_INVALID, 0, 0, 0, 0, NULL };
+
static pdf_obj *
pdf_import_indirect (pdf_obj *object)
{
@@ -3031,15 +2968,16 @@ pdf_import_indirect (pdf_obj *object)
}
if ((ref = pf->xref_table[obj_num].indirect)) {
+ if (ref == &loop_marker)
+ ERROR("Loop in object hierarchy detected. Broken PDF file?");
return pdf_link_obj(ref);
} else {
pdf_obj *obj, *tmp;
obj = pdf_get_object(pf, obj_num, obj_gen);
- if (!obj) {
- WARN("Could not read object: %lu %u", obj_num, obj_gen);
- return NULL;
- }
+
+ /* We mark the reference to be able to detect loops */
+ pf->xref_table[obj_num].indirect = &loop_marker;
tmp = pdf_import_object(obj);
@@ -3125,25 +3063,17 @@ pdf_import_object (pdf_obj *object)
}
+/* returns 0 if indirect references point to the same object */
int
pdf_compare_reference (pdf_obj *ref1, pdf_obj *ref2)
{
pdf_indirect *data1, *data2;
- if (!PDF_OBJ_INDIRECTTYPE(ref1) ||
- !PDF_OBJ_INDIRECTTYPE(ref2)) {
- ERROR("Not indirect reference...");
- }
+ ASSERT(PDF_OBJ_INDIRECTTYPE(ref1) && PDF_OBJ_INDIRECTTYPE(ref2));
data1 = (pdf_indirect *) ref1->data;
data2 = (pdf_indirect *) ref2->data;
- if (data1->pf != data2->pf)
- return (int) (data1->pf - data2->pf);
- if (data1->label != data2->label)
- return (int) (data1->label - data2->label);
- if (data1->generation != data2->generation)
- return (int) (data1->generation - data2->generation);
-
- return 0;
+ return data1->pf != data2->pf || data1->label != data2->label
+ || data1->generation != data2->generation;
}
diff --git a/Build/source/texk/dvipdfmx/src/pdfobj.h b/Build/source/texk/dvipdfmx/src/pdfobj.h
index fb0f58d5e74..a80e9a22147 100644
--- a/Build/source/texk/dvipdfmx/src/pdfobj.h
+++ b/Build/source/texk/dvipdfmx/src/pdfobj.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfobj.h,v 1.28 2008/06/07 09:54:38 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfobj.h,v 1.31 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -44,6 +44,9 @@
#define STREAM_COMPRESS (1 << 0)
+/* A deeper object hierarchy will be considered as (illegal) loop. */
+#define PDF_OBJ_MAX_DEPTH 30
+
typedef struct pdf_obj pdf_obj;
typedef struct pdf_file pdf_file;
@@ -58,7 +61,6 @@ extern void pdf_out_flush (void);
extern void pdf_set_version (unsigned version);
extern unsigned pdf_get_version (void);
-extern pdf_obj *pdf_new_obj (int type);
extern void pdf_release_obj (pdf_obj *object);
extern int pdf_obj_typeof (pdf_obj *object);
@@ -77,11 +79,14 @@ extern int pdf_obj_typeof (pdf_obj *object);
extern pdf_obj *pdf_ref_obj (pdf_obj *object);
extern pdf_obj *pdf_link_obj (pdf_obj *object);
+extern void pdf_transfer_label (pdf_obj *dst, pdf_obj *src);
extern pdf_obj *pdf_new_null (void);
extern pdf_obj *pdf_new_boolean (char value);
+#if 0
extern void pdf_set_boolean (pdf_obj *object, char value);
+#endif
extern char pdf_boolean_value (pdf_obj *object);
extern pdf_obj *pdf_new_number (double value);
@@ -95,7 +100,9 @@ extern unsigned pdf_string_length (pdf_obj *object);
/* Name does not include the / */
extern pdf_obj *pdf_new_name (const char *name);
+#if 0
extern void pdf_set_name (pdf_obj *object, const char *name);
+#endif
extern char *pdf_name_value (pdf_obj *object);
extern pdf_obj *pdf_new_array (void);
@@ -105,13 +112,17 @@ extern pdf_obj *pdf_new_array (void);
* pdf_put_dict(dict, key, value)
*/
extern void pdf_add_array (pdf_obj *array, pdf_obj *object);
+#if 0
extern void pdf_put_array (pdf_obj *array, unsigned idx, pdf_obj *object);
+#endif
extern pdf_obj *pdf_get_array (pdf_obj *array, long idx);
extern unsigned pdf_array_length (pdf_obj *array);
extern void pdf_unshift_array (pdf_obj *array, pdf_obj *object);
+#if 0
extern pdf_obj *pdf_shift_array (pdf_obj *array);
extern pdf_obj *pdf_pop_array (pdf_obj *array);
+#endif
extern pdf_obj *pdf_new_dict (void);
extern void pdf_remove_dict (pdf_obj *dict, const char *key);
@@ -127,7 +138,9 @@ extern pdf_obj *pdf_dict_keys (pdf_obj *dict);
* already removed that.
*/
extern int pdf_add_dict (pdf_obj *dict, pdf_obj *key, pdf_obj *value);
-extern void pdf_put_dict (pdf_obj *dict, const char *key, pdf_obj *value);
+#if 0
+extern void pdf_put_dict (pdf_obj *dict, const char *key, pdf_obj *value);
+#endif
/* Apply proc(key, value, pdata) for each key-value pairs in dict, stop if proc()
* returned non-zero value (and that value is returned). PDF object is passed for
@@ -149,8 +162,10 @@ extern int pdf_add_stream_flate (pdf_obj *stream,
extern int pdf_concat_stream (pdf_obj *dst, pdf_obj *src);
extern pdf_obj *pdf_stream_dict (pdf_obj *stream);
extern long pdf_stream_length (pdf_obj *stream);
+#if 0
extern void pdf_stream_set_flags (pdf_obj *stream, int flags);
extern int pdf_stream_get_flags (pdf_obj *stream);
+#endif
extern const void *pdf_stream_dataptr (pdf_obj *stream);
#if 0
@@ -183,6 +198,5 @@ extern pdf_obj *pdf_import_object (pdf_obj *object);
extern int pdfobj_escape_str (char *buffer, int size, const unsigned char *s, int len);
extern pdf_obj *pdf_new_indirect (pdf_file *pf, unsigned long label, unsigned short generation);
-extern void pdf_copy_object (pdf_obj *dst, pdf_obj *src);
#endif /* _PDFOBJ_H_ */
diff --git a/Build/source/texk/dvipdfmx/src/pdfresource.c b/Build/source/texk/dvipdfmx/src/pdfresource.c
index b79974e0ddd..e55a9737aa6 100644
--- a/Build/source/texk/dvipdfmx/src/pdfresource.c
+++ b/Build/source/texk/dvipdfmx/src/pdfresource.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfresource.c,v 1.8 2004/09/05 13:30:05 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfresource.c,v 1.9 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -256,6 +256,7 @@ pdf_defineresource (const char *category,
return (long) ((cat_id << 16)|(res_id));
}
+#if 0
int
pdf_resource_exist (const char *category, const char *resname)
{
@@ -281,6 +282,7 @@ pdf_resource_exist (const char *category, const char *resname)
return 0;
}
+#endif
long
pdf_findresource (const char *category, const char *resname)
@@ -342,6 +344,7 @@ pdf_get_resource_reference (long rc_id)
return pdf_link_obj(res->reference);
}
+#if 0
pdf_obj *
pdf_get_resource (long rc_id)
{
@@ -371,3 +374,4 @@ pdf_get_resource (long rc_id)
return res->object;
}
+#endif
diff --git a/Build/source/texk/dvipdfmx/src/pdfresource.h b/Build/source/texk/dvipdfmx/src/pdfresource.h
index 38fc8189b09..199d22d1665 100644
--- a/Build/source/texk/dvipdfmx/src/pdfresource.h
+++ b/Build/source/texk/dvipdfmx/src/pdfresource.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pdfresource.h,v 1.6 2004/09/05 13:30:05 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pdfresource.h,v 1.7 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -35,9 +35,13 @@ extern void pdf_close_resources (void);
extern long pdf_defineresource (const char *category,
const char *resname, pdf_obj *object, int flags);
extern long pdf_findresource (const char *category, const char *resname);
+#if 0
extern int pdf_resource_exist (const char *category, const char *resname);
+#endif
extern pdf_obj *pdf_get_resource_reference (long res_id);
+#if 0
extern pdf_obj *pdf_get_resource (long res_id);
+#endif
#endif /* _PDF_RESOURCE_H_ */
diff --git a/Build/source/texk/dvipdfmx/src/pkfont.c b/Build/source/texk/dvipdfmx/src/pkfont.c
index 4822d50bc71..803ca0183eb 100644
--- a/Build/source/texk/dvipdfmx/src/pkfont.c
+++ b/Build/source/texk/dvipdfmx/src/pkfont.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pkfont.c,v 1.17 2007/11/14 03:12:21 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pkfont.c,v 1.19 2008/11/03 22:18:52 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -416,7 +416,7 @@ struct pk_header_
unsigned long pkt_len;
SIGNED_QUAD chrcode;
SIGNED_QUAD wd, dx, dy;
- UNSIGNED_QUAD bm_wd, bm_ht, bm_hoff, bm_voff;
+ SIGNED_QUAD bm_wd, bm_ht, bm_hoff, bm_voff;
int dyn_f, run_color;
};
@@ -594,7 +594,8 @@ pdf_font_load_pkfont (pdf_font *font)
* rendering in several viewers.
*/
pix2charu = 72. * 1000. / ((double) base_dpi) / point_size;
- bbox.llx = bbox.lly = bbox.urx = bbox.ury = 0.0;
+ bbox.llx = bbox.lly = HUGE_VAL;
+ bbox.urx = bbox.ury = -HUGE_VAL;
while ((opcode = fgetc(fp)) >= 0 && opcode != PK_POST) {
if (opcode < 240) {
struct pk_header_ pkh;
@@ -622,8 +623,8 @@ pdf_font_load_pkfont (pdf_font *font)
/* Update font BBox info */
bbox.llx = MIN(bbox.llx, -pkh.bm_hoff);
bbox.lly = MIN(bbox.lly, pkh.bm_voff - pkh.bm_ht);
- bbox.urx = MIN(bbox.urx, pkh.bm_wd - pkh.bm_hoff);
- bbox.ury = MIN(bbox.ury, pkh.bm_voff);
+ bbox.urx = MAX(bbox.urx, pkh.bm_wd - pkh.bm_hoff);
+ bbox.ury = MAX(bbox.ury, pkh.bm_voff);
pkt_ptr = NEW(pkh.pkt_len, unsigned char);
if ((bytesread = fread(pkt_ptr, 1, pkh.pkt_len, fp))!= pkh.pkt_len) {
@@ -746,7 +747,8 @@ pdf_font_load_pkfont (pdf_font *font)
pdf_add_dict(fontdict,
pdf_new_name("Encoding"), pdf_ref_obj(encoding));
pdf_release_obj(encoding);
- }
+ } else
+ pdf_release_obj(tmp_array);
/* FontBBox: Accurate value is important.
*/
@@ -788,11 +790,5 @@ pdf_font_load_pkfont (pdf_font *font)
pdf_add_dict(fontdict,
pdf_new_name("LastChar"), pdf_new_number(lastchar));
-#if ENABLE_GLYPHENC
- if (encoding_id >= 0) {
- pdf_encoding_add_usedchars(encoding_id, usedchars);
- }
-#endif /* ENABLE_GLYPHENC */
-
return 0;
}
diff --git a/Build/source/texk/dvipdfmx/src/pst_obj.c b/Build/source/texk/dvipdfmx/src/pst_obj.c
index 3d34b13a6e1..84c3fe4885f 100644
--- a/Build/source/texk/dvipdfmx/src/pst_obj.c
+++ b/Build/source/texk/dvipdfmx/src/pst_obj.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pst_obj.c,v 1.8 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pst_obj.c,v 1.9 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -587,6 +587,7 @@ pst_name_release (pst_name *obj)
RELEASE(obj);
}
+#if 0
int
pst_name_is_valid (const char *name)
{
@@ -626,6 +627,7 @@ pst_name_encode (const char *name)
return encoded_name;
}
+#endif
pst_obj *
pst_parse_name (unsigned char **inbuf, unsigned char *inbufend) /* / is required */
diff --git a/Build/source/texk/dvipdfmx/src/pst_obj.h b/Build/source/texk/dvipdfmx/src/pst_obj.h
index dbd5afdff89..cfa0c849302 100644
--- a/Build/source/texk/dvipdfmx/src/pst_obj.h
+++ b/Build/source/texk/dvipdfmx/src/pst_obj.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/pst_obj.h,v 1.3 2004/03/14 04:23:04 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/pst_obj.h,v 1.4 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -33,7 +33,9 @@ extern pst_obj *pst_parse_name (unsigned char **inbuf, unsigned char *inbufend
extern pst_obj *pst_parse_number (unsigned char **inbuf, unsigned char *inbufend);
extern pst_obj *pst_parse_string (unsigned char **inbuf, unsigned char *inbufend);
+#if 0
extern int pst_name_is_valid (const char *name);
extern char *pst_name_encode (const char *name);
+#endif
#endif /* _PST_OBJ_H_ */
diff --git a/Build/source/texk/dvipdfmx/src/spc_color.c b/Build/source/texk/dvipdfmx/src/spc_color.c
index 35880193012..dbbe5254999 100644
--- a/Build/source/texk/dvipdfmx/src/spc_color.c
+++ b/Build/source/texk/dvipdfmx/src/spc_color.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_color.c,v 1.6 2007/11/22 11:45:39 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_color.c,v 1.8 2008/12/11 16:03:05 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -47,30 +47,6 @@
* implicitely.
*/
-int
-spc_color_at_begin_page (void)
-{
- return 0;
-}
-
-int
-spc_color_at_end_page (void)
-{
- return 0;
-}
-
-int
-spc_color_at_begin_document (void)
-{
- return 0;
-}
-
-int
-spc_color_at_end_document (void)
-{
- return 0;
-}
-
static int
spc_handler_color_push (struct spc_env *spe, struct spc_arg *args)
{
@@ -104,9 +80,8 @@ spc_handler_color_default (struct spc_env *spe, struct spc_arg *args)
error = spc_util_read_colorspec(spe, &colorspec, args, 1);
if (!error) {
- pdf_color_set_default(&colorspec);
- pdf_color_clear_stack(); /* the default color is saved on color_stack */
- pdf_color_push(&colorspec, &colorspec);
+ pdf_color_clear_stack();
+ pdf_color_set(&colorspec, &colorspec);
}
return error;
diff --git a/Build/source/texk/dvipdfmx/src/spc_color.h b/Build/source/texk/dvipdfmx/src/spc_color.h
index 60770556883..206b7e2f452 100644
--- a/Build/source/texk/dvipdfmx/src/spc_color.h
+++ b/Build/source/texk/dvipdfmx/src/spc_color.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_color.h,v 1.1 2004/09/11 14:50:29 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_color.h,v 1.2 2008/11/30 21:17:58 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -25,11 +25,6 @@
#ifndef _SPC_COLOR_H_
#define _SPC_COLOR_H_
-extern int spc_color_at_begin_page (void);
-extern int spc_color_at_end_page (void);
-extern int spc_color_at_begin_document (void);
-extern int spc_color_at_end_document (void);
-
extern int spc_color_check_special (const char *buffer, long size);
extern int spc_color_setup_handler (struct spc_handler *handle,
struct spc_env *spe, struct spc_arg *args);
diff --git a/Build/source/texk/dvipdfmx/src/spc_dvips.c b/Build/source/texk/dvipdfmx/src/spc_dvips.c
index f75afbf9a02..5f02f0bfbc5 100644
--- a/Build/source/texk/dvipdfmx/src/spc_dvips.c
+++ b/Build/source/texk/dvipdfmx/src/spc_dvips.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_dvips.c,v 1.11 2008/05/29 13:43:51 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_dvips.c,v 1.12 2008/11/30 21:17:58 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -293,12 +293,6 @@ static struct spc_handler dvips_handlers[] = {
};
int
-spc_dvips_at_begin_page (void)
-{
- return 0;
-}
-
-int
spc_dvips_at_end_page (void)
{
mps_eop_cleanup();
@@ -306,18 +300,6 @@ spc_dvips_at_end_page (void)
}
int
-spc_dvips_at_begin_document (void)
-{
- return 0;
-}
-
-int
-spc_dvips_at_end_document (void)
-{
- return 0;
-}
-
-int
spc_dvips_check_special (const char *buf, long len)
{
char *p, *endptr;
diff --git a/Build/source/texk/dvipdfmx/src/spc_dvips.h b/Build/source/texk/dvipdfmx/src/spc_dvips.h
index 8816b4078cf..009e85fcdf7 100644
--- a/Build/source/texk/dvipdfmx/src/spc_dvips.h
+++ b/Build/source/texk/dvipdfmx/src/spc_dvips.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_dvips.h,v 1.1 2004/09/11 14:50:29 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_dvips.h,v 1.2 2008/11/30 21:17:58 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -27,10 +27,7 @@
#include "specials.h"
-extern int spc_dvips_at_begin_page (void);
extern int spc_dvips_at_end_page (void);
-extern int spc_dvips_at_begin_document (void);
-extern int spc_dvips_at_end_document (void);
extern int spc_dvips_check_special (const char *buffer, long size);
extern int spc_dvips_setup_handler (struct spc_handler *handle,
diff --git a/Build/source/texk/dvipdfmx/src/spc_html.c b/Build/source/texk/dvipdfmx/src/spc_html.c
index 1460ed56536..276f8b1c947 100644
--- a/Build/source/texk/dvipdfmx/src/spc_html.c
+++ b/Build/source/texk/dvipdfmx/src/spc_html.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_html.c,v 1.8 2008/05/29 13:43:51 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_html.c,v 1.9 2008/11/30 21:31:24 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -574,7 +574,7 @@ spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd)
double alpha = 1.0; /* meaning fully opaque */
#endif /* ENABLE_HTML_SVG_OPACITY */
#ifdef ENABLE_HTML_SVG_TRANSFORM
- pdf_tmatrix M;
+ pdf_tmatrix M, M1;
pdf_setmatrix(&M, 1.0, 0.0, 0.0, 1.0, spe->x_user, spe->y_user);
#endif /* ENABLE_HTML_SVG_TRANSFORM */
@@ -670,9 +670,8 @@ spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd)
}
#endif /* ENABLE_HTML_SVG_OPACITY */
- pdf_dev_concat(&M);
-
- pdf_ximage_scale_image(id, &M, &r, &ti);
+ pdf_ximage_scale_image(id, &M1, &r, &ti);
+ pdf_concatmatrix(&M, &M1);
pdf_dev_concat(&M);
pdf_dev_rectclip(r.llx, r.lly, r.urx - r.llx, r.ury - r.lly);
diff --git a/Build/source/texk/dvipdfmx/src/spc_misc.c b/Build/source/texk/dvipdfmx/src/spc_misc.c
index 9d7d55257c0..6475dfd25fe 100644
--- a/Build/source/texk/dvipdfmx/src/spc_misc.c
+++ b/Build/source/texk/dvipdfmx/src/spc_misc.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_misc.c,v 1.8 2008/05/29 13:43:51 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_misc.c,v 1.9 2008/11/30 21:17:58 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -49,29 +49,6 @@
#include "spc_util.h"
#include "spc_misc.h"
-int
-spc_misc_at_begin_page (void)
-{
- return 0;
-}
-
-int spc_misc_at_end_page (void)
-{
- return 0;
-}
-
-int
-spc_misc_at_begin_document (void)
-{
- return 0;
-}
-
-int
-spc_misc_at_end_document (void)
-{
- return 0;
-}
-
static int
spc_handler_postscriptbox (struct spc_env *spe, struct spc_arg *ap)
{
diff --git a/Build/source/texk/dvipdfmx/src/spc_misc.h b/Build/source/texk/dvipdfmx/src/spc_misc.h
index 7ee654db7df..1dbd3a1d2be 100644
--- a/Build/source/texk/dvipdfmx/src/spc_misc.h
+++ b/Build/source/texk/dvipdfmx/src/spc_misc.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_misc.h,v 1.1 2004/09/11 14:50:29 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_misc.h,v 1.2 2008/11/30 21:17:58 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -27,11 +27,6 @@
#include "specials.h"
-extern int spc_misc_at_begin_page (void);
-extern int spc_misc_at_end_page (void);
-extern int spc_misc_at_begin_document (void);
-extern int spc_misc_at_end_document (void);
-
extern int spc_misc_check_special (const char *buffer, long size);
extern int spc_misc_setup_handler (struct spc_handler *handle,
struct spc_env *spe, struct spc_arg *args);
diff --git a/Build/source/texk/dvipdfmx/src/spc_pdfm.c b/Build/source/texk/dvipdfmx/src/spc_pdfm.c
index a1c6bd03918..e756420c404 100644
--- a/Build/source/texk/dvipdfmx/src/spc_pdfm.c
+++ b/Build/source/texk/dvipdfmx/src/spc_pdfm.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.43 2008/06/20 23:18:45 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.45 2008/12/11 16:03:05 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -203,18 +203,6 @@ spc_pdfm_at_end_document (void)
return spc_handler_pdfm__clean(NULL, NULL, sd);
}
-int
-spc_pdfm_at_begin_page (void)
-{
- return 0;
-}
-
-int
-spc_pdfm_at_end_page (void)
-{
- return 0;
-}
-
/* Dvipdfm specials */
static int
@@ -576,7 +564,7 @@ spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args)
} else {
rect.llx = cp.x;
rect.lly = cp.y - spe->mag * ti.depth;
- rect.urx = rect.llx + spe->mag * ti.width;
+ rect.urx = cp.x + spe->mag * ti.width;
rect.ury = cp.y + spe->mag * ti.height;
}
@@ -668,15 +656,16 @@ spc_handler_pdfm_bcolor (struct spc_env *spe, struct spc_arg *ap)
if (error)
spc_warn(spe, "Invalid color specification?");
else {
- pdf_color_push(&sc, &fc); /* save currentcolor */
- pdf_dev_set_strokingcolor(&sc);
- pdf_dev_set_nonstrokingcolor(&fc);
+ pdf_color_push(&sc, &fc);
}
return error;
}
-/* Different than "color rgb 1 0 0" ? */
+/*
+ * This special changes the current color without clearing the color stack.
+ * It therefore differs from "color rgb 1 0 0".
+ */
static int
spc_handler_pdfm_scolor (struct spc_env *spe, struct spc_arg *ap)
{
@@ -695,9 +684,7 @@ spc_handler_pdfm_scolor (struct spc_env *spe, struct spc_arg *ap)
if (error)
spc_warn(spe, "Invalid color specification?");
else {
- pdf_color_set_default(&fc); /* ????? */
- pdf_dev_set_strokingcolor(&sc);
- pdf_dev_set_nonstrokingcolor(&fc);
+ pdf_color_set(&sc, &fc);
}
return error;
@@ -740,13 +727,13 @@ spc_handler_pdfm_etrans (struct spc_env *spe, struct spc_arg *args)
/*
* Unfortunately, the following line is necessary in case
- * of a font or color change inside of the save/restore pair.
+ * of a color change inside of the save/restore pair.
+ * (Font changes are automatically corrected by pdf_dev_grestore().)
* Anything that was done there must be redone, so in effect,
* we make no assumptions about what fonts. We act like we are
* starting a new page.
*/
- pdf_dev_reset_fonts();
- pdf_dev_reset_color();
+ pdf_dev_reset_color(0);
return 0;
}
@@ -1335,6 +1322,8 @@ spc_handler_pdfm_econtent (struct spc_env *spe, struct spc_arg *args)
{
pdf_dev_pop_coord();
pdf_dev_grestore();
+ pdf_dev_reset_color(0);
+
return 0;
}
diff --git a/Build/source/texk/dvipdfmx/src/spc_pdfm.h b/Build/source/texk/dvipdfmx/src/spc_pdfm.h
index 0c4fe6d79ed..18468d56760 100644
--- a/Build/source/texk/dvipdfmx/src/spc_pdfm.h
+++ b/Build/source/texk/dvipdfmx/src/spc_pdfm.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.h,v 1.1 2004/09/11 14:50:29 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.h,v 1.2 2008/11/30 21:17:58 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -27,8 +27,6 @@
#include "specials.h"
-extern int spc_pdfm_at_begin_page (void);
-extern int spc_pdfm_at_end_page (void);
extern int spc_pdfm_at_begin_document (void);
extern int spc_pdfm_at_end_document (void);
diff --git a/Build/source/texk/dvipdfmx/src/spc_tpic.c b/Build/source/texk/dvipdfmx/src/spc_tpic.c
index 71a41ce159b..2fab3d83839 100644
--- a/Build/source/texk/dvipdfmx/src/spc_tpic.c
+++ b/Build/source/texk/dvipdfmx/src/spc_tpic.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/spc_tpic.c,v 1.3 2005/10/14 04:55:00 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/spc_tpic.c,v 1.5 2008/11/30 21:39:19 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -170,7 +170,6 @@ set_linestyle (double pn, double da)
} else {
pdf_dev_setlinecap(0);
}
- pdf_doc_add_page_content(" 0 G", 4);
return 0;
}
@@ -193,14 +192,53 @@ set_fillstyle (double g, double a, int f_ais)
pdf_release_obj(dict);
}
len += sprintf(buf + len, " /%s gs", resname);
+
+ pdf_doc_add_page_content(buf, len);
}
- len += sprintf(buf + len, " %.2f g", g);
- pdf_doc_add_page_content(buf, len);
+ {
+ pdf_color *sc, *fc, new_fc;
+
+ pdf_color_get_current (&sc, &fc); /* get stroking and fill colors */
+ pdf_color_brighten_color(&new_fc, fc, g);
+ pdf_dev_set_nonstrokingcolor(&new_fc);
+ }
return 0;
}
+static void
+set_styles (struct spc_tpic_ *tp,
+ const pdf_coord *c,
+ int f_fs,
+ int f_vp,
+ double pn,
+ double da) {
+ pdf_tmatrix M;
+
+ pdf_setmatrix (&M, 1.0, 0.0, 0.0, -1.0, c->x, c->y);
+ pdf_dev_concat(&M);
+
+ if (f_vp)
+ set_linestyle(pn, da);
+
+ if (f_fs) {
+ double g, a;
+ int f_ais;
+
+ if (tp->mode.fill == TPIC_MODE__FILL_SOLID || !tp->fill_color) {
+ g = 1.0 - tp->fill_color;
+ a = 0.0;
+ } else {
+ g = 0.0;
+ a = tp->fill_color;
+ }
+
+ f_ais = (tp->mode.fill == TPIC_MODE__FILL_SHAPE) ? 1 : 0;
+
+ set_fillstyle(g, a, f_ais);
+ }
+}
static void
showpath (int f_vp, int f_fs) /* visible_path, fill_shape */
@@ -235,45 +273,18 @@ tpic__polyline (struct spc_tpic_ *tp,
int f_vp,
double da)
{
- pdf_tmatrix M;
double pn = tp->pen_size;
int f_fs = tp->fill_shape;
- int f_ais = 0;
- double g = 0.5;
- double a = 0.0;
int i, error = 0;
/* Shading is applied only to closed path. */
f_fs = CLOSED_PATH(tp) ? f_fs : 0;
f_vp = (pn > 0.0) ? f_vp : 0;
- f_ais = (tp->mode.fill == TPIC_MODE__FILL_SHAPE) ? 1 : 0;
- switch (tp->mode.fill) {
- case TPIC_MODE__FILL_SOLID:
- g = 1.0 - tp->fill_color;
- a = 0.0;
- break;
- case TPIC_MODE__FILL_SHAPE:
- case TPIC_MODE__FILL_OPACITY:
- if (tp->fill_color > 0.0) {
- a = tp->fill_color;
- g = 0.0;
- } else {
- a = 0.0;
- g = 1.0;
- }
- break;
- }
if (f_vp || f_fs) {
pdf_dev_gsave();
- pdf_setmatrix (&M, 1.0, 0.0, 0.0, -1.0, c->x, c->y);
- pdf_dev_concat(&M);
-
- if (f_vp)
- set_linestyle(pn, da);
- if (f_fs)
- set_fillstyle(g, a, f_ais);
+ set_styles(tp, c, f_fs, f_vp, pn, da);
pdf_dev_moveto(tp->points[0].x, tp->points[0].y);
for (i = 0; i < tp->num_points; i++)
@@ -316,44 +327,17 @@ tpic__spline (struct spc_tpic_ *tp,
double da)
{
double v[6];
- pdf_tmatrix M;
double pn = tp->pen_size;
int f_fs = tp->fill_shape;
- int f_ais = 0;
- double g = 0.5;
- double a = 0.0;
int i, error = 0;
f_fs = CLOSED_PATH(tp) ? f_fs : 0;
f_vp = (pn > 0.0) ? f_vp : 0;
- f_ais = (tp->mode.fill == TPIC_MODE__FILL_SHAPE) ? 1 : 0;
- switch (tp->mode.fill) {
- case TPIC_MODE__FILL_SOLID:
- g = 1.0 - tp->fill_color;
- a = 0.0;
- break;
- case TPIC_MODE__FILL_SHAPE:
- case TPIC_MODE__FILL_OPACITY:
- if (tp->fill_color > 0.0) {
- a = tp->fill_color;
- g = 0.0;
- } else {
- a = 0.0;
- g = 1.0;
- }
- break;
- }
- if ( f_vp || f_fs ) {
+ if (f_vp || f_fs) {
pdf_dev_gsave();
- pdf_setmatrix (&M, 1.0, 0.0, 0.0, -1.0, c->x, c->y);
- pdf_dev_concat(&M);
-
- if (f_vp)
- set_linestyle(pn, da);
- if (f_fs)
- set_fillstyle(g, a, f_ais);
+ set_styles(tp, c, f_fs, f_vp, pn, da);
pdf_dev_moveto(tp->points[0].x, tp->points[0].y);
@@ -388,43 +372,16 @@ tpic__arc (struct spc_tpic_ *tp,
double da,
double *v /* 6 numbers */ )
{
- pdf_tmatrix M;
double pn = tp->pen_size;
int f_fs = tp->fill_shape;
- int f_ais = 0;
- double g = 0.5;
- double a = 0.0;
f_fs = (round(fabs(v[4] - v[5]) + 0.5) >= 360) ? f_fs : 0;
f_vp = (pn > 0.0) ? f_vp : 0;
- f_ais = (tp->mode.fill == TPIC_MODE__FILL_SHAPE) ? 1 : 0;
- switch (tp->mode.fill) {
- case TPIC_MODE__FILL_SOLID:
- g = 1.0 - tp->fill_color;
- a = 0.0;
- break;
- case TPIC_MODE__FILL_SHAPE:
- case TPIC_MODE__FILL_OPACITY:
- if (tp->fill_color > 0.0) {
- a = tp->fill_color;
- g = 0.0;
- } else {
- a = 0.0;
- g = 1.0;
- }
- break;
- }
- if ( f_vp || f_fs ) {
+ if (f_vp || f_fs) {
pdf_dev_gsave();
- pdf_setmatrix (&M, 1.0, 0.0, 0.0, -1.0, c->x, c->y);
- pdf_dev_concat(&M);
-
- if (f_vp)
- set_linestyle(pn, da);
- if (f_fs)
- set_fillstyle(g, a, f_ais);
+ set_styles(tp, c, f_fs, f_vp, pn, da);
pdf_dev_arcx(v[0], v[1], v[2], v[3], v[4], v[5], +1, 0.0);
@@ -727,8 +684,14 @@ spc_handler_tpic_sh (struct spc_env *spe,
skip_blank(&ap->curptr, ap->endptr);
q = parse_float_decimal(&ap->curptr, ap->endptr);
if (q) {
- tp->fill_color = atof(q);
+ double g = atof(q);
RELEASE(q);
+ if (g >= 0.0 && g <= 1.0)
+ tp->fill_color = g;
+ else {
+ WARN("Invalid fill color specified: %g\n", g);
+ return -1;
+ }
}
return 0;
diff --git a/Build/source/texk/dvipdfmx/src/specials.c b/Build/source/texk/dvipdfmx/src/specials.c
index edb0159a771..9ef4bd2670b 100644
--- a/Build/source/texk/dvipdfmx/src/specials.c
+++ b/Build/source/texk/dvipdfmx/src/specials.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/specials.c,v 1.10 2008/05/24 08:37:49 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/specials.c,v 1.12 2009/01/15 21:04:38 chofchof Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -389,26 +389,26 @@ static struct {
{"pdf:",
spc_pdfm_at_begin_document,
spc_pdfm_at_end_document,
- spc_pdfm_at_begin_page,
- spc_pdfm_at_end_page,
+ NULL,
+ NULL,
spc_pdfm_check_special,
spc_pdfm_setup_handler
},
{"ps:",
- spc_dvips_at_begin_document,
- spc_dvips_at_end_document,
- spc_dvips_at_begin_page,
+ NULL,
+ NULL,
+ NULL,
spc_dvips_at_end_page,
spc_dvips_check_special,
spc_dvips_setup_handler
},
{"color",
- spc_color_at_begin_document,
- spc_color_at_end_document,
- spc_color_at_begin_page,
- spc_color_at_end_page,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
spc_color_check_special,
spc_color_setup_handler
},
@@ -432,10 +432,10 @@ static struct {
},
{"unknown",
- spc_misc_at_begin_document,
- spc_misc_at_end_document,
- spc_misc_at_begin_page,
- spc_misc_at_end_page,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
spc_misc_check_special,
spc_misc_setup_handler
},
diff --git a/Build/source/texk/dvipdfmx/src/t1_load.c b/Build/source/texk/dvipdfmx/src/t1_load.c
index 422885a782a..9efbb20c149 100644
--- a/Build/source/texk/dvipdfmx/src/t1_load.c
+++ b/Build/source/texk/dvipdfmx/src/t1_load.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/t1_load.c,v 1.11 2008/01/11 18:04:15 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/t1_load.c,v 1.12 2008/10/13 19:42:48 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -59,13 +59,8 @@
#if 0
/* We no longer need encryption. */
-static unsigned char t1_encrypt (unsigned char plain);
-#endif /* 0 */
-static void t1_crypt_init (unsigned short key);
-static unsigned char t1_decrypt (unsigned char cipher);
static unsigned short r = T1_EEKEY, c1 = 52845, c2 = 22719;
-#if 0
static unsigned char t1_encrypt (unsigned char plain)
{
unsigned char cipher;
@@ -73,19 +68,26 @@ static unsigned char t1_encrypt (unsigned char plain)
r = (cipher + r) * c1 + c2;
return cipher;
}
-#endif /* 0 */
static void t1_crypt_init (unsigned short key)
{
r = key;
}
+#endif /* 0 */
-static unsigned char t1_decrypt (unsigned char cipher)
+static void
+t1_decrypt (unsigned short key,
+ unsigned char *dst, const unsigned char *src,
+ long skip, long len)
{
- unsigned char plain;
- plain = (cipher ^ (r >> 8));
- r = (cipher + r) * c1 + c2;
- return plain;
+ len -= skip;
+ while (skip--)
+ key = (key + *src++) * 52845u + 22719u;
+ while (len--) {
+ unsigned char c = *src++;
+ *dst++ = (c ^ (key >> 8));
+ key = (key + c) * 52845u + 22719u;
+ }
}
/* T1CRYPT */
@@ -549,17 +551,9 @@ parse_subrs (cff_font *font,
data = RENEW(data, max_size, card8);
}
if (lenIV >= 0) {
- long j;
-
+ t1_decrypt(T1_CHARKEY, data+offset, *start, lenIV, len);
offsets[idx] = offset;
- lengths[idx] = len - lenIV;
- t1_crypt_init(T1_CHARKEY);
- for (j = 0; j < lenIV; j++)
- t1_decrypt(*((*start)+j));
- for (j = lenIV; j < len ; j++) {
- data[offset] = (card8) t1_decrypt(*((*start)+j));
- offset++;
- }
+ offset += (lengths[idx] = len - lenIV);
} else if (len > 0) {
offsets[idx] = offset;
lengths[idx] = len;
@@ -672,7 +666,12 @@ parse_charstrings (cff_font *font,
}
if (gid > 0)
- charset->data.glyphs[gid-1] = cff_add_string(font, glyph_name);
+ charset->data.glyphs[gid-1] = cff_add_string(font, glyph_name, 0);
+ /*
+ * We don't care about duplicate strings here since
+ * later a subset font of this font will be generated.
+ */
+
RELEASE(glyph_name);
tok = pst_get_token(start, end);
@@ -719,20 +718,9 @@ parse_charstrings (cff_font *font,
*start += 1;
if (mode != 1) {
if (lenIV >= 0) {
- t1_crypt_init(T1_CHARKEY);
- for (j = 0; j < lenIV; j++)
- t1_decrypt(*((*start)+j));
- if (gid == 0) {
- charstrings->offset[gid] = 1; /* start at 1 */
- for (j = lenIV; j < len; j++) {
- charstrings->data[j-lenIV] = t1_decrypt(*((*start)+j));
- }
- } else {
- charstrings->offset[gid] = offset + 1; /* start at 1 */
- for (j = lenIV; j < len; j++) {
- charstrings->data[offset+j-lenIV] = t1_decrypt(*((*start)+j));
- }
- }
+ long offs = gid ? offset : 0;
+ charstrings->offset[gid] = offs + 1; /* start at 1 */
+ t1_decrypt(T1_CHARKEY, charstrings->data+offs, *start, lenIV, len);
offset += len - lenIV;
} else {
if (gid == 0) {
@@ -954,7 +942,11 @@ parse_part1 (cff_font *font, char **enc_vec,
cff_dict_add(font->topdict, key, 1);
if ((sid = cff_get_sid(font, strval)) == CFF_STRING_NOTDEF)
- sid = cff_add_string(font, strval); /* FIXME */
+ sid = cff_add_string(font, strval, 0); /* FIXME */
+ /*
+ * We don't care about duplicate strings here since
+ * later a subset font of this font will be generated.
+ */
cff_dict_set(font->topdict, key, 0, sid);
}
RELEASE(strval);
@@ -1191,12 +1183,7 @@ t1_load_font (char **enc_vec, int mode, FILE *fp)
ERROR("Reading PFB (BINARY part) file failed.");
return NULL;
} else {
- long i;
-
- t1_crypt_init(T1_EEKEY);
- for (i = 0; i < length; i++) {
- buffer[i] = (unsigned char) t1_decrypt(buffer[i]);
- }
+ t1_decrypt(T1_EEKEY, buffer, buffer, 0, length);
}
start = buffer + 4; end = buffer + length;
if (parse_part2(cff, &start, end, mode) < 0) {
diff --git a/Build/source/texk/dvipdfmx/src/tfm.c b/Build/source/texk/dvipdfmx/src/tfm.c
index e5fee9e7d88..16043c44d57 100644
--- a/Build/source/texk/dvipdfmx/src/tfm.c
+++ b/Build/source/texk/dvipdfmx/src/tfm.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/tfm.c,v 1.22 2007/11/17 18:08:58 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/tfm.c,v 1.23 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -1058,6 +1058,7 @@ tfm_get_width (int font_id, SIGNED_QUAD ch)
return ((double) tfm_get_fw_width(font_id, ch)/FWBASE);
}
+#if 0
double
tfm_get_height (int font_id, SIGNED_QUAD ch)
{
@@ -1069,6 +1070,7 @@ tfm_get_depth (int font_id, SIGNED_QUAD ch)
{
return ((double) tfm_get_fw_depth(font_id, ch)/FWBASE);
}
+#endif
/* tfm_string_xxx() do not work for OFM... */
fixword
@@ -1160,6 +1162,7 @@ tfm_get_design_size (int font_id)
return (double) (fms[font_id].designsize)/FWBASE*(72.0/72.27);
}
+#if 0
char *
tfm_get_codingscheme (int font_id)
{
@@ -1184,6 +1187,7 @@ tfm_is_vert (int font_id)
return 0;
}
#endif /* !WITHOUT_ASCII_PTEX */
+#endif
int
tfm_exists (const char *tfm_name)
diff --git a/Build/source/texk/dvipdfmx/src/tfm.h b/Build/source/texk/dvipdfmx/src/tfm.h
index e3306a49e82..0f32734bc78 100644
--- a/Build/source/texk/dvipdfmx/src/tfm.h
+++ b/Build/source/texk/dvipdfmx/src/tfm.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/tfm.h,v 1.11 2004/09/11 14:50:29 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/tfm.h,v 1.12 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -33,8 +33,10 @@ extern int tfm_open (const char * tex_name, int must_exist);
extern void tfm_close_all (void);
extern double tfm_get_width (int font_id, SIGNED_QUAD ch);
+#if 0
extern double tfm_get_height (int font_id, SIGNED_QUAD ch);
extern double tfm_get_depth (int font_id, SIGNED_QUAD ch);
+#endif
extern fixword tfm_get_fw_width (int font_id, SIGNED_QUAD ch);
extern fixword tfm_get_fw_height (int font_id, SIGNED_QUAD ch);
@@ -48,9 +50,10 @@ extern double tfm_get_space (int font_id);
/* From TFM header */
extern double tfm_get_design_size (int font_id);
+#if 0
extern char *tfm_get_codingscheme (int font_id);
-
extern int tfm_is_vert (int font_id);
+#endif
extern int tfm_exists (const char *tfm_name);
diff --git a/Build/source/texk/dvipdfmx/src/tt_table.c b/Build/source/texk/dvipdfmx/src/tt_table.c
index 93568d1e379..ce2e1f109c0 100644
--- a/Build/source/texk/dvipdfmx/src/tt_table.c
+++ b/Build/source/texk/dvipdfmx/src/tt_table.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/tt_table.c,v 1.9 2008/05/08 10:32:09 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/tt_table.c,v 1.10 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -216,6 +216,7 @@ tt_read_hhea_table (sfnt *sfont)
}
/* vhea */
+#if 0
char *
tt_pack_vhea_table (struct tt_vhea_table *table)
{
@@ -242,6 +243,7 @@ tt_pack_vhea_table (struct tt_vhea_table *table)
return data;
}
+#endif
struct tt_vhea_table *tt_read_vhea_table (sfnt *sfont)
{
diff --git a/Build/source/texk/dvipdfmx/src/tt_table.h b/Build/source/texk/dvipdfmx/src/tt_table.h
index bba65d923ee..7db97123fff 100644
--- a/Build/source/texk/dvipdfmx/src/tt_table.h
+++ b/Build/source/texk/dvipdfmx/src/tt_table.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/tt_table.h,v 1.7 2007/02/14 05:56:43 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/tt_table.h,v 1.8 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -175,7 +175,9 @@ extern char *tt_pack_maxp_table (struct tt_maxp_table *table);
extern struct tt_maxp_table *tt_read_maxp_table (sfnt *sfont);
/* vhea */
+#if 0
extern char *tt_pack_vhea_table (struct tt_vhea_table *table);
+#endif
extern struct tt_vhea_table *tt_read_vhea_table (sfnt *sfont);
/* VORG */
diff --git a/Build/source/texk/dvipdfmx/src/type0.c b/Build/source/texk/dvipdfmx/src/type0.c
index 9ae6603232f..f0090508a03 100644
--- a/Build/source/texk/dvipdfmx/src/type0.c
+++ b/Build/source/texk/dvipdfmx/src/type0.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/type0.c,v 1.23 2005/06/27 09:04:53 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/type0.c,v 1.24 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -288,6 +288,7 @@ Type0Font_get_wmode (Type0Font *font)
return font->wmode;
}
+#if 0
char *
Type0Font_get_encoding (Type0Font *font)
{
@@ -295,6 +296,7 @@ Type0Font_get_encoding (Type0Font *font)
return font->encoding;
}
+#endif
char *
Type0Font_get_usedchars (Type0Font *font)
diff --git a/Build/source/texk/dvipdfmx/src/type0.h b/Build/source/texk/dvipdfmx/src/type0.h
index e38810bc72b..0a769f2eda6 100644
--- a/Build/source/texk/dvipdfmx/src/type0.h
+++ b/Build/source/texk/dvipdfmx/src/type0.h
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/type0.h,v 1.12 2004/09/05 13:30:06 hirata Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/type0.h,v 1.13 2008/11/30 21:12:27 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -33,7 +33,9 @@ typedef struct Type0Font Type0Font;
extern void Type0Font_set_verbose (void);
extern int Type0Font_get_wmode (Type0Font *font);
+#if 0
extern char *Type0Font_get_encoding (Type0Font *font);
+#endif
extern char *Type0Font_get_usedchars (Type0Font *font);
extern pdf_obj *Type0Font_get_resource (Type0Font *font);
diff --git a/Build/source/texk/dvipdfmx/src/type1.c b/Build/source/texk/dvipdfmx/src/type1.c
index 73134113ec2..95bc083370c 100644
--- a/Build/source/texk/dvipdfmx/src/type1.c
+++ b/Build/source/texk/dvipdfmx/src/type1.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/type1.c,v 1.43 2008/05/18 17:05:56 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/type1.c,v 1.45 2008/10/13 19:42:48 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -631,7 +631,7 @@ pdf_font_load_type1 (pdf_font *font)
break;
}
- sid = cff_add_string(cffont, glyph); /* FIXME */
+ sid = cff_add_string(cffont, glyph, 1); /* FIXME */
if (duplicate < code) { /* found duplicates */
cffont->encoding->supp[cffont->encoding->num_supps].code = duplicate;
cffont->encoding->supp[cffont->encoding->num_supps].glyph = sid;
@@ -670,10 +670,10 @@ pdf_font_load_type1 (pdf_font *font)
* The Type 1 seac operator may add another glyph but the glyph name of
* those glyphs are contained in standard string. The String Index will
* not be modified after here.
+ * BUT: We cannot update the String Index yet because then we wouldn't be
+ * able to find the GIDs of the base and accent characters (unless they
+ * have been used already).
*/
- cff_dict_update (cffont->topdict, cffont);
- cff_dict_update (cffont->private[0], cffont);
- cff_update_string(cffont);
{
cff_index *cstring;
@@ -772,6 +772,11 @@ pdf_font_load_type1 (pdf_font *font)
if (verbose > 2)
MESG("]");
+ /* Now we can update the String Index */
+ cff_dict_update (cffont->topdict, cffont);
+ cff_dict_update (cffont->private[0], cffont);
+ cff_update_string(cffont);
+
add_metrics(font, cffont, enc_vec, widths, num_glyphs);
offset = write_fontfile(font, cffont, num_glyphs);
diff --git a/Build/source/texk/dvipdfmx/src/type1c.c b/Build/source/texk/dvipdfmx/src/type1c.c
index 0daf3784a77..979336c1975 100644
--- a/Build/source/texk/dvipdfmx/src/type1c.c
+++ b/Build/source/texk/dvipdfmx/src/type1c.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/type1c.c,v 1.26 2008/05/18 17:05:56 chofchof Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/type1c.c,v 1.29 2008/10/13 19:42:48 matthias Exp $
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
@@ -389,7 +389,7 @@ pdf_font_load_type1c (pdf_font *font)
}
/* New CharStrings INDEX */
- charstrings = cff_new_index(256);
+ charstrings = cff_new_index(257); /* 256 + 1 for ".notdef" glyph */
max_len = 2 * CS_STR_LEN_MAX;
charstrings->data = NEW(max_len, card8);
charstring_len = 0;
@@ -465,7 +465,12 @@ pdf_font_load_type1c (pdf_font *font)
* cff_add_string(cff, ...) -> cff_string_add(string, ...).
*/
sid_orig = cff_get_sid (cffont, enc_vec[code]);
- sid = cff_add_string(cffont, enc_vec[code]);
+ sid = sid_orig < CFF_STDSTR_MAX ?
+ sid_orig : cff_add_string(cffont, enc_vec[code], 0);
+ /*
+ * We use "unique = 0" because duplicate strings are impossible
+ * at this stage unless the original font already had duplicates.
+ */
/*
* Check if multiply-encoded glyph.
@@ -696,6 +701,9 @@ pdf_font_load_type1c (pdf_font *font)
/* Copyright and Trademark Notice ommited. */
+ /* Handle Widths in fontdict. */
+ add_SimpleMetrics(font, cffont, widths, num_glyphs);
+
/* Close font */
cff_close (cffont);
sfnt_close(sfont);
@@ -706,9 +714,6 @@ pdf_font_load_type1c (pdf_font *font)
MESG("[%u/%u glyphs][%ld bytes]", num_glyphs, cs_count, offset);
}
- /* Handle Widths in fontdict. */
- add_SimpleMetrics(font, cffont, widths, num_glyphs);
-
/*
* CharSet might be recommended for subsetted font, but it is meaningful
* only for Type 1 font...
diff --git a/Build/source/texk/dvipdfmx/src/xbb.c b/Build/source/texk/dvipdfmx/src/xbb.c
index 788a4246218..484322845d1 100644
--- a/Build/source/texk/dvipdfmx/src/xbb.c
+++ b/Build/source/texk/dvipdfmx/src/xbb.c
@@ -1,4 +1,4 @@
-/* $Header: /home/cvsroot/dvipdfmx/src/xbb.c,v 1.13 2008/05/22 10:08:02 matthias Exp $
+/* $Header: /home/cvsroot/dvipdfmx/src/xbb.c,v 1.17 2008/12/11 16:09:29 matthias Exp $
This is extractbb, a bounding box extraction program.
@@ -27,6 +27,8 @@
#include "mfileio.h"
#include "numbers.h"
#include "pdfobj.h"
+#include "pdfdev.h"
+#include "pdfdoc.h"
#include "pdfparse.h"
#include "config.h"
@@ -86,11 +88,11 @@ static char *make_xbb_filename(const char *name)
break;
}
if (i == sizeof(extensions) / sizeof(extensions[0])) {
- fprintf(stderr, "Warning: %s: Filename does not end in a recognizeable extension.\n", name);
- result = NEW(strlen(name)+3, char);
+ fprintf(stderr, "Warning: %s: Filename does not end in a recognizable extension.\n", name);
+ result = NEW(strlen(name)+5, char); /* 5 = ".xbb" + trailing 0 */
strcpy(result, name);
} else { /* Remove extension */
- result = NEW(strlen(name)+3-strlen(extensions[i])+1, char);
+ result = NEW(strlen(name)-strlen(extensions[i])+5, char); /* 5 = ".xbb" + trailing 0 */
strncpy(result, name, strlen(name)-strlen(extensions[i]));
result[strlen(name)-strlen(extensions[i])] = 0;
}
@@ -296,138 +298,31 @@ static void do_png (FILE *fp, char *filename)
}
#endif /* HAVE_LIBPNG */
-static int rect_equal (pdf_obj *rect1, pdf_obj *rect2)
-{
- int i;
- if (!rect1 || !rect2) return 0;
- for (i = 0; i < 4; i++) {
- if (pdf_number_value(pdf_get_array(rect1, i)) != pdf_number_value(pdf_get_array(rect2, i))) return 0;
- }
- return 1;
-}
-
-static int pdf_get_info (FILE *image_file, char *filename, int *llx, int *lly, int *urx, int *ury)
+static void do_pdf (FILE *fp, char *filename)
{
- pdf_obj *page_tree;
- pdf_obj *bbox;
+ pdf_obj *page, *trailer;
pdf_file *pf;
+ long page_no = 1;
+ long count; /* dummy */
+ pdf_rect bbox;
- page_tree = NULL;
- {
- pdf_obj *trailer, *catalog;
-
- pf = pdf_open(filename, image_file);
- if (!pf)
- return -1;
-
- trailer = pdf_file_get_trailer(pf);
-
- if (pdf_lookup_dict(trailer, "Encrypt")) {
- WARN("This PDF document is encrypted.");
- pdf_release_obj(trailer);
- pdf_close(pf);
- return -1;
- }
- catalog = pdf_deref_obj(pdf_lookup_dict(trailer, "Root"));
- if (!catalog) {
- WARN("Catalog isn't where I expect it.");
- pdf_close(pf);
- return -1;
- }
- pdf_release_obj(trailer);
- page_tree = pdf_deref_obj(pdf_lookup_dict(catalog, "Pages"));
- pdf_release_obj(catalog);
- }
- if (!page_tree) {
- WARN("Page tree not found.");
- pdf_close(pf);
- return -1;
- }
- {
- pdf_obj *kids_ref, *kids;
- pdf_obj *crop_box;
- pdf_obj *tmp;
-
- tmp = pdf_lookup_dict(page_tree, "MediaBox");
- bbox = tmp ? pdf_deref_obj(tmp) : NULL;
- tmp = pdf_lookup_dict(page_tree, "CropBox");
- crop_box = tmp ? pdf_deref_obj(tmp) : NULL;
-
- while ((kids_ref = pdf_lookup_dict(page_tree, "Kids")) != NULL) {
- kids = pdf_deref_obj(kids_ref);
- pdf_release_obj(page_tree);
- page_tree = pdf_deref_obj(pdf_get_array(kids, 0));
- pdf_release_obj(kids);
-
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "MediaBox")))) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "BleedBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "TrimBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "ArtBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "CropBox")))) {
- if (crop_box)
- pdf_release_obj(crop_box);
- crop_box = tmp;
- }
- }
- if (crop_box) {
- pdf_release_obj(bbox);
- bbox = crop_box;
- }
- }
- pdf_release_obj(page_tree);
-
- if (!bbox) {
- WARN("No BoundingBox information available.");
- pdf_close(pf);
- return -1;
+ pf = pdf_open(filename, fp);
+ if (!pf) {
+ WARN("%s does not look like a PDF file...\n", filename);
+ return;
}
- *llx = (int)pdf_number_value(pdf_get_array(bbox, 0));
- *lly = (int)pdf_number_value(pdf_get_array(bbox, 1));
- *urx = (int)pdf_number_value(pdf_get_array(bbox, 2));
- *ury = (int)pdf_number_value(pdf_get_array(bbox, 3));
+ trailer = pdf_file_get_trailer(pf);
- pdf_release_obj(bbox);
+ page = pdf_doc_get_page(trailer, &page_no, &count, &bbox, NULL, NULL);
pdf_close(pf);
- return 0;
-}
-
-static void do_pdf (FILE *fp, char *filename)
-{
- int llx, lly, urx, ury;
- if (pdf_get_info(fp, filename, &llx, &lly, &urx, &ury) < 0) {
- fprintf (stderr, "%s does not look like a PDF file...\n", filename);
+ if (!page)
return;
- }
- write_xbb(filename, llx, lly, urx, ury);
- return;
+
+ pdf_release_obj(page);
+ write_xbb(filename, bbox.llx, bbox.lly, bbox.urx, bbox.ury);
}
int extractbb (int argc, char *argv[], int mode)