From 81a96337df5ca602b278636aa507c817939dea40 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 14 Dec 2006 01:04:56 +0000 Subject: update to dvipdfmx-20061211 git-svn-id: svn://tug.org/texlive/trunk@2724 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/README.TL | 2 +- Build/source/texk/dvipdfmx/ChangeLog | 39 +++++++++- Build/source/texk/dvipdfmx/configure.in | 2 +- Build/source/texk/dvipdfmx/src/dpxfile.c | 4 +- Build/source/texk/dvipdfmx/src/dvi.c | 17 ++++- Build/source/texk/dvipdfmx/src/dvi.h | 3 +- Build/source/texk/dvipdfmx/src/dvipdfmx.c | 15 ++-- Build/source/texk/dvipdfmx/src/mpost.c | 30 +++++++- Build/source/texk/dvipdfmx/src/pdfcolor.c | 22 ++++-- Build/source/texk/dvipdfmx/src/pdfcolor.h | 3 +- Build/source/texk/dvipdfmx/src/pdfdev.c | 22 +----- Build/source/texk/dvipdfmx/src/pdfdev.h | 5 +- Build/source/texk/dvipdfmx/src/pdfdoc.c | 33 ++------ Build/source/texk/dvipdfmx/src/pdfdraw.c | 120 +++--------------------------- Build/source/texk/dvipdfmx/src/pdfdraw.h | 4 +- Build/source/texk/dvipdfmx/src/pdfobj.c | 3 +- Build/source/texk/dvipdfmx/src/spc_pdfm.c | 5 +- Build/source/texk/dvipdfmx/src/spc_tpic.c | 6 +- Build/source/texk/dvipdfmx/src/t1_load.c | 48 ++++++++---- Build/source/texk/dvipdfmx/src/truetype.c | 31 ++++---- 20 files changed, 194 insertions(+), 220 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/README.TL b/Build/source/texk/README.TL index fa6db6379ee..45ac72ac094 100644 --- a/Build/source/texk/README.TL +++ b/Build/source/texk/README.TL @@ -6,7 +6,7 @@ afm2pl 0.7.03 - ok 5dec06 devnag - from devnag package installed in texmf-dist. -dvipdfmx 20050831 - ok 5dec06 +dvipdfmx 20061211 - ok 14dec06 http://project.ktug.or.kr/dvipdfmx/snapshot/current/ -> http://www.ctan.org/tex-archive/dviware/dvipdfmx/ diff --git a/Build/source/texk/dvipdfmx/ChangeLog b/Build/source/texk/dvipdfmx/ChangeLog index 0d19b7fe900..7bdaaaad65e 100644 --- a/Build/source/texk/dvipdfmx/ChangeLog +++ b/Build/source/texk/dvipdfmx/ChangeLog @@ -1,8 +1,45 @@ -$Header: /home/cvsroot/dvipdfmx/ChangeLog,v 1.139 2005/08/31 08:12:28 chofchof Exp $ +$Header: /home/cvsroot/dvipdfmx/ChangeLog,v 1.141 2006/12/11 13:01:38 chofchof Exp $ ChangeLog: Changes for dvipdfmx =============================== +2006-12-11 Jin-Hwan Cho + + * mpost.c, pdfdev.c, pdfdev.h, spc_pdfm.c, pdfcolor.c, pdfcolor.h, + pdfdraw.c, pdfdraw.h: + Temporary implementation for mps files generated by mptopdf. + +2006-12-11 Jin-Hwan Cho + + * pdfcolor.c: + Fixed the color bug reported by H. J. Lee and Pablo Rodriguez. + +2006-12-07 Jin-Hwan Cho + + * pdfobj.c: + Fixed a bug with xref, reported by Paul Guyot. + +2006-12-06 Jin-Hwan Cho + + * t1_load.c: + Modified to work with broken fonts, e.g. belleek/blsy.pfb. + +2006-12-06 Jin-Hwan Cho + + * dvipdfmx.c, dvi.c, dvi.h: + Add xoffset and yoffset specials. + +2005-12-18 Jin-Hwan Cho + + * dpxfile.c: + Fixed a bug found by Karnes Kim. + +2005-10-14 Jin-Hwan Cho + + * spc_tpic.c: + Fix a bug on spc_handler_tpic_bk() and spc_handler_tpic_wh(); + reported by Akira Kakuto. + 2005-08-31 Jin-Hwan Cho * pdfdoc.c, pdfdraw.c: diff --git a/Build/source/texk/dvipdfmx/configure.in b/Build/source/texk/dvipdfmx/configure.in index b93eb9dffc1..a9f48bf215d 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, 20050823) +AM_INIT_AUTOMAKE(dvipdfmx, 20061211) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/Build/source/texk/dvipdfmx/src/dpxfile.c b/Build/source/texk/dvipdfmx/src/dpxfile.c index a0984fa2fa2..295e4d2f4fd 100644 --- a/Build/source/texk/dvipdfmx/src/dpxfile.c +++ b/Build/source/texk/dvipdfmx/src/dpxfile.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/dpxfile.c,v 1.13 2005/07/20 10:41:54 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/dpxfile.c,v 1.14 2005/12/18 14:56:47 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -669,7 +669,7 @@ dpx_create_temp_file (void) char *_tmpa = NEW(L_tmpnam + 1, char); tmp = tmpnam(_tmpa); if (!tmp) - RELEASE(tmpa); + RELEASE(_tmpa); } #endif /* MIKTEX */ diff --git a/Build/source/texk/dvipdfmx/src/dvi.c b/Build/source/texk/dvipdfmx/src/dvi.c index 189592584e9..232efca6d14 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.37 2005/08/18 08:46:21 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/dvi.c,v 1.38 2006/12/06 12:50:40 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -1684,7 +1684,7 @@ read_length (double *vp, double mag, char **pp, char *endptr) static int -scan_special (double *wd, double *ht, char *lm, const char *buf, UNSIGNED_QUAD size) +scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, const char *buf, UNSIGNED_QUAD size) { char *q, *p = (char *) buf; char *endptr; @@ -1724,6 +1724,14 @@ scan_special (double *wd, double *ht, char *lm, const char *buf, UNSIGNED_QUAD s error = read_length(ht, dvi_tell_mag(), &p, endptr); if (!error) *ht *= dvi_tell_mag(); + } else if (!strcmp(kp, "xoffset")) { + error = read_length(xo, dvi_tell_mag(), &p, endptr); + if (!error) + *xo *= dvi_tell_mag(); + } else if (!strcmp(kp, "yoffset")) { + error = read_length(yo, dvi_tell_mag(), &p, endptr); + if (!error) + *yo *= dvi_tell_mag(); } RELEASE(kp); } @@ -1760,7 +1768,8 @@ scan_special (double *wd, double *ht, char *lm, const char *buf, UNSIGNED_QUAD s void dvi_scan_paper_size (unsigned page_no, - double *page_width, double *page_height, char *landscape) + double *page_width, double *page_height, + double *x_offset, double *y_offset, char *landscape) { FILE *fp = dvi_file; long offset; @@ -1789,7 +1798,7 @@ dvi_scan_paper_size (unsigned page_no, size = MIN(size, 1024); if (fread(buf, sizeof(char), size, fp) != size) ERROR("Reading DVI file failed!"); - scan_special(page_width, page_height, landscape, buf, size); + scan_special(page_width, page_height, x_offset, y_offset, landscape, buf, size); continue; } diff --git a/Build/source/texk/dvipdfmx/src/dvi.h b/Build/source/texk/dvipdfmx/src/dvi.h index 79269a6c67e..cfbae65f41c 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.12 2004/09/02 12:23:06 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/dvi.h,v 1.13 2006/12/06 12:50:40 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -70,6 +70,7 @@ extern void dvi_do_page (unsigned page_no, double x_offset, double y_offset); extern void dvi_scan_paper_size (unsigned page_no, double *width, double *height, + double *x_offset, double *y_offset, char *landscape); extern int dvi_locate_font (const char *name, spt_t ptsize); diff --git a/Build/source/texk/dvipdfmx/src/dvipdfmx.c b/Build/source/texk/dvipdfmx/src/dvipdfmx.c index 93a71638f9e..de113ac8386 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.45 2005/07/30 11:44:18 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/dvipdfmx.c,v 1.47 2006/12/11 13:23:26 chofchof Exp $ This is DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks. @@ -123,7 +123,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-2005 by the DVIPDFMx project team\n"); + fprintf (stdout, "\nCopyright (C) 2002-2006 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"); @@ -665,13 +665,14 @@ do_dvi_pages (void) page_no = page_ranges[i].first; for (;;) { if (page_no < dvi_npages()) { - double w, h; + double w, h, xo, yo; char lm; MESG("[%d", page_no+1); /* Users want to change page size even after page is started! */ w = page_width; h = page_height; lm = landscape_mode; - dvi_scan_paper_size(page_no, &w, &h, &lm); + xo = x_offset; yo = y_offset; + dvi_scan_paper_size(page_no, &w, &h, &xo, &yo, &lm); if (lm != landscape_mode) { SWAP(w, h); landscape_mode = lm; @@ -680,6 +681,10 @@ do_dvi_pages (void) page_width = w; page_height = h; } + if (x_offset != xo || y_offset != yo) { + x_offset = xo; + y_offset = yo; + } if (page_width != paper_width || page_height != paper_height) { mediabox.llx = 0.0; @@ -832,7 +837,7 @@ main (int argc, char *argv[]) if (dvi2pts == 0.0) ERROR("dvi_init() failed!"); - dvi_scan_paper_size(0, &paper_width, &paper_height, &landscape_mode); + dvi_scan_paper_size(0, &paper_width, &paper_height, &x_offset, &y_offset, &landscape_mode); if (landscape_mode) { SWAP(paper_width, paper_height); } diff --git a/Build/source/texk/dvipdfmx/src/mpost.c b/Build/source/texk/dvipdfmx/src/mpost.c index 16a60a54b50..6875d5d573e 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.35 2005/08/30 07:56:08 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/mpost.c,v 1.36 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -342,6 +342,8 @@ skip_prolog (char **start, char *end) #define STRINGWIDTH 210 +#define DEF 999 + #define FSHOW 1001 #define STEXFIG 1002 #define ETEXFIG 1003 @@ -408,7 +410,9 @@ static struct operators {"setfont", SETFONT}, {"currentfont", CURRENTFONT}, - {"stringwidth", STRINGWIDTH} + {"stringwidth", STRINGWIDTH}, + + {"def", DEF} /* not implemented yet; just work with mptopdf */ }; static struct operators mps_operators[] = { @@ -1334,6 +1338,12 @@ do_operator (const char *token, double x_user, double y_user) error = do_texfig_operator(opcode, x_user, y_user); break; + case DEF: + tmp = POP_STACK(); + tmp = POP_STACK(); + /* do nothing; not implemented yet */ + break; + default: if (is_fontname(token)) { PUSH(pdf_new_name(token)); @@ -1392,7 +1402,21 @@ mp_parse_body (char **start, char *end, double x_user, double y_user) PUSH(obj); } else if (**start == '/' && (obj = parse_pdf_name(start, end))) { - PUSH(obj); + /* Temporary implementation for mps files generated by mptopdf: + * Just ignore the following command: + * /fshow {exch findfont exch scalefont setfont show} bind def + */ + if (strcmp(pdf_name_value(obj), "fshow") == 0) { + while (*start < end - 3) { + if (**start == 'd' && *(*start+1) == 'e' && *(*start+2) == 'f') { + *start += 3; + break; + } + (*start)++; + } + } else { + PUSH(obj); + } } else { token = parse_ident(start, end); if (!token) diff --git a/Build/source/texk/dvipdfmx/src/pdfcolor.c b/Build/source/texk/dvipdfmx/src/pdfcolor.c index 0e0162f04ce..8d9341302c1 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.11 2005/08/18 04:36:20 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfcolor.c,v 1.13 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -350,6 +350,20 @@ static struct { 0, }; +/* 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.next > 0) { + current_stroke = color_stack.stroke[color_stack.next]; + current_fill = color_stack.fill[color_stack.next]; + } +} + void pdf_dev_reset_color (void) { @@ -369,10 +383,6 @@ pdf_dev_reset_color (void) strokecolor = default_color; fillcolor = default_color; } -#if 0 - pdf_color_graycolor(¤t_stroke, 0.0); - pdf_color_graycolor(¤t_fill, 0.0); -#endif pdf_dev_setcolor(&strokecolor, 0); pdf_dev_setcolor(&fillcolor, 1); @@ -403,7 +413,7 @@ pdf_color_push (void) memcpy(&color_stack.fill[current], ¤t_fill , sizeof(pdf_color)); - color_stack.next += 1; + color_stack.next++; return; } diff --git a/Build/source/texk/dvipdfmx/src/pdfcolor.h b/Build/source/texk/dvipdfmx/src/pdfcolor.h index 00c421f9349..48e930be1a3 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.6 2005/07/30 11:44:18 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfcolor.h,v 1.7 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -93,6 +93,7 @@ extern void pdf_color_pop (void); extern void pdf_color_clear (void); /* Reinstall color */ +extern void pdf_dev_preserve_color(void); extern void pdf_dev_reset_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 5654e22b523..650fac5d051 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.60 2005/08/12 18:22:24 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.c,v 1.61 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -1186,22 +1186,6 @@ pdf_close_device (void) * BOP and EOP manipulate some of the same data structures * as the font stuff. */ - - -/* - * The following routine is here for forms. Since a form is - * self-contained, it will need its own Tf command at the - * beginningg even if it is continuing to set type in the - * current font. This routine simply forces reinstantiation - * of the current font. - */ -void -pdf_dev_reset (void) -{ - pdf_dev_reset_fonts(); - pdf_dev_reset_color(); -} - void pdf_dev_reset_fonts (void) { @@ -1247,7 +1231,9 @@ pdf_dev_bop (const pdf_tmatrix *M) pdf_dev_gsave(); pdf_dev_concat(M); - pdf_dev_reset(); + pdf_dev_reset_fonts(); + pdf_dev_preserve_color(); /* preserve the last color in the previous page */ + pdf_dev_reset_color(); } void diff --git a/Build/source/texk/dvipdfmx/src/pdfdev.h b/Build/source/texk/dvipdfmx/src/pdfdev.h index dbc28cf36fb..f29481266b5 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.18 2005/08/12 18:22:24 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.h,v 1.19 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -202,8 +202,7 @@ extern void pdf_dev_set_param (int param_type, int value); * 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_reset (void); /* Does both font and color */ +extern void pdf_dev_reset_color (void); /* defined in pdfcolor.c */ /* 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 aa4bb6abab9..c8ad7e69b71 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.41 2005/08/31 08:01:05 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.c,v 1.43 2005/09/06 04:17:15 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -492,20 +492,13 @@ asn_date (char *date_string) { time_t current_time; struct tm *bd_time; -#ifndef HAVE_TIMEZONE - #ifdef TM_GM_TOFF - #define timezone (bdtime->gm_toff) - #else - #define timezone 0l - #endif /* TM_GM_TOFF */ -#endif /* HAVE_TIMEZONE */ time(¤t_time); bd_time = localtime(¤t_time); sprintf(date_string, "D:%04d%02d%02d%02d%02d%02d%+03ld'%02ld'", bd_time->tm_year + 1900, bd_time->tm_mon + 1, bd_time->tm_mday, bd_time->tm_hour, bd_time->tm_min, bd_time->tm_sec, - -timezone/3600, timezone % 3600); + -(bd_time->tm_gmtoff / 3600), (bd_time->tm_gmtoff % 3600) / 60); return strlen(date_string); } @@ -1991,19 +1984,13 @@ pdf_doc_add_page_content (const char *buffer, unsigned length) { pdf_doc *p = &pdoc; pdf_page *currentpage; - pdf_obj *contents; - char *pending_tbuf; - int tbuf_len; - - currentpage = LASTPAGE(p); - contents = (p->pending_forms ? - p->pending_forms->form.contents : currentpage->contents); - tbuf_len = pdf_dev_flushtmatrix(&pending_tbuf); - if (tbuf_len > 0) { - pdf_add_stream(contents, pending_tbuf, tbuf_len); + if (p->pending_forms) { + pdf_add_stream(p->pending_forms->form.contents, buffer, length); + } else { + currentpage = LASTPAGE(p); + pdf_add_stream(currentpage->contents, buffer, length); } - pdf_add_stream(contents, buffer, length); return; } @@ -2215,9 +2202,6 @@ pdf_doc_begin_grabbing (const char *ident, PDF_XOBJECT_TYPE_FORM, &info, pdf_ref_obj(form->contents)); - /* Must call pdf_dev_flushtmatrix(). */ - pdf_doc_add_page_content(NULL, 0); - p->pending_forms = fnode; /* @@ -2246,9 +2230,6 @@ pdf_doc_end_grabbing (void) fnode = p->pending_forms; form = &fnode->form; - /* Must call pdf_dev_flushtmatrix(). */ - pdf_doc_add_page_content(NULL, 0); - pdf_dev_grestore_to(fnode->q_depth); /* diff --git a/Build/source/texk/dvipdfmx/src/pdfdraw.c b/Build/source/texk/dvipdfmx/src/pdfdraw.c index a1797d6d461..444d177d9b0 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.11 2005/08/31 08:01:05 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.c,v 1.13 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -1148,44 +1148,6 @@ pdf_dev_currentcolor (pdf_color *color, int is_fill) } #endif /* 0 */ -/* Implementation of the optimization of adjacent transform - * matrices, for example, "1 0 0 1 a b cm 1 0 0 1 c d cm" results - * "1 0 0 1 a+c b+d cm". - * - * The static variable ptM holds the information of pending - * transform matrices, and it will be flushed before any non - * transform command appears. - */ -static pdf_tmatrix *ptM = NULL; -static char tmatrix_buf[1024]; /* FIXME: To avoid confliction with fmt_buf. */ - -/* pdf_dev_flushtmatrix() is called from pdf_doc_add_page_content() - * in pdfdoc.c - */ -int -pdf_dev_flushtmatrix (char **buf) -{ - int len = 0; - - if (ptM) { - *buf = tmatrix_buf; - (*buf)[len++] = ' '; - len += pdf_sprint_matrix((*buf) + len, ptM); - /* Do not flush "1 0 0 1 0 0 cm". Sting check is faster than - * checking six double variables. */ - if (!strncmp((*buf) + 1, "1 0 0 1 0 0", 11)) { - return 0; - } - (*buf)[len++] = ' '; - (*buf)[len++] = 'c'; - (*buf)[len++] = 'm'; - RELEASE(ptM); - ptM = NULL; - } - - return len; -} - int pdf_dev_concat (const pdf_tmatrix *M) { @@ -1195,6 +1157,8 @@ pdf_dev_concat (const pdf_tmatrix *M) pdf_coord *cpt = &gs->cp; pdf_tmatrix *CTM = &gs->matrix; pdf_tmatrix W; + char *buf = FORMAT_BUFF_PTR(NULL); + int len = 0; ASSERT(M); @@ -1208,12 +1172,12 @@ pdf_dev_concat (const pdf_tmatrix *M) return -1; } - if (ptM) { - pdf_concatmatrix(ptM, M); - } else { - ptM = NEW(1, pdf_tmatrix); - pdf_copymatrix(ptM, M); - } + buf[len++] = ' '; + len += pdf_sprint_matrix(buf + len, M); + buf[len++] = ' '; + buf[len++] = 'c'; + buf[len++] = 'm'; + pdf_doc_add_page_content(buf, len); pdf_concatmatrix(CTM, M); @@ -1310,11 +1274,8 @@ pdf_dev_grestore_to (int depth) pdf_dev__clean_gstate(gs); RELEASE(gs); } -#if 0 pdf_dev_reset_fonts(); -#else - pdf_dev_reset(); -#endif + pdf_dev_reset_color(); return; } @@ -1341,11 +1302,8 @@ pdf_dev_grestore (void) pdf_doc_add_page_content(" Q", 2); -#if 0 pdf_dev_reset_fonts(); -#else - pdf_dev_reset(); -#endif + pdf_dev_reset_color(); pdf_dev_setcolor(&sc, 0); pdf_dev_setcolor(&fc, 1); @@ -1353,62 +1311,6 @@ pdf_dev_grestore (void) return 0; } -#if 0 -void -pdf_dev_reset_color (void) -{ - m_stack *gss = &_gsstck; - pdf_gstate *gs = m_stack_top(gss); - pdf_color fill, stroke; - - pdf_color_copycolor(&fill, &gs->fillcolor); - pdf_color_copycolor(&stroke, &gs->strokecolor); - - /* Clear current color: */ - pdf_color_graycolor(&gs->fillcolor, 0.0); - pdf_color_graycolor(&gs->strokecolor, 0.0); - - pdf_dev_setcolor(&stroke, 0); - pdf_dev_setcolor(&fill, 1); - - return; -} - -int -pdf_dev_setcolor (const pdf_color *color, int is_fill) -{ - m_stack *gss = &_gsstck; - pdf_gstate *gs = m_stack_top(gss); - pdf_color *fcl = &gs->fillcolor; - pdf_color *scl = &gs->strokecolor; - int colormode; - pdf_color *curcol; - - if (!color) { - WARN("No color specified."); - return -1; - } - - colormode = pdf_dev_get_param(PDF_DEV_PARAM_COLORMODE); - if (!colormode) { - WARN("setcolor ignored. (Ignore color option set)"); - return 0; - } - - curcol = is_fill ? fcl : scl; - if (!pdf_color_compare_color(color, curcol)) { - return 0; - } - - graphics_mode(); - pdf_color_print_color(color, is_fill); - - pdf_color_copycolor(curcol, color); - - return 0; -} -#endif - /* * num w LW linewidth (g.t. 0) * int J LC linecap diff --git a/Build/source/texk/dvipdfmx/src/pdfdraw.h b/Build/source/texk/dvipdfmx/src/pdfdraw.h index ff5046e650d..1c90851dd75 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.9 2005/08/30 07:56:08 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.h,v 1.11 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -153,9 +153,7 @@ 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 void pdf_dev_reset_color (void); extern int pdf_dev_currentcolor (pdf_color *color, int is_fill); extern int pdf_dev_setcolor (const pdf_color *color, int is_fill); -extern int pdf_dev_flushtmatrix (char **pending_tbuf); #endif /* _PDF_DRAW_H_ */ diff --git a/Build/source/texk/dvipdfmx/src/pdfobj.c b/Build/source/texk/dvipdfmx/src/pdfobj.c index 860033761f0..39445ba875a 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.39 2005/08/30 07:53:37 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfobj.c,v 1.40 2006/12/06 13:14:54 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -2203,6 +2203,7 @@ extend_xref (long new_size) xref_table[i].direct = NULL; xref_table[i].indirect = NULL; xref_table[i].used = 0; + xref_table[i].generation = 0; xref_table[i].file_position = 0L; } num_input_objects = new_size; diff --git a/Build/source/texk/dvipdfmx/src/spc_pdfm.c b/Build/source/texk/dvipdfmx/src/spc_pdfm.c index 5fae8c02d5d..8681af2586b 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.23 2005/08/24 01:25:51 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.24 2006/12/11 12:46:03 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -754,7 +754,8 @@ spc_handler_pdfm_etrans (struct spc_env *spe, struct spc_arg *args) * we make no assumptions about what fonts. We act like we are * starting a new page. */ - pdf_dev_reset(); + pdf_dev_reset_fonts(); + pdf_dev_reset_color(); return 0; } diff --git a/Build/source/texk/dvipdfmx/src/spc_tpic.c b/Build/source/texk/dvipdfmx/src/spc_tpic.c index 3d330ca4f99..71a41ce159b 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.2 2005/07/30 11:44:18 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_tpic.c,v 1.3 2005/10/14 04:55:00 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -743,7 +743,7 @@ spc_handler_tpic_wh (struct spc_env *spe, ASSERT(spe && ap && tp); tp->fill_shape = 1; - tp->fill_color = 1.0; + tp->fill_color = 0.0; return 0; } @@ -757,7 +757,7 @@ spc_handler_tpic_bk (struct spc_env *spe, ASSERT(spe && ap && tp); tp->fill_shape = 1; - tp->fill_color = 0.0; + tp->fill_color = 1.0; return 0; } diff --git a/Build/source/texk/dvipdfmx/src/t1_load.c b/Build/source/texk/dvipdfmx/src/t1_load.c index c994f5cddc9..6395278e57a 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.9 2005/07/17 09:53:38 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/t1_load.c,v 1.10 2006/12/06 12:52:43 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -641,19 +641,34 @@ parse_charstrings (cff_font *font, char *glyph_name; long len, gid, j; - glyph_name = get_next_key(start, end); - if (!glyph_name) { - return -1; - } else if (!strcmp(glyph_name, ".notdef")) { - gid = 0; - have_notdef = 1; - } else if (have_notdef) { - gid = i; - } else if (i == count - 1) { - WARN("No .notdef glyph???"); - return -1; + /* BUG-20061126 (by ChoF): + * Some fonts (e.g., belleek/blsy.pfb) does not have the correct number + * of glyphs. Modify the codes even to work with these broken fonts. + */ + tok = pst_get_token(start, end); + glyph_name = (char *)pst_getSV(tok); + + if (PST_NAMETYPE(tok)) { + RELEASE_TOK(tok); + if (!glyph_name) { + return -1; + } else if (!strcmp(glyph_name, ".notdef")) { + gid = 0; + have_notdef = 1; + } else if (have_notdef) { + gid = i; + } else if (i == count - 1) { + WARN("No .notdef glyph???"); + return -1; + } else { + gid = i+1; + } + } else if (PST_UNKNOWNTYPE(tok) && !strcmp(glyph_name, "end")) { + RELEASE_TOK(tok); + break; } else { - gid = i+1; + RELEASE_TOK(tok); + return -1; } if (gid > 0) @@ -731,6 +746,13 @@ parse_charstrings (cff_font *font, } } *start += len; + + tok = pst_get_token(start, end); + if (!MATCH_OP(tok, "ND") && !MATCH_OP(tok, "|-")) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); } if (mode != 1) charstrings->offset[count] = offset + 1; diff --git a/Build/source/texk/dvipdfmx/src/truetype.c b/Build/source/texk/dvipdfmx/src/truetype.c index 3cc92fa721d..76b7ba3666a 100644 --- a/Build/source/texk/dvipdfmx/src/truetype.c +++ b/Build/source/texk/dvipdfmx/src/truetype.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/truetype.c,v 1.4 2005/08/30 07:52:33 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/truetype.c,v 1.5 2005/12/29 04:07:04 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -58,9 +58,6 @@ # undef ENABLE_NOEMBED #endif -#define dpx_open_file(n,d,f) DPXFOPEN((n), DPX_RES_TYPE_TTFONT) -#define dpx_fclose(fp) MFCLOSE(fp) - int pdf_font_open_truetype (pdf_font *font) { @@ -78,14 +75,14 @@ pdf_font_open_truetype (pdf_font *font) ASSERT( ident ); - fp = dpx_open_file(ident, "fonts", "truetype"); + fp = DPXFOPEN(ident, DPX_RES_TYPE_TTFONT); if (!fp) return -1; sfont = sfnt_open(fp); if (!sfont) { WARN("Could not open TrueType font: %s", ident); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; } @@ -95,7 +92,7 @@ pdf_font_open_truetype (pdf_font *font) error = sfnt_read_table_directory(sfont, 0); if (error) { sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; /* Silently */ } @@ -117,7 +114,7 @@ pdf_font_open_truetype (pdf_font *font) if (!tmp) { ERROR("Could not obtain neccesary font info."); sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; } ASSERT(pdf_obj_typeof(tmp) == PDF_DICT); @@ -180,7 +177,7 @@ pdf_font_open_truetype (pdf_font *font) } sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); pdf_add_dict(fontdict, pdf_new_name("Type"), pdf_new_name("Font")); @@ -891,20 +888,20 @@ pdf_font_load_truetype (pdf_font *font) /* encoding_id < 0 means MacRoman here (but not really) */ } - fp = dpx_open_file(ident, "fonts", "truetype"); + fp = DPXFOPEN(ident, DPX_RES_TYPE_TTFONT); if (!fp) ERROR("Unable to open TrueType font file: %s", ident); /* Should find *truetype* here */ sfont = sfnt_open(fp); if (!sfont) { ERROR("Unable to open TrueType file: %s", ident); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; } else if (sfont->type != SFNT_TYPE_TRUETYPE && sfont->type != SFNT_TYPE_TTC) { ERROR("Font \"%s\" not a TrueType font?", ident); sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; } @@ -916,7 +913,7 @@ pdf_font_load_truetype (pdf_font *font) if (error) { ERROR("Reading SFND table dir failed for font-file=\"%s\"... Not a TrueType font?", ident); sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; } @@ -932,14 +929,14 @@ pdf_font_load_truetype (pdf_font *font) if (error) { ERROR("Error occured while creating font subfont for \"%s\"", ident); sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; } #if ENABLE_NOEMBED if (!embedding) { sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); return 0; } #endif /* ENABLE_NOEMBED */ @@ -955,7 +952,7 @@ pdf_font_load_truetype (pdf_font *font) ERROR("Required TrueType table \"%s\" does not exist in font: %s", required_table[i].name, ident); sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); return -1; } } @@ -968,7 +965,7 @@ pdf_font_load_truetype (pdf_font *font) ERROR("Could not created FontFile stream for \"%s\".", ident); sfnt_close(sfont); - dpx_fclose(fp); + DPXFCLOSE(fp); if (verbose > 1) MESG("[%ld bytes]", pdf_stream_length(fontfile)); -- cgit v1.2.3