diff options
author | Karl Berry <karl@freefriends.org> | 2008-06-09 21:04:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-06-09 21:04:32 +0000 |
commit | ecae399c7deb8665b1ec3adc021ce6a1a23f417b (patch) | |
tree | d8500227474e0cb020e7ec252215fe6bb9ebee60 /Build/source/texk/dvipdfmx | |
parent | c58445fb5fb17c48e0504ed7041e03aaaf6e387a (diff) |
dvipdfmx 20080607 update
git-svn-id: svn://tug.org/texlive/trunk@8625 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfmx')
-rw-r--r-- | Build/source/texk/dvipdfmx/ChangeLog | 58 | ||||
-rwxr-xr-x | Build/source/texk/dvipdfmx/configure | 2 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/configure.in | 2 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/mpost.c | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfdev.c | 60 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfdev.h | 7 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfdoc.c | 18 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfdoc.h | 10 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfnames.c | 7 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfobj.c | 8 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfobj.h | 3 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfparse.c | 4 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfximage.c | 76 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfximage.h | 9 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/spc_dvips.c | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/spc_html.c | 4 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/spc_misc.c | 4 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/spc_pdfm.c | 198 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/spc_util.c | 21 |
19 files changed, 327 insertions, 176 deletions
diff --git a/Build/source/texk/dvipdfmx/ChangeLog b/Build/source/texk/dvipdfmx/ChangeLog index 17f7b79ae64..3475b2a6ab6 100644 --- a/Build/source/texk/dvipdfmx/ChangeLog +++ b/Build/source/texk/dvipdfmx/ChangeLog @@ -1,8 +1,64 @@ -$Header: /home/cvsroot/dvipdfmx/ChangeLog,v 1.206 2008/05/23 00:08:21 chofchof Exp $ +$Header: /home/cvsroot/dvipdfmx/ChangeLog,v 1.213 2008/06/07 09:59:38 chofchof Exp $ ChangeLog: Changes for DVIPDFMx =============================== +2008-06-07 Jin-Hwan Cho + + * contrib/latex/movie15.sty.sample: + Support movie15.sty, version 2008/01/16. + + * pdfobj.c, pdfobj.h, pdfparse.c, spc_pdfm.c, pdfnames.c: + Allow PDF stream of length zero and suppress some warning messages. + +2008-06-06 Jin-Hwan Cho + + * contrib/latex/animate.sty.sample: + Support animate.sty, version 2008/06/03. + +2008-06-05 Jin-Hwan Cho + + * mpost.c, pdfdev.c, pdfdev.h, pdfdoc.c, pdfdoc.h, spc_pdfm.c: + DVIPDFMx supports PGF version 2.00. + New specials "pdf:bcontent", "pdf:econtent", and "pdf:code". + Moreover, "pdf:exobj << additional_dict >>" merges additional + dictionaries into the XObject dictionary, not resources. + + * pgfsys-dvipdfmx.def.version2, pgfsys-dvipdfmx-patch.tex.version2: + A sample DVIPDFMx driver for PGF version 2.00. Note that + pgfsys-dvipdfmx-patch.tex must be loaded after loading the + basiclayers of PGF. Otherwise image mask and transparency + group do not work. + +2008-06-01 Jin-Hwan Cho + + * pdfdev.h, spc_pdfm.c, spc_util.c, dvipdfmx.def.sample: + Changed the option "mask" to "hide" in "pdf:image" special. + New "pdf:stream" special for a string given externally. + + * pgf-generic.diff, pgfsys-dvipdfmx.def, xcolor.sty.sample: + Renamed and moved pgf patches for version 1 to contrib/generic. + Removed "xcolor.sty.sample". + +2008-05-29 Jin-Hwan Cho + + * spc_dvips.c, pdfdoc.c, spc_html.c, spc_misc.c, pdfximage.c, pdfximage.h, spc_pdfm.c, spc_util.c, pdfdev.h: + Support PGF image masking; support additional attribute dictionary + for included images as pdfTeX. + + * xcolor.sty.sample, pgf-generic.diff, pgfsys-dvipdfmx.def, sample-imagemask.tex, dvipdfmx.def.sample: + Sample files for image masking and xcolor, pgf patches. + +2008-05-28 Jin-Hwan Cho + + * spc_pdfm.c: + Remove an warning message which occurs with the PGF + transparent model. + + * spc_util.c: + Support dvips color names defined in dvipsname.def with + "pdf:bcolor" special, e.g. "pdf: bcolor JungleGreen". + 2008-05-23 Jin-Hwan Cho * data/Makefile.am, data/Makefile.in: diff --git a/Build/source/texk/dvipdfmx/configure b/Build/source/texk/dvipdfmx/configure index 21a5ac47ae5..6b227678a5f 100755 --- a/Build/source/texk/dvipdfmx/configure +++ b/Build/source/texk/dvipdfmx/configure @@ -2198,7 +2198,7 @@ fi # Define the identity of the package. PACKAGE=dvipdfmx - VERSION=20080524 + VERSION=20080607 cat >>confdefs.h <<_ACEOF diff --git a/Build/source/texk/dvipdfmx/configure.in b/Build/source/texk/dvipdfmx/configure.in index fd4ffe3f057..b7d3b21514f 100644 --- a/Build/source/texk/dvipdfmx/configure.in +++ b/Build/source/texk/dvipdfmx/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/dvipdfmx.c) -AM_INIT_AUTOMAKE(dvipdfmx, 20080524) +AM_INIT_AUTOMAKE(dvipdfmx, 20080607) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/Build/source/texk/dvipdfmx/src/mpost.c b/Build/source/texk/dvipdfmx/src/mpost.c index 841a357e699..a123c5a049e 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.40 2008/05/17 01:17:27 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/mpost.c,v 1.41 2008/06/05 06:27:42 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -883,7 +883,7 @@ do_texfig_operator (int opcode, double x_user, double y_user) if (!in_tfig) ERROR("endTexFig without valid startTexFig!."); - pdf_doc_end_grabbing(); + pdf_doc_end_grabbing(NULL); pdf_dev_put_image(xobj_id, &fig_p, x_user, y_user); in_tfig = 0; break; @@ -1578,7 +1578,7 @@ mps_include_page (const char *ident, FILE *fp) mps_stack_clear_to (st_depth); pdf_dev_grestore_to(gs_depth); - pdf_doc_end_grabbing(); + pdf_doc_end_grabbing(NULL); //pdf_color_pop(); pdf_dev_set_param(PDF_DEV_PARAM_AUTOROTATE, autorotate); diff --git a/Build/source/texk/dvipdfmx/src/pdfdev.c b/Build/source/texk/dvipdfmx/src/pdfdev.c index 18387abc5f2..0232f3901b1 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.65 2008/05/18 08:09:09 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.c,v 1.66 2008/06/05 06:27:42 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -944,6 +944,37 @@ handle_multibyte_string (struct dev_font *font, return 0; } + +static pdf_coord *dev_coords = NULL; +static int num_dev_coords = 0; +static int max_dev_coords = 0; + +void pdf_dev_get_coord(double *xpos, double *ypos) +{ + if (num_dev_coords > 0) { + *xpos = dev_coords[num_dev_coords-1].x; + *ypos = dev_coords[num_dev_coords-1].y; + } else { + *xpos = *ypos = 0.0; + } +} + +void pdf_dev_push_coord(double xpos, double ypos) +{ + if (num_dev_coords >= max_dev_coords) { + max_dev_coords += 4; + dev_coords = RENEW(dev_coords, max_dev_coords, pdf_coord); + } + dev_coords[num_dev_coords].x = xpos; + dev_coords[num_dev_coords].y = ypos; + num_dev_coords++; +} + +void pdf_dev_pop_coord(void) +{ + if (num_dev_coords > 0) num_dev_coords--; +} + /* * ctype: * 0 byte-width of char can be variable and input string @@ -1004,6 +1035,11 @@ pdf_dev_set_string (spt_t xpos, spt_t ypos, } } + if (num_dev_coords > 0) { + xpos -= bpt2spt(dev_coords[num_dev_coords-1].x); + ypos -= bpt2spt(dev_coords[num_dev_coords-1].y); + } + /* * Kern is in units of character units, i.e., 1000 = 1 em. * @@ -1120,9 +1156,10 @@ pdf_init_device (double dvi2pts, int precision, int black_and_white) pdf_color_clear_stack(); pdf_dev_init_gstates(); - num_dev_fonts = 0; - max_dev_fonts = 0; - dev_fonts = NULL; + num_dev_fonts = max_dev_fonts = 0; + dev_fonts = NULL; + num_dev_coords = max_dev_coords = 0; + dev_coords = NULL; } void @@ -1141,10 +1178,7 @@ pdf_close_device (void) } RELEASE(dev_fonts); } - dev_fonts = NULL; - num_dev_fonts = 0; - max_dev_fonts = 0; - + if (dev_coords) RELEASE(dev_coords); pdf_dev_clear_gstates(); } @@ -1552,6 +1586,11 @@ pdf_dev_set_rule (spt_t xpos, spt_t ypos, spt_t width, spt_t height) int len = 0; double width_in_bp; + if (num_dev_coords > 0) { + xpos -= bpt2spt(dev_coords[num_dev_coords-1].x); + ypos -= bpt2spt(dev_coords[num_dev_coords-1].y); + } + graphics_mode(); format_buffer[len++] = ' '; @@ -1772,6 +1811,11 @@ pdf_dev_put_image (int id, pdf_rect r; int len = 0; + if (num_dev_coords > 0) { + ref_x -= dev_coords[num_dev_coords-1].x; + ref_y -= dev_coords[num_dev_coords-1].y; + } + pdf_copymatrix(&M, &(p->matrix)); M.e += ref_x; M.f += ref_y; /* Just rotate by -90, but not tested yet. Any problem if M has scaling? */ diff --git a/Build/source/texk/dvipdfmx/src/pdfdev.h b/Build/source/texk/dvipdfmx/src/pdfdev.h index 5e5b7a9adfe..4934f053e5e 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.20 2007/11/22 11:45:39 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.h,v 1.23 2008/06/05 06:27:42 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -70,6 +70,7 @@ typedef struct #define INFO_HAS_WIDTH (1 << 1) #define INFO_HAS_HEIGHT (1 << 2) #define INFO_DO_CLIP (1 << 3) +#define INFO_DO_HIDE (1 << 4) extern void transform_info_clear (transform_info *info); @@ -221,4 +222,8 @@ extern void pdf_dev_eop (void); */ extern void graphics_mode (void); +extern void pdf_dev_get_coord(double *xpos, double *ypos); +extern void pdf_dev_push_coord(double xpos, double ypos); +extern void pdf_dev_pop_coord(void); + #endif /* _PDFDEV_H_ */ diff --git a/Build/source/texk/dvipdfmx/src/pdfdoc.c b/Build/source/texk/dvipdfmx/src/pdfdoc.c index 663d9ef3941..797f2dd820b 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.55 2008/05/22 10:08:02 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.c,v 1.57 2008/06/05 06:27:42 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -100,7 +100,7 @@ read_thumbnail (const char *thumb_filename) } MFCLOSE(fp); - xobj_id = pdf_ximage_findresource(thumb_filename, 0); + xobj_id = pdf_ximage_findresource(thumb_filename, 0, NULL); if (xobj_id < 0) { WARN("Could not read thumbnail file \"%s\".", thumb_filename); image_ref = NULL; @@ -2072,11 +2072,12 @@ pdf_close_document (void) * All this routine does is give the form a name and add a unity scaling matrix. * It fills in required fields. The caller must initialize the stream. */ -void +static void pdf_doc_make_xform (pdf_obj *xform, pdf_rect *bbox, pdf_tmatrix *matrix, - pdf_obj *resources) + pdf_obj *resources, + pdf_obj *attrib) { pdf_obj *xform_dict; pdf_obj *tmp; @@ -2110,6 +2111,10 @@ pdf_doc_make_xform (pdf_obj *xform, pdf_add_dict(xform_dict, pdf_new_name("Matrix"), tmp); } + if (attrib) { + pdf_merge_dict(xform_dict, attrib); + } + pdf_add_dict(xform_dict, pdf_new_name("Resources"), resources); return; @@ -2186,7 +2191,7 @@ pdf_doc_begin_grabbing (const char *ident, } void -pdf_doc_end_grabbing (void) +pdf_doc_end_grabbing (pdf_obj *attrib) { pdf_form *form; pdf_obj *procset; @@ -2216,9 +2221,10 @@ pdf_doc_end_grabbing (void) pdf_doc_make_xform(form->contents, &form->cropbox, &form->matrix, - pdf_ref_obj(form->resources)); + pdf_ref_obj(form->resources), attrib); pdf_release_obj(form->resources); pdf_release_obj(form->contents); + if (attrib) pdf_release_obj(attrib); p->pending_forms = fnode->prev; diff --git a/Build/source/texk/dvipdfmx/src/pdfdoc.h b/Build/source/texk/dvipdfmx/src/pdfdoc.h index 587067a528b..2ce1054b376 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.23 2008/05/20 13:05:14 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.h,v 1.24 2008/06/05 06:27:42 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -99,17 +99,11 @@ extern void pdf_doc_bookmarks_add (pdf_obj *dict, int is_open); extern int pdf_doc_bookmarks_depth (void); -/* Form XObject */ -extern void pdf_doc_make_xform (pdf_obj *xform, - pdf_rect *bbox, /* const */ - pdf_tmatrix *matrix, /* const */ - pdf_obj *resources_ref); - /* Returns xobj_id of started xform. */ extern int pdf_doc_begin_grabbing (const char *ident, double ref_x, double ref_y, const pdf_rect *cropbox); -extern void pdf_doc_end_grabbing (void); +extern void pdf_doc_end_grabbing (pdf_obj *attrib); /* Annotation */ diff --git a/Build/source/texk/dvipdfmx/src/pdfnames.c b/Build/source/texk/dvipdfmx/src/pdfnames.c index 5a3a0e47839..a935593af53 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.1 2004/09/02 12:23:07 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfnames.c,v 1.2 2008/06/07 09:54:38 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -174,8 +174,9 @@ pdf_names_add_object (struct ht_table *names, pdf_release_obj(object); /* PLEASE FIX THIS!!! */ } else { if (value->object || value->object_ref) { - WARN("Object reference with key \"%s\" is in use.", - printable_key(key, keylen)); + if (pdf_obj_get_verbose()) { + WARN("Object reference with key \"%s\" is in use.", printable_key(key, keylen)); + } return -1; } else { value->object = object; diff --git a/Build/source/texk/dvipdfmx/src/pdfobj.c b/Build/source/texk/dvipdfmx/src/pdfobj.c index f0560134200..c9862c6fbce 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.58 2008/05/22 10:08:02 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfobj.c,v 1.59 2008/06/07 09:54:38 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -257,6 +257,12 @@ pdf_get_version (void) return pdf_version; } +int +pdf_obj_get_verbose(void) +{ + return verbose; +} + void pdf_obj_set_verbose(void) { diff --git a/Build/source/texk/dvipdfmx/src/pdfobj.h b/Build/source/texk/dvipdfmx/src/pdfobj.h index d68f4108015..fb0f58d5e74 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.27 2008/05/20 13:05:14 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfobj.h,v 1.28 2008/06/07 09:54:38 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -49,6 +49,7 @@ typedef struct pdf_file pdf_file; /* External interface to pdf routines */ +extern int pdf_obj_get_verbose (void); extern void pdf_obj_set_verbose (void); extern void pdf_error_cleanup (void); diff --git a/Build/source/texk/dvipdfmx/src/pdfparse.c b/Build/source/texk/dvipdfmx/src/pdfparse.c index 24705879b1b..111114ec362 100644 --- a/Build/source/texk/dvipdfmx/src/pdfparse.c +++ b/Build/source/texk/dvipdfmx/src/pdfparse.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/pdfparse.c,v 1.42 2008/05/16 10:51:25 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfparse.c,v 1.43 2008/06/07 09:54:38 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -283,7 +283,7 @@ parse_pdf_number (char **pp, char *endptr) } } else if (isdigit(p[0])) { if (has_dot) { - if (nddigits == DDIGITS_MAX) { + if (nddigits == DDIGITS_MAX && pdf_obj_get_verbose() > 1) { WARN("Number with more than %d fractional digits.", DDIGITS_MAX); } else if (nddigits < DDIGITS_MAX) { dpart = dpart * 10 + p[0] - '0'; diff --git a/Build/source/texk/dvipdfmx/src/pdfximage.c b/Build/source/texk/dvipdfmx/src/pdfximage.c index a2c7776b23e..d33b9629b51 100644 --- a/Build/source/texk/dvipdfmx/src/pdfximage.c +++ b/Build/source/texk/dvipdfmx/src/pdfximage.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/pdfximage.c,v 1.20 2008/05/17 01:16:53 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfximage.c,v 1.21 2008/05/29 13:43:51 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -80,6 +80,7 @@ struct pdf_ximage_ char *filename; pdf_obj *reference; pdf_obj *resource; + pdf_obj *attr_dict; }; @@ -108,7 +109,7 @@ static struct ic_ _ic = { }; static void -pdf_init_ximage_struct (pdf_ximage *I, const char *ident, const char *filename) +pdf_init_ximage_struct (pdf_ximage *I, const char *ident, const char *filename, pdf_obj *dict) { if (ident) { I->ident = NEW(strlen(ident)+1, char); @@ -125,6 +126,7 @@ pdf_init_ximage_struct (pdf_ximage *I, const char *ident, const char *filename) memset(I->res_name, 0, 16); I->reference = NULL; I->resource = NULL; + I->attr_dict = dict; I->attr.width = I->attr.height = 0; I->attr.xdensity = I->attr.ydensity = 1.0; @@ -143,7 +145,9 @@ pdf_clean_ximage_struct (pdf_ximage *I) pdf_release_obj(I->reference); if (I->resource) pdf_release_obj(I->resource); - pdf_init_ximage_struct(I, NULL, NULL); + if (I->attr_dict) + pdf_release_obj(I->attr_dict); + pdf_init_ximage_struct(I, NULL, NULL, NULL); } @@ -212,58 +216,9 @@ source_image_type (FILE *fp) return format; } -#if 0 -#define KEYCMP(k,s) (strcmp(pdf_name_value((k)),(s))) static int -filter_put_image_attr (pdf_obj *kp, pdf_obj *vp, void *dp) -{ - struct attr_ *attr = dp; - - if (KEYCMP(kp, "Width")) { - if (pdf_obj_typeof(vp) != PDF_NUMBER) - return -1; - attr->width = (long) pdf_number_value(vp); - } else if (KEYCMP(kp, "Height")) { - if (pdf_obj_typeof(vp) != PDF_NUMBER) - return -1; - attr->height = (long) pdf_number_value(vp); - } - - return 0; -} - -static int -filter_put_form_attr (pdf_obj *kp, pdf_obj *vp, void *dp) -{ - struct attr_ *attr = dp; - - if (KEYCMP(kp, "BBox")) { - if (pdf_array_length(vp) != 4) - return -1; - else { - int i; - double v[4]; - for (i = 0; i < 4; i++) { - pdf_obj *obj = pdf_get_array(vp, i); - if (pdf_obj_typeof(vp) != PDF_NUMBER) - return -1; - else { - v = pdf_number_value(obj); - } - } - attr->bbox.llx = v[0]; attr->bbox.lly = v[1]; - attr->bbox.urx = v[2]; attr->bbox.ury = v[3]; - } - } - - return 0; -} -#endif - - -static int -load_image (const char *ident, - const char *fullname, int format, FILE *fp, long page_no) +load_image (const char *ident, const char *fullname, int format, FILE *fp, + long page_no, pdf_obj *dict) { struct ic_ *ic = &_ic; int id = -1; /* ret */ @@ -276,7 +231,7 @@ load_image (const char *ident, } I = &ic->ximages[id]; - pdf_init_ximage_struct(I, ident, ident); + pdf_init_ximage_struct(I, ident, ident, dict); pdf_ximage_set_page(I, page_no, 0); switch (format) { @@ -350,7 +305,7 @@ load_image (const char *ident, #define dpx_fclose(f) (MFCLOSE((f))) int -pdf_ximage_findresource (const char *ident, long page_no) +pdf_ximage_findresource (const char *ident, long page_no, pdf_obj *dict) { struct ic_ *ic = &_ic; int id = -1; @@ -362,7 +317,8 @@ pdf_ximage_findresource (const char *ident, long page_no) for (id = 0; id < ic->count; id++) { I = &ic->ximages[id]; if (I->ident && !strcmp(ident, I->ident) && - I->page_no == page_no + (page_no < 0 ? I->page_count+1 : 0)) { + I->page_no == page_no + (page_no < 0 ? I->page_count+1 : 0) && + I->attr_dict == dict) { return id; } } @@ -399,7 +355,7 @@ pdf_ximage_findresource (const char *ident, long page_no) } else break; default: - id = load_image(ident, fullname, format, fp, page_no); + id = load_image(ident, fullname, format, fp, page_no, dict); break; } dpx_fclose(fp); @@ -518,6 +474,8 @@ pdf_ximage_set_image (pdf_ximage *I, void *image_info, pdf_obj *resource) pdf_add_dict(dict, pdf_new_name("Height"), pdf_new_number(info->height)); pdf_add_dict(dict, pdf_new_name("BitsPerComponent"), pdf_new_number(info->bits_per_component)); + if (I->attr_dict) + pdf_merge_dict(dict, I->attr_dict); pdf_release_obj(resource); /* Caller don't know we are using reference. */ I->resource = NULL; @@ -594,7 +552,7 @@ pdf_ximage_defineresource (const char *ident, I = &ic->ximages[id]; - pdf_init_ximage_struct(I, ident, NULL); + pdf_init_ximage_struct(I, ident, NULL, NULL); switch (subtype) { case PDF_XOBJECT_TYPE_IMAGE: diff --git a/Build/source/texk/dvipdfmx/src/pdfximage.h b/Build/source/texk/dvipdfmx/src/pdfximage.h index e8612484339..dc74d373af7 100644 --- a/Build/source/texk/dvipdfmx/src/pdfximage.h +++ b/Build/source/texk/dvipdfmx/src/pdfximage.h @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/pdfximage.h,v 1.12 2008/05/13 12:23:45 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfximage.h,v 1.13 2008/05/29 13:43:51 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -62,9 +62,10 @@ extern char *pdf_ximage_get_resname (int xobj_id); extern pdf_obj *pdf_ximage_get_reference (int xobj_id); -extern int pdf_ximage_findresource (const char *ident, long page_no); -extern int pdf_ximage_defineresource (const char *ident, - int subtype, void *cdata, pdf_obj *resource); +extern int pdf_ximage_findresource (const char *ident, long page_no, + pdf_obj *dict); +extern int pdf_ximage_defineresource (const char *ident, int subtype, + void *cdata, pdf_obj *resource); /* Called by pngimage, jpegimage, epdf, mpost, etc. */ extern void pdf_ximage_init_image_info (ximage_info *info); diff --git a/Build/source/texk/dvipdfmx/src/spc_dvips.c b/Build/source/texk/dvipdfmx/src/spc_dvips.c index d026fa77ac0..f75afbf9a02 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.10 2008/02/13 20:22:21 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_dvips.c,v 1.11 2008/05/29 13:43:51 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -124,7 +124,7 @@ spc_handler_ps_file (struct spc_env *spe, struct spc_arg *args) return -1; } - form_id = pdf_ximage_findresource(filename, 1); + form_id = pdf_ximage_findresource(filename, 1, NULL); if (form_id < 0) { spc_warn(spe, "Failed to read image file: %s", filename); RELEASE(filename); @@ -157,7 +157,7 @@ spc_handler_ps_plotfile (struct spc_env *spe, struct spc_arg *args) return -1; } - form_id = pdf_ximage_findresource(filename, 1); + form_id = pdf_ximage_findresource(filename, 1, NULL); if (form_id < 0) { spc_warn(spe, "Could not open PS file: %s", filename); error = -1; diff --git a/Build/source/texk/dvipdfmx/src/spc_html.c b/Build/source/texk/dvipdfmx/src/spc_html.c index df21ec9d595..1460ed56536 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.7 2008/02/13 20:22:21 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_html.c,v 1.8 2008/05/29 13:43:51 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -635,7 +635,7 @@ spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) return error; } - id = pdf_ximage_findresource(pdf_string_value(src), 0); + id = pdf_ximage_findresource(pdf_string_value(src), 0, NULL); if (id < 0) { spc_warn(spe, "Could not find/load image: %s", pdf_string_value(src)); error = -1; diff --git a/Build/source/texk/dvipdfmx/src/spc_misc.c b/Build/source/texk/dvipdfmx/src/spc_misc.c index 1dc3cabf1c5..9d7d55257c0 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.7 2008/02/13 20:22:21 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_misc.c,v 1.8 2008/05/29 13:43:51 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -134,7 +134,7 @@ spc_handler_postscriptbox (struct spc_env *spe, struct spc_arg *ap) } MFCLOSE(fp); - form_id = pdf_ximage_findresource(filename, 0); + form_id = pdf_ximage_findresource(filename, 0, NULL); if (form_id < 0) { spc_warn(spe, "Failed to load image file: %s", filename); return -1; diff --git a/Build/source/texk/dvipdfmx/src/spc_pdfm.c b/Build/source/texk/dvipdfmx/src/spc_pdfm.c index ee6d9f89d70..16971bc1ad1 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.35 2008/05/22 10:08:02 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.40 2008/06/07 09:54:38 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -280,21 +280,12 @@ safeputresdict (pdf_obj *kp, pdf_obj *vp, void *dp) dict = pdf_lookup_dict(dp, key); if (pdf_obj_isaref(vp)) { - if (dict) { -#if 0 - return E_INVALID_ACCESS; -#endif - WARN("Replacing whole page/form resource dict entry \"%s\"...", key); - WARN("You might be creating a broken PDF document."); - } - pdf_add_dict(dp, - pdf_new_name(key), pdf_link_obj(vp)); + pdf_add_dict(dp, pdf_new_name(key), pdf_link_obj(vp)); } else if (pdf_obj_typeof(vp) == PDF_DICT) { if (dict) pdf_foreach_dict(vp, safeputresdent, dict); else { - pdf_add_dict(dp, - pdf_new_name(key), pdf_link_obj(vp)); + pdf_add_dict(dp, pdf_new_name(key), pdf_link_obj(vp)); } } else { WARN("Invalid type (not DICT) for page/form resource dict entry: key=\"%s\"", key); @@ -966,7 +957,7 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) struct spc_pdf_ *sd = &_pdf_stat; int xobj_id; char *ident = NULL; - pdf_obj *fspec; + pdf_obj *fspec, *attr = NULL; transform_info ti; long page_no; @@ -1004,7 +995,16 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) return -1; } - xobj_id = pdf_ximage_findresource(pdf_string_value(fspec), page_no); + skip_white(&args->curptr, args->endptr); + if (args->curptr < args->endptr) { + attr = parse_pdf_object(&args->curptr, args->endptr, NULL); + if (!attr || !PDF_OBJ_DICTTYPE(attr)) { + spc_warn(spe, "Ignore invalid attribute dictionary."); + if (attr) pdf_release_obj(attr); + } + } + + xobj_id = pdf_ximage_findresource(pdf_string_value(fspec), page_no, attr); if (xobj_id < 0) { spc_warn(spe, "Could not find image resource..."); pdf_release_obj(fspec); @@ -1013,7 +1013,8 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) return -1; } - pdf_dev_put_image(xobj_id, &ti, spe->x_user, spe->y_user); + if (!(ti.flags & INFO_DO_HIDE)) + pdf_dev_put_image(xobj_id, &ti, spe->x_user, spe->y_user); if (ident) { addresource(sd, ident, xobj_id); @@ -1039,7 +1040,7 @@ spc_handler_pdfm_dest (struct spc_env *spe, struct spc_arg *args) spc_warn(spe, "PDF string expected for destination name but not found."); return -1; } else if (!PDF_OBJ_STRINGTYPE(name)) { - spc_warn(spe, "PDF string expected for destination name but not found."); + spc_warn(spe, "PDF string expected for destination name but invalid type."); pdf_release_obj(name); return -1; } @@ -1049,7 +1050,7 @@ spc_handler_pdfm_dest (struct spc_env *spe, struct spc_arg *args) spc_warn(spe, "No destination not specified for pdf:dest."); pdf_release_obj(name); return -1; - } else if (!PDF_OBJ_ARRAYTYPE(array)) { + } else if (!PDF_OBJ_ARRAYTYPE(array)) { spc_warn(spe, "Destination not specified as an array object!"); pdf_release_obj(name); pdf_release_obj(array); @@ -1060,11 +1061,9 @@ spc_handler_pdfm_dest (struct spc_env *spe, struct spc_arg *args) pdf_string_value (name), pdf_string_length(name), array); + if (error) pdf_release_obj(array); pdf_release_obj(name); - if (error) - spc_warn(spe, "Could not add Dests name tree entry..."); - return 0; } @@ -1300,8 +1299,8 @@ spc_handler_pdfm_literal (struct spc_env *spe, struct spc_arg *args) if (args->curptr < args->endptr) { pdf_tmatrix M; - M.a = M.d = 1.0; M.b = M.c = 0.0; if (!direct) { + M.a = M.d = 1.0; M.b = M.c = 0.0; M.e = spe->x_user; M.f = spe->y_user; pdf_dev_concat(&M); } @@ -1318,17 +1317,51 @@ spc_handler_pdfm_literal (struct spc_env *spe, struct spc_arg *args) return 0; } -/* - * FSTREAM: Create a PDF stream object from an existing file. - * - * pdf: fstream @objname (filename) [PDF_DICT] - */ static int -spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) +spc_handler_pdfm_bcontent (struct spc_env *spe, struct spc_arg *args) +{ + pdf_tmatrix M; + double xpos, ypos; + + pdf_dev_gsave(); + pdf_dev_get_coord(&xpos, &ypos); + pdf_setmatrix(&M, 1.0, 0.0, 0.0, 1.0, spe->x_user - xpos, spe->y_user - ypos); + pdf_dev_concat(&M); + pdf_dev_push_coord(spe->x_user, spe->y_user); + return 0; +} + +static int +spc_handler_pdfm_econtent (struct spc_env *spe, struct spc_arg *args) +{ + pdf_dev_pop_coord(); + pdf_dev_grestore(); + return 0; +} + +static int +spc_handler_pdfm_code (struct spc_env *spe, struct spc_arg *args) +{ + skip_white(&args->curptr, args->endptr); + + if (args->curptr < args->endptr) { + pdf_doc_add_page_content(" ", 1); + pdf_doc_add_page_content(args->curptr, (long) (args->endptr - args->curptr)); + args->curptr = args->endptr; + } + + return 0; +} + +#define STRING_STREAM 0 +#define FILE_STREAM 1 + +static int +spc_handler_pdfm_stream_with_type (struct spc_env *spe, struct spc_arg *args, int type) { pdf_obj *fstream; - long stream_len, nb_read; - char *ident, *filename; + long nb_read; + char *ident, *instring; pdf_obj *tmp; FILE *fp; @@ -1336,7 +1369,7 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) ident = parse_opt_ident(&args->curptr, args->endptr); if (!ident) { - spc_warn(spe, "Missing objname string for pdf:fstream."); + spc_warn(spe, "Missing objname for pdf:(f)stream."); return -1; } @@ -1344,45 +1377,51 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) tmp = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!tmp) { - spc_warn(spe, "Missing filename string for pdf:fstream."); + spc_warn(spe, "Missing input string for pdf:(f)stream."); RELEASE(ident); return -1; } else if (!PDF_OBJ_STRINGTYPE(tmp)) { - spc_warn(spe, "Missing filename string for pdf:fstream."); + spc_warn(spe, "Invalid type of input string for pdf:(f)stream."); pdf_release_obj(tmp); RELEASE(ident); return -1; } - filename = pdf_string_value(tmp); - if (!filename) { - spc_warn(spe, "Missing filename string for pdf:fstream."); - pdf_release_obj(tmp); - RELEASE(ident); - return -1; - } - - fstream = pdf_new_stream(STREAM_COMPRESS); + instring = pdf_string_value(tmp); - fp = DPXFOPEN(filename, DPX_RES_TYPE_BINARY); - if (!fp) { - spc_warn(spe, "Could not open file: %s", filename); - pdf_release_obj(fstream); + switch (type) { + case FILE_STREAM: + if (!instring) { + spc_warn(spe, "Missing filename for pdf:fstream."); + pdf_release_obj(tmp); + RELEASE(ident); + return -1; + } + fp = DPXFOPEN(instring, DPX_RES_TYPE_BINARY); + if (!fp) { + spc_warn(spe, "Could not open file: %s", instring); + pdf_release_obj(tmp); + RELEASE(ident); + return -1; + } + fstream = pdf_new_stream(STREAM_COMPRESS); + while ((nb_read = + fread(work_buffer, sizeof(char), WORK_BUFFER_SIZE, fp)) > 0) + pdf_add_stream(fstream, work_buffer, nb_read); + MFCLOSE(fp); + break; + case STRING_STREAM: + fstream = pdf_new_stream(STREAM_COMPRESS); + if (instring) + pdf_add_stream(fstream, instring, strlen(instring)); + break; + default: pdf_release_obj(tmp); RELEASE(ident); return -1; } pdf_release_obj(tmp); - stream_len = 0; - while ((nb_read = - fread(work_buffer, sizeof(char), WORK_BUFFER_SIZE, fp)) > 0) { - pdf_add_stream(fstream, work_buffer, nb_read); - stream_len += nb_read; - } - - MFCLOSE(fp); - /* * Optional dict. * @@ -1418,6 +1457,28 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) return 0; } +/* + * STREAM: Create a PDF stream object from an input string. + * + * pdf: stream @objname (input_string) [PDF_DICT] + */ +static int +spc_handler_pdfm_stream (struct spc_env *spe, struct spc_arg *args) +{ + return spc_handler_pdfm_stream_with_type (spe, args, STRING_STREAM); +} + +/* + * FSTREAM: Create a PDF stream object from an existing file. + * + * pdf: fstream @objname (filename) [PDF_DICT] + */ +static int +spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) +{ + return spc_handler_pdfm_stream_with_type (spe, args, FILE_STREAM); +} + /* Grab page content as follows: * * Reference point = (x_user, y_user) @@ -1499,27 +1560,25 @@ spc_handler_pdfm_bform (struct spc_env *spe, struct spc_arg *args) return 0; } +/* An extra dictionary after exobj must be merged to the form dictionary, + * not resource dictionary. + * Please use pdf:put @resources (before pdf:exobj) instead. + */ static int spc_handler_pdfm_eform (struct spc_env *spe, struct spc_arg *args) { - pdf_obj *garbage; - pdf_obj *resource; + pdf_obj *attrib = NULL; skip_white(&args->curptr, args->endptr); if (args->curptr < args->endptr) { - /* An extra dictionary after exobj must be merged to /Resources. - * Please use pdf:put @resources (before pdf:exobj) instead. - */ - garbage = parse_pdf_dict(&args->curptr, args->endptr, NULL); - if (garbage) { - resource = pdf_doc_current_page_resources(); - pdf_merge_dict(resource, garbage); - spc_warn(spe, "Garbage after special pdf:exobj."); - pdf_release_obj(garbage); + attrib = parse_pdf_dict(&args->curptr, args->endptr, NULL); + if (attrib && !PDF_OBJ_DICTTYPE(attrib)) { + pdf_release_obj(attrib); + attrib = NULL; } } - pdf_doc_end_grabbing(); + pdf_doc_end_grabbing(attrib); return 0; } @@ -1576,7 +1635,7 @@ spc_handler_pdfm_uxobj (struct spc_env *spe, struct spc_arg *args) */ xobj_id = findresource(sd, ident); if (xobj_id < 0) { - xobj_id = pdf_ximage_findresource(ident, 0); + xobj_id = pdf_ximage_findresource(ident, 0, NULL); if (xobj_id < 0) { spc_warn(spe, "Specified (image) object doesn't exist: %s", ident); RELEASE(ident); @@ -1880,10 +1939,15 @@ static struct spc_handler pdfm_handlers[] = { {"tounicode", spc_handler_pdfm_tounicode}, #endif /* ENABLE_TOUNICODE */ {"literal", spc_handler_pdfm_literal}, + {"stream", spc_handler_pdfm_stream}, {"fstream", spc_handler_pdfm_fstream}, {"names", spc_handler_pdfm_names}, {"mapline", spc_handler_pdfm_mapline}, {"mapfile", spc_handler_pdfm_mapfile}, + + {"bcontent", spc_handler_pdfm_bcontent}, + {"econtent", spc_handler_pdfm_econtent}, + {"code", spc_handler_pdfm_code}, }; int diff --git a/Build/source/texk/dvipdfmx/src/spc_util.c b/Build/source/texk/dvipdfmx/src/spc_util.c index 606a97bea4c..bd1fe8d906f 100644 --- a/Build/source/texk/dvipdfmx/src/spc_util.c +++ b/Build/source/texk/dvipdfmx/src/spc_util.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/spc_util.c,v 1.11 2008/03/01 09:00:31 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_util.c,v 1.14 2008/06/01 01:38:32 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -181,6 +181,7 @@ spc_read_color_pdf (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *a double cv[4]; /* at most four */ int nc, isarry = 0; int error = 0; + char *q; skip_blank(&ap->curptr, ap->endptr); @@ -201,8 +202,16 @@ spc_read_color_pdf (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *a pdf_color_cmykcolor(colorspec, cv[0], cv[1], cv[2], cv[3]); break; default: - spc_warn(spe, "Expecting either gray level or RGB/CMYK color array: %d", nc); - error = -1; + /* Try to read the color names defined in dvipsname.def */ + q = parse_c_ident(&ap->curptr, ap->endptr); + if (!q) { + spc_warn(spe, "No valid color specified?"); + return -1; + } + error = pdf_color_namedcolor(colorspec, q); + if (error) + spc_warn(spe, "Unrecognized color name: %s", q); + RELEASE(q); break; } @@ -482,6 +491,8 @@ spc_read_dimtrns_pdfm (struct spc_env *spe, transform_info *p, struct spc_arg *a "clip", #define K__PAGE 10 "page", +#define K__HIDE 11 + "hide", NULL }; double xscale, yscale, rotate; @@ -490,6 +501,7 @@ spc_read_dimtrns_pdfm (struct spc_env *spe, transform_info *p, struct spc_arg *a has_xscale = has_yscale = has_scale = has_rotate = has_matrix = 0; xscale = yscale = 1.0; rotate = 0.0; p->flags |= INFO_DO_CLIP; /* default: do clipping */ + p->flags &= ~INFO_DO_HIDE; /* default: do clipping */ skip_blank(&ap->curptr, ap->endptr); @@ -602,6 +614,9 @@ spc_read_dimtrns_pdfm (struct spc_env *spe, transform_info *p, struct spc_arg *a error = -1; } break; + case K__HIDE: + p->flags |= INFO_DO_HIDE; + break; default: error = -1; break; |