diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2008-03-27 11:18:16 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2008-03-27 11:18:16 +0000 |
commit | a95124f73754f00f40705b40ff513e5f21db45fd (patch) | |
tree | d288b3ce80bc10e37bc7bca19ae6698cddd9a5ea /Build/source/texk/xdvipdfmx/src/spc_pdfm.c | |
parent | 194899d8a5ee8f12d82f140c728e1f9dad6c1d04 (diff) |
xdvipdfmx update from xetex svn r.633
git-svn-id: svn://tug.org/texlive/trunk@7186 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvipdfmx/src/spc_pdfm.c')
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/spc_pdfm.c | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/spc_pdfm.c b/Build/source/texk/xdvipdfmx/src/spc_pdfm.c index d86a158e53f..6d914149d86 100644 --- a/Build/source/texk/xdvipdfmx/src/spc_pdfm.c +++ b/Build/source/texk/xdvipdfmx/src/spc_pdfm.c @@ -1,8 +1,8 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.26 2007/04/25 09:44:49 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.30 2008/02/13 20:22:21 matthias Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2007 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team <dvipdfmx@project.ktug.or.kr> Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> @@ -331,7 +331,6 @@ spc_handler_pdfm_put (struct spc_env *spe, struct spc_arg *ap) } skip_white(&ap->curptr, ap->endptr); - obj2 = parse_pdf_object(&ap->curptr, ap->endptr); if (!obj2) { spc_warn(spe, "Missing (an) object(s) to put into \"%s\"!", ident); @@ -392,7 +391,7 @@ spc_handler_pdfm_put (struct spc_env *spe, struct spc_arg *ap) break; } pdf_release_obj(obj2); - + RELEASE(ident); return error; } @@ -526,6 +525,7 @@ maybe_reencode_utf8(pdf_obj *instring) } pdf_set_string(instring, wbuf, op - wbuf); + return 0; } @@ -640,7 +640,7 @@ spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args) } transform_info_clear(&ti); - if (spc_util_read_dimtrns(spe, &ti, args, 0) < 0) { + if (spc_util_read_dimtrns(spe, &ti, args, NULL, 0) < 0) { if (ident) RELEASE(ident); return -1; @@ -774,9 +774,9 @@ spc_handler_pdfm_bcolor (struct spc_env *spe, struct spc_arg *ap) if (error) spc_warn(spe, "Invalid color specification?"); else { - pdf_color_push(); /* save currentcolor */ - pdf_dev_setcolor(&fc, 1); - pdf_dev_setcolor(&sc, 0); + pdf_color_push(&sc, &fc); /* save currentcolor */ + pdf_dev_set_strokingcolor(&sc); + pdf_dev_set_nonstrokingcolor(&fc); } return error; @@ -802,8 +802,8 @@ spc_handler_pdfm_scolor (struct spc_env *spe, struct spc_arg *ap) spc_warn(spe, "Invalid color specification?"); else { pdf_color_set_default(&fc); /* ????? */ - pdf_dev_setcolor(&fc, 1); - pdf_dev_setcolor(&sc, 0); + pdf_dev_set_strokingcolor(&sc); + pdf_dev_set_nonstrokingcolor(&fc); } return error; @@ -824,7 +824,7 @@ spc_handler_pdfm_btrans (struct spc_env *spe, struct spc_arg *args) transform_info ti; transform_info_clear(&ti); - if (spc_util_read_dimtrns(spe, &ti, args, 0) < 0) { + if (spc_util_read_dimtrns(spe, &ti, args, NULL, 0) < 0) { return -1; } @@ -958,8 +958,8 @@ spc_handler_pdfm_article (struct spc_env *spe, struct spc_arg *args) info_dict = parse_pdf_dict(&args->curptr, args->endptr); #endif /* ENABLE_TOUNICODE */ if (!info_dict) { - RELEASE(ident); spc_warn(spe, "Ignoring article with invalid info dictionary."); + RELEASE(ident); return -1; } @@ -999,7 +999,7 @@ spc_handler_pdfm_bead (struct spc_env *spe, struct spc_arg *args) /* If okay so far, try to get a bounding box */ transform_info_clear(&ti); - if (spc_util_read_dimtrns(spe, &ti, args, 0) < 0) { + if (spc_util_read_dimtrns(spe, &ti, args, NULL, 0) < 0) { RELEASE(article_name); return -1; } @@ -1053,6 +1053,7 @@ spc_handler_pdfm_bead (struct spc_env *spe, struct spc_arg *args) page_no = pdf_doc_current_page_number(); pdf_doc_add_bead(article_name, NULL, page_no, &rect); + RELEASE(article_name); return 0; } @@ -1064,6 +1065,7 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) char *ident = NULL; pdf_obj *fspec; transform_info ti; + long page_no; skip_white(&args->curptr, args->endptr); if (args->curptr[0] == '@') { @@ -1077,7 +1079,8 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) } transform_info_clear(&ti); - if (spc_util_read_dimtrns(spe, &ti, args, 0) < 0) { + page_no = 1; + if (spc_util_read_dimtrns(spe, &ti, args, &page_no, 0) < 0) { if (ident) RELEASE(ident); return -1; @@ -1093,10 +1096,12 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) } else if (!PDF_OBJ_STRINGTYPE(fspec)) { spc_warn(spe, "Missing filename string for pdf:image."); pdf_release_obj(fspec); + if (ident) + RELEASE(ident); return -1; } - xobj_id = pdf_ximage_findresource(pdf_string_value(fspec), 0, 0); + xobj_id = pdf_ximage_findresource(pdf_string_value(fspec), page_no); if (xobj_id < 0) { spc_warn(spe, "Could not find image resource..."); pdf_release_obj(fspec); @@ -1329,8 +1334,8 @@ spc_handler_pdfm_object (struct spc_env *spe, struct spc_arg *args) object = parse_pdf_object(&args->curptr, args->endptr); if (!object) { - RELEASE(ident); spc_warn(spe, "Could not find an object definition for \"%s\".", ident); + RELEASE(ident); return -1; } else { spc_push_object(ident, object); @@ -1469,16 +1474,16 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) pdf_release_obj(tmp); if (!fullname) { spc_warn(spe, "Could not find file."); - RELEASE(ident); pdf_release_obj(fstream); + RELEASE(ident); return -1; } fp = MFOPEN(fullname, FOPEN_RBIN_MODE); if (!fp) { spc_warn(spe, "Could not open file: %s", fullname); - RELEASE(ident); pdf_release_obj(fstream); + RELEASE(ident); return -1; } @@ -1506,8 +1511,8 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) tmp = parse_pdf_dict(&args->curptr, args->endptr); if (!tmp) { spc_warn(spe, "Parsing dictionary failed."); - RELEASE(ident); pdf_release_obj(fstream); + RELEASE(ident); return -1; } if (pdf_lookup_dict(tmp, "Length")) { @@ -1559,7 +1564,7 @@ spc_handler_pdfm_bform (struct spc_env *spe, struct spc_arg *args) } transform_info_clear(&ti); - if (spc_util_read_dimtrns(spe, &ti, args, 0) < 0) { + if (spc_util_read_dimtrns(spe, &ti, args, NULL, 0) < 0) { RELEASE(ident); return -1; } @@ -1672,7 +1677,7 @@ spc_handler_pdfm_uxobj (struct spc_env *spe, struct spc_arg *args) transform_info_clear(&ti); if (args->curptr < args->endptr) { - if (spc_util_read_dimtrns(spe, &ti, args, 0) < 0) { + if (spc_util_read_dimtrns(spe, &ti, args, NULL, 0) < 0) { RELEASE(ident); return -1; } @@ -1684,7 +1689,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, 0); + xobj_id = pdf_ximage_findresource(ident, 0); if (xobj_id < 0) { spc_warn(spe, "Specified (image) object doesn't exist: %s", ident); RELEASE(ident); @@ -1832,6 +1837,7 @@ spc_handler_pdfm_mapfile (struct spc_env *spe, struct spc_arg *args) } else { error = pdf_load_fontmap_file(mapfile, mode); } + RELEASE(mapfile); return error; } @@ -1843,7 +1849,6 @@ spc_handler_pdfm_tounicode (struct spc_env *spe, struct spc_arg *args) { struct spc_pdf_ *sd = &_pdf_stat; char *cmap_name; - int error = 0; /* First clear */ sd->cd.cmap_id = -1; @@ -1863,19 +1868,20 @@ spc_handler_pdfm_tounicode (struct spc_env *spe, struct spc_arg *args) cmap_name = parse_ident(&args->curptr, args->endptr); if (!cmap_name) { spc_warn(spe, "Missing ToUnicode mapping name..."); - return -1; + return -1; } sd->cd.cmap_id = CMap_cache_find(cmap_name); if (sd->cd.cmap_id < 0) { spc_warn(spe, "Failed to load ToUnicode mapping: %s", cmap_name); - error = -1; + RELEASE(cmap_name); + return -1; } /* Shift-JIS like encoding may contain backslash in 2nd byte. * WARNING: This will add nasty extension to PDF parser. */ - if (!error && sd->cd.cmap_id >= 0) { + if (sd->cd.cmap_id >= 0) { if (strstr(cmap_name, "RKSJ") || strstr(cmap_name, "B5") || strstr(cmap_name, "GBK") || @@ -1883,8 +1889,7 @@ spc_handler_pdfm_tounicode (struct spc_env *spe, struct spc_arg *args) sd->cd.unescape_backslash = 1; } RELEASE(cmap_name); - - return error; + return 0; } #endif /* ENABLE_TOUNICODE */ |