diff options
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/cff.c | 7 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/cidtype0.c | 4 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/cidtype2.c | 11 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/dvi.c | 20 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/dvi.h | 8 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/dvipdfmx.c | 20 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/fontmap.c | 12 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/mem.h | 1 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/pdflimits.h | 9 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/pdfobj.c | 4 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/spc_pdfm.c | 9 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/t1_load.c | 4 |
12 files changed, 87 insertions, 22 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/cff.c b/Build/source/texk/xdvipdfmx/src/cff.c index 8e6e16a400e..dcc5bb71726 100644 --- a/Build/source/texk/xdvipdfmx/src/cff.c +++ b/Build/source/texk/xdvipdfmx/src/cff.c @@ -183,6 +183,10 @@ cff_font *cff_open(sfnt *sfont, long offset, int n) cff_seek_set(cff, cff->gsubr_offset); /* seek back to GSubr */ +#ifdef XETEX + cff->ft_to_gid = NULL; +#endif + return cff; } @@ -221,6 +225,9 @@ cff_close (cff_font *cff) } if (cff->_string) cff_release_index(cff->_string); +#ifdef XETEX + if (cff->ft_to_gid) RELEASE(cff->ft_to_gid); +#endif RELEASE(cff); } diff --git a/Build/source/texk/xdvipdfmx/src/cidtype0.c b/Build/source/texk/xdvipdfmx/src/cidtype0.c index 197aa6a6a5c..3f5cd1a90d2 100644 --- a/Build/source/texk/xdvipdfmx/src/cidtype0.c +++ b/Build/source/texk/xdvipdfmx/src/cidtype0.c @@ -1537,6 +1537,7 @@ CIDFont_type0_t1open (CIDFont *font, const char *name, #ifdef XETEX font->ft_to_gid = cff_get_ft_to_gid(cffont); + cffont->ft_to_gid = NULL; #endif cff_close(cffont); @@ -2065,5 +2066,8 @@ CIDFont_type0_t1dofont (CIDFont *font) void CIDFont_type0_release(CIDFont *font) { +#ifdef XETEX + if (font->ft_to_gid) RELEASE(font->ft_to_gid); +#endif return; } diff --git a/Build/source/texk/xdvipdfmx/src/cidtype2.c b/Build/source/texk/xdvipdfmx/src/cidtype2.c index d7606181c6a..7d3df254c59 100644 --- a/Build/source/texk/xdvipdfmx/src/cidtype2.c +++ b/Build/source/texk/xdvipdfmx/src/cidtype2.c @@ -469,8 +469,15 @@ cid_to_code (CMap *cmap, CID cid) return (long) outbuf[0]; else if (outbytesleft == 30) return (long) (outbuf[0] << 8|outbuf[1]); - else if (outbytesleft == 28) - return (long) (outbuf[0] << 24|outbuf[1] << 16|outbuf[2] << 8|outbuf[3]); + else if (outbytesleft == 28) { /* We assume the output encoding is UTF-16. */ + CID hi, lo; + hi = outbuf[0] << 8|outbuf[1]; + lo = outbuf[2] << 8|outbuf[3]; + if (hi >= 0xd800 && hi <= 0xdbff && lo >= 0xdc00 && lo <= 0xdfff) + return (long) ((hi - 0xd800) * 0x400 + 0x10000 + lo - 0xdc00); + else + return (long) (hi << 16|lo); + } return 0; } diff --git a/Build/source/texk/xdvipdfmx/src/dvi.c b/Build/source/texk/xdvipdfmx/src/dvi.c index c1174b17730..a0ab254d4f5 100644 --- a/Build/source/texk/xdvipdfmx/src/dvi.c +++ b/Build/source/texk/xdvipdfmx/src/dvi.c @@ -2490,7 +2490,7 @@ read_length (double *vp, double mag, const char **pp, const char *endptr) static int -scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, const char *buf, UNSIGNED_QUAD size) +scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, unsigned *minorversion, const char *buf, UNSIGNED_QUAD size) { char *q; const char *p = buf, *endptr; @@ -2588,6 +2588,15 @@ scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, const ch paper_width = *wd; paper_height = *ht; } + } else if (minorversion && ns_pdf && !strcmp(q, "minorversion")) { + char *kv; + if (*p == '=') p++; + skip_white(&p, endptr); + kv = parse_float_decimal(&p, endptr); + if (kv) { + *minorversion = (unsigned)strtol(kv, NULL, 10); + RELEASE(kv); + } } RELEASE(q); } @@ -2597,9 +2606,10 @@ scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, const ch void -dvi_scan_paper_size (long page_no, - double *page_width, double *page_height, - double *x_offset, double *y_offset, char *landscape) +dvi_scan_specials (long page_no, + double *page_width, double *page_height, + double *x_offset, double *y_offset, char *landscape, + unsigned *minorversion) { FILE *fp = dvi_file; long offset; @@ -2639,7 +2649,7 @@ dvi_scan_paper_size (long page_no, } if (fread(dvi_page_buffer + dvi_page_buf_index, sizeof(char), size, fp) != size) ERROR("Reading DVI file failed!"); - scan_special(page_width, page_height, x_offset, y_offset, landscape, + scan_special(page_width, page_height, x_offset, y_offset, landscape, minorversion, (char*)dvi_page_buffer + dvi_page_buf_index, size); dvi_page_buf_index += size; continue; diff --git a/Build/source/texk/xdvipdfmx/src/dvi.h b/Build/source/texk/xdvipdfmx/src/dvi.h index 60f9ad7c8f5..d4a87a2a79b 100644 --- a/Build/source/texk/xdvipdfmx/src/dvi.h +++ b/Build/source/texk/xdvipdfmx/src/dvi.h @@ -70,10 +70,10 @@ extern void dvi_dir (UNSIGNED_BYTE dir); extern void dvi_do_page (long page_no, double paper_width, double paper_height, double x_offset, double y_offset); -extern void dvi_scan_paper_size (long page_no, - double *width, double *height, - double *x_offset, double *y_offset, - char *landscape); +extern void dvi_scan_specials (long page_no, + double *width, double *height, + double *x_offset, double *y_offset, + char *landscape, unsigned *minorversion); extern int dvi_locate_font (const char *name, spt_t ptsize); /* link or nolink: diff --git a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c index ed1f0535744..5e7e8c8abaf 100644 --- a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c +++ b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c @@ -45,6 +45,7 @@ #include "dvi.h" +#include "pdflimits.h" #include "pdfdoc.h" #include "pdfdev.h" #include "pdfparse.h" @@ -469,9 +470,14 @@ do_args (int argc, char *argv[]) ver_minor = atoi(argv[1]); POP_ARG(); } - if (ver_minor < 3 || ver_minor > 6) { - WARN("PDF version 1.%d not supported. (1.4 used instead)", ver_minor); - ver_minor = 4; + if (ver_minor < PDF_VERSION_MIN) { + WARN("PDF version 1.%d not supported. Using PDF 1.%d instead.", + ver_minor, PDF_VERSION_MIN); + ver_minor = PDF_VERSION_MIN; + } else if (ver_minor > PDF_VERSION_MAX) { + WARN("PDF version 1.%d not supported. Using PDF 1.%d instead.", + ver_minor, PDF_VERSION_MAX); + ver_minor = PDF_VERSION_MAX; } pdf_set_version((unsigned) ver_minor); } @@ -702,7 +708,7 @@ do_dvi_pages (void) page_width = paper_width; page_height = paper_height; w = page_width; h = page_height; lm = landscape_mode; xo = x_offset; yo = y_offset; - dvi_scan_paper_size(page_no, &w, &h, &xo, &yo, &lm); + dvi_scan_specials(page_no, &w, &h, &xo, &yo, &lm, NULL); if (lm != landscape_mode) { SWAP(w, h); landscape_mode = lm; @@ -863,6 +869,7 @@ main (int argc, char *argv[]) y_offset = 0.0; dvi2pts = 0.01; /* dvi2pts controls accuracy. */ } else { + unsigned ver_minor = 0; /* Dependency between DVI and PDF side is rather complicated... */ dvi2pts = dvi_init(dvi_filename, mag); if (dvi2pts == 0.0) @@ -870,7 +877,10 @@ main (int argc, char *argv[]) pdf_doc_set_creator(dvi_comment()); - dvi_scan_paper_size(0, &paper_width, &paper_height, &x_offset, &y_offset, &landscape_mode); + dvi_scan_specials(0, &paper_width, &paper_height, &x_offset, &y_offset, &landscape_mode, &ver_minor); + if (ver_minor >= PDF_VERSION_MIN && ver_minor <= PDF_VERSION_MAX) { + pdf_set_version(ver_minor); + } if (landscape_mode) { SWAP(paper_width, paper_height); } diff --git a/Build/source/texk/xdvipdfmx/src/fontmap.c b/Build/source/texk/xdvipdfmx/src/fontmap.c index 949bd1adb23..e8766f53518 100644 --- a/Build/source/texk/xdvipdfmx/src/fontmap.c +++ b/Build/source/texk/xdvipdfmx/src/fontmap.c @@ -119,6 +119,10 @@ pdf_clear_fontmap_record (fontmap_rec *mrec) RELEASE(mrec->opt.otl_tags); if (mrec->opt.charcoll) RELEASE(mrec->opt.charcoll); +#ifdef XETEX + if (mrec->opt.glyph_widths) + RELEASE(mrec->opt.glyph_widths); +#endif pdf_init_fontmap_record(mrec); } @@ -1071,7 +1075,7 @@ pdf_insert_native_fontmap_record (const char *name, const char *path, int index, mrec = NEW(1, fontmap_rec); pdf_init_fontmap_record(mrec); - mrec->map_name = mstrdup(fontmap_key); + mrec->map_name = fontmap_key; mrec->enc_name = mstrdup(layout_dir == 0 ? "Identity-H" : "Identity-V"); mrec->font_name = (path != NULL) ? mstrdup(path) : NULL; mrec->opt.index = index; @@ -1138,10 +1142,10 @@ pdf_load_native_font_from_path(const char *ps_name, int layout_dir, int extend, } if (error == 0) - return pdf_insert_native_fontmap_record(ps_name, filename, index, face, + error = pdf_insert_native_fontmap_record(ps_name, filename, index, face, layout_dir, extend, slant, embolden); - else - return error; + RELEASE(filename); + return error; } FT_Int ft_major; /* global so that dvi.c can check the version */ diff --git a/Build/source/texk/xdvipdfmx/src/mem.h b/Build/source/texk/xdvipdfmx/src/mem.h index 6380e9e9125..b49f2214147 100644 --- a/Build/source/texk/xdvipdfmx/src/mem.h +++ b/Build/source/texk/xdvipdfmx/src/mem.h @@ -63,4 +63,5 @@ extern void *mem_remove (void *ptr); #define kpse_find_file(x,y,z) (char *) MEM_ADD(kpse_find_file(x,y,z)) #define kpse_find_glyph(x,y,z,w) (char *) MEM_ADD(kpse_find_glyph(x,y,z,w)) +#define strdup(s1) (char *) MEM_ADD(strdup(s1)) #endif /* _MEM_H_ */ diff --git a/Build/source/texk/xdvipdfmx/src/pdflimits.h b/Build/source/texk/xdvipdfmx/src/pdflimits.h index 6cc162857f6..43590df6433 100644 --- a/Build/source/texk/xdvipdfmx/src/pdflimits.h +++ b/Build/source/texk/xdvipdfmx/src/pdflimits.h @@ -26,6 +26,15 @@ #define _PDFLIMITS_H_ /* + * * The minimal and maximal PDF version supported by DVIPDFMx. + * * NOTE: Don't forget to update CIDFont_stdcc_def[] in cid.c + * * if you increase PDF_VERSION_MAX! + * */ +#define PDF_VERSION_MIN 3 +#define PDF_VERSION_MAX 7 +#define PDF_VERSION_DEFAULT 4 + +/* * PDF_NAME_LEN_MAX: see, Appendix C of PDF Ref. v1.3, 2nd. ed. * This is Acrobat implementation limit. */ diff --git a/Build/source/texk/xdvipdfmx/src/pdfobj.c b/Build/source/texk/xdvipdfmx/src/pdfobj.c index 8119c64dab2..efde7bd3005 100644 --- a/Build/source/texk/xdvipdfmx/src/pdfobj.c +++ b/Build/source/texk/xdvipdfmx/src/pdfobj.c @@ -240,13 +240,13 @@ pdf_set_compression (int level) return; } -static unsigned pdf_version = 4; +static unsigned pdf_version = PDF_VERSION_DEFAULT; void pdf_set_version (unsigned version) { /* Don't forget to update CIDFont_stdcc_def[] in cid.c too! */ - if (version >= 3 && version <= 6) { + if (version >= PDF_VERSION_MIN && version <= PDF_VERSION_MAX) { pdf_version = version; } } diff --git a/Build/source/texk/xdvipdfmx/src/spc_pdfm.c b/Build/source/texk/xdvipdfmx/src/spc_pdfm.c index e623c92cbc4..fd337d8cf0c 100644 --- a/Build/source/texk/xdvipdfmx/src/spc_pdfm.c +++ b/Build/source/texk/xdvipdfmx/src/spc_pdfm.c @@ -1450,6 +1450,13 @@ spc_handler_pdfm_code (struct spc_env *spe, struct spc_arg *args) return 0; } +static int +spc_handler_pdfm_do_nothing (struct spc_env *spe, struct spc_arg *args) +{ + args->curptr = args->endptr; + return 0; +} + #define STRING_STREAM 0 #define FILE_STREAM 1 @@ -2045,6 +2052,8 @@ static struct spc_handler pdfm_handlers[] = { {"bcontent", spc_handler_pdfm_bcontent}, {"econtent", spc_handler_pdfm_econtent}, {"code", spc_handler_pdfm_code}, + + {"minorversion", spc_handler_pdfm_do_nothing}, }; int diff --git a/Build/source/texk/xdvipdfmx/src/t1_load.c b/Build/source/texk/xdvipdfmx/src/t1_load.c index b6664ec2961..08928767cbd 100644 --- a/Build/source/texk/xdvipdfmx/src/t1_load.c +++ b/Build/source/texk/xdvipdfmx/src/t1_load.c @@ -1162,6 +1162,10 @@ init_cff_font (cff_font *cff) cff->num_glyphs = 0; cff->num_fds = 1; cff->_string = cff_new_index(0); + +#ifdef XETEX + cff->ft_to_gid = NULL; +#endif } cff_font * |