diff options
17 files changed, 561 insertions, 72 deletions
diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420-PATCHES/ChangeLog b/Build/source/texk/dvipdfmx/dvipdfmx-20120420-PATCHES/ChangeLog index bcac474b580..c6cab2ea57b 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20120420-PATCHES/ChangeLog +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420-PATCHES/ChangeLog @@ -1,3 +1,10 @@ +2012-04-27 Peter Breitenlohner <peb@mppmu.mpg.de> + + * patch-03-trivial (new): Reduce differences between dvipdfmx + and xdvipdfmx: + * cid.c, cidtype[02].c, truetype.c, tt_cmap.c, type1c.c: + Trivial modifications. + 2012-04-25 Peter Breitenlohner <peb@mppmu.mpg.de> * patch-02-MEM_DEBUG (new): Try to avoid mem_debug_check warning. diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420-PATCHES/patch-03-trivial b/Build/source/texk/dvipdfmx/dvipdfmx-20120420-PATCHES/patch-03-trivial new file mode 100644 index 00000000000..b6f6ea7bd08 --- /dev/null +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420-PATCHES/patch-03-trivial @@ -0,0 +1,437 @@ +diff -ur dvipdfmx-20120420.orig/src/cid.c dvipdfmx-20120420/src/cid.c +--- dvipdfmx-20120420.orig/src/cid.c 2011-03-07 18:11:26.000000000 +0100 ++++ dvipdfmx-20120420/src/cid.c 2012-04-27 13:35:25.000000000 +0200 +@@ -70,7 +70,7 @@ + {"Adobe", "Japan1", {-1, -1, 2, 2, 4, 5, 6, 6}}, + {"Adobe", "Korea1", {-1, -1, 1, 1, 2, 2, 2, 2}}, + {"Adobe", "Identity", {-1, -1, 0, 0, 0, 0, 0, 0}}, +- {NULL, NULL, {0,0,0,0,0,0,0,0}} ++ {NULL, NULL, { 0, 0, 0, 0, 0, 0, 0, 0}} + }; + #define UCS_CC 0 + #define ACC_START 1 +diff -ur dvipdfmx-20120420.orig/src/cidtype0.c dvipdfmx-20120420/src/cidtype0.c +--- dvipdfmx-20120420.orig/src/cidtype0.c 2011-03-07 18:11:26.000000000 +0100 ++++ dvipdfmx-20120420/src/cidtype0.c 2012-04-27 13:33:11.000000000 +0200 +@@ -467,7 +467,7 @@ + { + sfnt *sfont; + cff_font *cffont; +- FILE *fp; ++ FILE *fp = NULL; + cff_index *charstrings, *idx; + cff_charsets *charset = NULL; + cff_fdselect *fdselect = NULL; +@@ -571,7 +571,8 @@ + RELEASE(CIDToGIDMap); + cff_close(cffont); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + return; + } +@@ -689,7 +690,8 @@ + + cff_close(cffont); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + if (verbose > 1) + MESG("[%u/%u glyphs][%ld bytes]", num_glyphs, cs_count, destlen); +@@ -719,7 +721,7 @@ + char *fontname; + sfnt *sfont; + cff_font *cffont; +- FILE *fp; ++ FILE *fp = NULL; + unsigned long offset = 0; + + ASSERT(font); +@@ -746,7 +748,8 @@ + if (!(cffont->flag & FONTTYPE_CIDFONT)) { + cff_close(cffont); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + +@@ -819,7 +822,7 @@ + /* getting font info. from TrueType tables */ + if ((font->descriptor + = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0)) == NULL) +- ERROR("Could not obtain neccesary font info."); ++ ERROR("Could not obtain necessary font info."); + + if (opt->embed) { + memmove(fontname + 7, fontname, strlen(fontname) + 1); +@@ -851,7 +854,8 @@ + pdf_new_number(1000)); /* not sure */ + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + return 0; + } +@@ -871,7 +875,7 @@ + int parent_id; + char *used_chars; + double default_width, nominal_width; +- FILE *fp; ++ FILE *fp = NULL; + + ASSERT(font); + +@@ -1102,7 +1106,8 @@ + } + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + if (verbose > 1) + MESG("[%u glyphs][%ld bytes]", num_glyphs, destlen); +@@ -1133,7 +1138,7 @@ + sfnt *sfont; + cff_font *cffont; + unsigned long offset = 0; +- FILE *fp; ++ FILE *fp = NULL; + + ASSERT(font); + +@@ -1159,7 +1164,8 @@ + if (cffont->flag & FONTTYPE_CIDFONT) { + cff_close(cffont); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + return -1; + } +@@ -1218,7 +1224,7 @@ + /* getting font info. from TrueType tables */ + if ((font->descriptor + = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0)) == NULL) +- ERROR("Could not obtain neccesary font info."); ++ ERROR("Could not obtain necessary font info."); + + if (opt->embed) { + memmove(fontname + 7, fontname, strlen(fontname) + 1); +@@ -1246,7 +1252,8 @@ + pdf_add_dict(font->fontdict, pdf_new_name("CIDSystemInfo"), csi_dict); + } + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + return 0; + } +@@ -1372,11 +1379,9 @@ + return -1; + + cffont = t1_load_font(NULL, 1, fp); +- if (!cffont) { +- DPXFCLOSE(fp); +- return -1; +- } + DPXFCLOSE(fp); ++ if (!cffont) ++ return -1; + + cmap_id = load_base_CMap(font_name, wmode, cffont); + +diff -ur dvipdfmx-20120420.orig/src/cidtype2.c dvipdfmx-20120420/src/cidtype2.c +--- dvipdfmx-20120420.orig/src/cidtype2.c 2011-03-07 18:11:26.000000000 +0100 ++++ dvipdfmx-20120420/src/cidtype2.c 2012-04-27 13:42:54.000000000 +0200 +@@ -498,7 +498,7 @@ + unsigned char *cidtogidmap; + USHORT num_glyphs; + int i, glyph_ordering = 0, unicode_cmap = 0; +- FILE *fp; ++ FILE *fp = NULL; + + if (!font->indirect) + return; +@@ -853,7 +853,8 @@ + if (cidtogidmap) + RELEASE(cidtogidmap); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + return; + } +@@ -873,7 +874,8 @@ + fontfile = sfnt_create_FontFile_stream(sfont); + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + if (!fontfile) + ERROR("Could not created FontFile stream for \"%s\".", font->ident); +@@ -926,7 +928,7 @@ + char *fontname; + sfnt *sfont; + unsigned long offset = 0; +- FILE *fp; ++ FILE *fp = NULL; + + ASSERT(font && opt); + +@@ -960,7 +962,8 @@ + break; + default: + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + break; + } +@@ -1059,7 +1062,7 @@ + + font->descriptor = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0); + if (!font->descriptor) { +- ERROR("Could not obtain neccesary font info."); ++ ERROR("Could not obtain necessary font info."); + } + + if (opt->embed) { +@@ -1076,7 +1079,8 @@ + pdf_new_name(fontname)); + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + /* + * Don't write fontdict here. +diff -ur dvipdfmx-20120420.orig/src/truetype.c dvipdfmx-20120420/src/truetype.c +--- dvipdfmx-20120420.orig/src/truetype.c 2011-03-07 18:11:26.000000000 +0100 ++++ dvipdfmx-20120420/src/truetype.c 2012-04-27 14:28:16.000000000 +0200 +@@ -68,7 +68,7 @@ + pdf_obj *fontdict, *descriptor; + sfnt *sfont; + int embedding = 1; /* Must be embedded. */ +- FILE *fp; ++ FILE *fp = NULL; + int length, error = 0; + + ASSERT( font ); +@@ -89,7 +89,8 @@ + + if (!sfont) { + WARN("Could not open TrueType font: %s", ident); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + +@@ -104,7 +105,8 @@ + + if (error) { + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; /* Silently */ + } + +@@ -124,9 +126,10 @@ + pdf_obj *tmp; + tmp = tt_get_fontdesc(sfont, &embedding, -1, 1); + if (!tmp) { +- ERROR("Could not obtain neccesary font info."); ++ ERROR("Could not obtain necessary font info."); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + ASSERT(pdf_obj_typeof(tmp) == PDF_DICT); +@@ -189,7 +192,8 @@ + } + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + pdf_add_dict(fontdict, + pdf_new_name("Type"), pdf_new_name("Font")); +@@ -882,7 +886,7 @@ + int index = pdf_font_get_index(font); + char **enc_vec; + pdf_obj *fontfile; +- FILE *fp; ++ FILE *fp = NULL; + sfnt *sfont; + int i, error = 0; + +@@ -902,14 +906,16 @@ + + if (!sfont) { + ERROR("Unable to open TrueType/dfont file: %s", ident); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } else if (sfont->type != SFNT_TYPE_TRUETYPE && + sfont->type != SFNT_TYPE_TTC && + sfont->type != SFNT_TYPE_DFONT) { + ERROR("Font \"%s\" not a TrueType/dfont font?", ident); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + +@@ -925,7 +931,8 @@ + if (error) { + ERROR("Reading SFND table dir failed for font-file=\"%s\"... Not a TrueType font?", ident); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + +@@ -941,14 +948,16 @@ + if (error) { + ERROR("Error occured while creating font subfont for \"%s\"", ident); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + + #if ENABLE_NOEMBED + if (!embedding) { + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return 0; + } + #endif /* ENABLE_NOEMBED */ +@@ -964,7 +973,8 @@ + ERROR("Required TrueType table \"%s\" does not exist in font: %s", + required_table[i].name, ident); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + } +@@ -977,7 +987,8 @@ + ERROR("Could not created FontFile stream for \"%s\".", ident); + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + if (verbose > 1) + MESG("[%ld bytes]", pdf_stream_length(fontfile)); +diff -ur dvipdfmx-20120420.orig/src/tt_cmap.c dvipdfmx-20120420/src/tt_cmap.c +--- dvipdfmx-20120420.orig/src/tt_cmap.c 2011-10-19 09:10:39.000000000 +0200 ++++ dvipdfmx-20120420/src/tt_cmap.c 2012-04-27 14:46:54.000000000 +0200 +@@ -1029,7 +1029,7 @@ + int cmap_add_id; + tt_cmap *ttcmap; + char *cmap_name; +- FILE *fp; ++ FILE *fp = NULL; + sfnt *sfont; + long offset = 0; + +@@ -1124,7 +1124,8 @@ + RELEASE(cmap_name); + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + return cmap_ref; + } +@@ -1601,7 +1602,7 @@ + unsigned long offset = 0; + char *base_name = NULL, *cmap_name = NULL; + char *tounicode_name = NULL; +- FILE *fp; ++ FILE *fp = NULL; + otl_gsub *gsub_list = NULL; + tt_cmap *ttcmap; + CMap *cmap, *base, *tounicode = NULL; +diff -ur dvipdfmx-20120420.orig/src/type1c.c dvipdfmx-20120420/src/type1c.c +--- dvipdfmx-20120420.orig/src/type1c.c 2010-04-05 02:34:08.000000000 +0200 ++++ dvipdfmx-20120420/src/type1c.c 2012-04-27 14:34:55.000000000 +0200 +@@ -70,7 +70,7 @@ + pdf_font_open_type1c (pdf_font *font) + { + char *ident, *fontname; +- FILE *fp; ++ FILE *fp = NULL; + sfnt *sfont; + cff_font *cffont; + pdf_obj *descriptor, *tmp; +@@ -106,7 +106,8 @@ + if (cffont->flag & FONTTYPE_CIDFONT) { + cff_close (cffont); + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + return -1; + } + +@@ -149,7 +150,8 @@ + } + + sfnt_close(sfont); +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + return 0; + } +@@ -230,7 +232,7 @@ + pdf_obj *fontdict, *descriptor; + char *usedchars; + char *fontname, *uniqueTag, *ident, *fullname; +- FILE *fp; ++ FILE *fp = NULL; + int encoding_id; + pdf_obj *fontfile, *stream_dict; + char **enc_vec; +@@ -708,7 +710,8 @@ + cff_close (cffont); + sfnt_close(sfont); + +- DPXFCLOSE(fp); ++ if (fp) ++ DPXFCLOSE(fp); + + if (verbose > 1) { + MESG("[%u/%u glyphs][%ld bytes]", num_glyphs, cs_count, offset); diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cid.c b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cid.c index 72828782dc5..6d790ec6f22 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cid.c +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cid.c @@ -70,7 +70,7 @@ static struct { {"Adobe", "Japan1", {-1, -1, 2, 2, 4, 5, 6, 6}}, {"Adobe", "Korea1", {-1, -1, 1, 1, 2, 2, 2, 2}}, {"Adobe", "Identity", {-1, -1, 0, 0, 0, 0, 0, 0}}, - {NULL, NULL, {0,0,0,0,0,0,0,0}} + {NULL, NULL, { 0, 0, 0, 0, 0, 0, 0, 0}} }; #define UCS_CC 0 #define ACC_START 1 diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype0.c b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype0.c index a76929fac90..bccc34ba25a 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype0.c +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype0.c @@ -467,7 +467,7 @@ CIDFont_type0_dofont (CIDFont *font) { sfnt *sfont; cff_font *cffont; - FILE *fp; + FILE *fp = NULL; cff_index *charstrings, *idx; cff_charsets *charset = NULL; cff_fdselect *fdselect = NULL; @@ -571,7 +571,8 @@ CIDFont_type0_dofont (CIDFont *font) RELEASE(CIDToGIDMap); cff_close(cffont); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return; } @@ -689,7 +690,8 @@ CIDFont_type0_dofont (CIDFont *font) cff_close(cffont); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); if (verbose > 1) MESG("[%u/%u glyphs][%ld bytes]", num_glyphs, cs_count, destlen); @@ -719,7 +721,7 @@ CIDFont_type0_open (CIDFont *font, const char *name, char *fontname; sfnt *sfont; cff_font *cffont; - FILE *fp; + FILE *fp = NULL; unsigned long offset = 0; ASSERT(font); @@ -746,7 +748,8 @@ CIDFont_type0_open (CIDFont *font, const char *name, if (!(cffont->flag & FONTTYPE_CIDFONT)) { cff_close(cffont); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } @@ -819,7 +822,7 @@ CIDFont_type0_open (CIDFont *font, const char *name, /* getting font info. from TrueType tables */ if ((font->descriptor = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0)) == NULL) - ERROR("Could not obtain neccesary font info."); + ERROR("Could not obtain necessary font info."); if (opt->embed) { memmove(fontname + 7, fontname, strlen(fontname) + 1); @@ -851,7 +854,8 @@ CIDFont_type0_open (CIDFont *font, const char *name, pdf_new_number(1000)); /* not sure */ sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return 0; } @@ -871,7 +875,7 @@ CIDFont_type0_t1cdofont (CIDFont *font) int parent_id; char *used_chars; double default_width, nominal_width; - FILE *fp; + FILE *fp = NULL; ASSERT(font); @@ -1102,7 +1106,8 @@ CIDFont_type0_t1cdofont (CIDFont *font) } sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); if (verbose > 1) MESG("[%u glyphs][%ld bytes]", num_glyphs, destlen); @@ -1133,7 +1138,7 @@ CIDFont_type0_t1copen (CIDFont *font, const char *name, sfnt *sfont; cff_font *cffont; unsigned long offset = 0; - FILE *fp; + FILE *fp = NULL; ASSERT(font); @@ -1159,7 +1164,8 @@ CIDFont_type0_t1copen (CIDFont *font, const char *name, if (cffont->flag & FONTTYPE_CIDFONT) { cff_close(cffont); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } @@ -1218,7 +1224,7 @@ CIDFont_type0_t1copen (CIDFont *font, const char *name, /* getting font info. from TrueType tables */ if ((font->descriptor = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0)) == NULL) - ERROR("Could not obtain neccesary font info."); + ERROR("Could not obtain necessary font info."); if (opt->embed) { memmove(fontname + 7, fontname, strlen(fontname) + 1); @@ -1246,7 +1252,8 @@ CIDFont_type0_t1copen (CIDFont *font, const char *name, pdf_add_dict(font->fontdict, pdf_new_name("CIDSystemInfo"), csi_dict); } sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return 0; } @@ -1372,11 +1379,9 @@ t1_load_UnicodeCMap (const char *font_name, return -1; cffont = t1_load_font(NULL, 1, fp); - if (!cffont) { - DPXFCLOSE(fp); - return -1; - } DPXFCLOSE(fp); + if (!cffont) + return -1; cmap_id = load_base_CMap(font_name, wmode, cffont); diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype2.c b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype2.c index 91cf66db27f..9408772533f 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype2.c +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/cidtype2.c @@ -498,7 +498,7 @@ CIDFont_type2_dofont (CIDFont *font) unsigned char *cidtogidmap; USHORT num_glyphs; int i, glyph_ordering = 0, unicode_cmap = 0; - FILE *fp; + FILE *fp = NULL; if (!font->indirect) return; @@ -853,7 +853,8 @@ CIDFont_type2_dofont (CIDFont *font) if (cidtogidmap) RELEASE(cidtogidmap); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return; } @@ -873,7 +874,8 @@ CIDFont_type2_dofont (CIDFont *font) fontfile = sfnt_create_FontFile_stream(sfont); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); if (!fontfile) ERROR("Could not created FontFile stream for \"%s\".", font->ident); @@ -926,7 +928,7 @@ CIDFont_type2_open (CIDFont *font, const char *name, char *fontname; sfnt *sfont; unsigned long offset = 0; - FILE *fp; + FILE *fp = NULL; ASSERT(font && opt); @@ -960,7 +962,8 @@ CIDFont_type2_open (CIDFont *font, const char *name, break; default: sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; break; } @@ -1059,7 +1062,7 @@ CIDFont_type2_open (CIDFont *font, const char *name, font->descriptor = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0); if (!font->descriptor) { - ERROR("Could not obtain neccesary font info."); + ERROR("Could not obtain necessary font info."); } if (opt->embed) { @@ -1076,7 +1079,8 @@ CIDFont_type2_open (CIDFont *font, const char *name, pdf_new_name(fontname)); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); /* * Don't write fontdict here. diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/truetype.c b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/truetype.c index 9ba07b0993d..9a88efc0f0b 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/truetype.c +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/truetype.c @@ -68,7 +68,7 @@ pdf_font_open_truetype (pdf_font *font) pdf_obj *fontdict, *descriptor; sfnt *sfont; int embedding = 1; /* Must be embedded. */ - FILE *fp; + FILE *fp = NULL; int length, error = 0; ASSERT( font ); @@ -89,7 +89,8 @@ pdf_font_open_truetype (pdf_font *font) if (!sfont) { WARN("Could not open TrueType font: %s", ident); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } @@ -104,7 +105,8 @@ pdf_font_open_truetype (pdf_font *font) if (error) { sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; /* Silently */ } @@ -124,9 +126,10 @@ pdf_font_open_truetype (pdf_font *font) pdf_obj *tmp; tmp = tt_get_fontdesc(sfont, &embedding, -1, 1); if (!tmp) { - ERROR("Could not obtain neccesary font info."); + ERROR("Could not obtain necessary font info."); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } ASSERT(pdf_obj_typeof(tmp) == PDF_DICT); @@ -189,7 +192,8 @@ pdf_font_open_truetype (pdf_font *font) } sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); pdf_add_dict(fontdict, pdf_new_name("Type"), pdf_new_name("Font")); @@ -882,7 +886,7 @@ pdf_font_load_truetype (pdf_font *font) int index = pdf_font_get_index(font); char **enc_vec; pdf_obj *fontfile; - FILE *fp; + FILE *fp = NULL; sfnt *sfont; int i, error = 0; @@ -902,14 +906,16 @@ pdf_font_load_truetype (pdf_font *font) if (!sfont) { ERROR("Unable to open TrueType/dfont file: %s", ident); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } else if (sfont->type != SFNT_TYPE_TRUETYPE && sfont->type != SFNT_TYPE_TTC && sfont->type != SFNT_TYPE_DFONT) { ERROR("Font \"%s\" not a TrueType/dfont font?", ident); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } @@ -925,7 +931,8 @@ 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); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } @@ -941,14 +948,16 @@ pdf_font_load_truetype (pdf_font *font) if (error) { ERROR("Error occured while creating font subfont for \"%s\"", ident); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } #if ENABLE_NOEMBED if (!embedding) { sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return 0; } #endif /* ENABLE_NOEMBED */ @@ -964,7 +973,8 @@ 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); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } } @@ -977,7 +987,8 @@ pdf_font_load_truetype (pdf_font *font) ERROR("Could not created FontFile stream for \"%s\".", ident); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); if (verbose > 1) MESG("[%ld bytes]", pdf_stream_length(fontfile)); diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/tt_cmap.c b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/tt_cmap.c index 7b4d5bee947..4b4a8491879 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/tt_cmap.c +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/tt_cmap.c @@ -1029,7 +1029,7 @@ otf_create_ToUnicode_stream (const char *font_name, int cmap_add_id; tt_cmap *ttcmap; char *cmap_name; - FILE *fp; + FILE *fp = NULL; sfnt *sfont; long offset = 0; @@ -1124,7 +1124,8 @@ otf_create_ToUnicode_stream (const char *font_name, RELEASE(cmap_name); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return cmap_ref; } @@ -1601,7 +1602,7 @@ otf_load_Unicode_CMap (const char *map_name, int ttc_index, /* 0 for non-TTC fon unsigned long offset = 0; char *base_name = NULL, *cmap_name = NULL; char *tounicode_name = NULL; - FILE *fp; + FILE *fp = NULL; otl_gsub *gsub_list = NULL; tt_cmap *ttcmap; CMap *cmap, *base, *tounicode = NULL; diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/type1c.c b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/type1c.c index 081f0a4870b..2681befc178 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/type1c.c +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20120420/src/type1c.c @@ -70,7 +70,7 @@ int pdf_font_open_type1c (pdf_font *font) { char *ident, *fontname; - FILE *fp; + FILE *fp = NULL; sfnt *sfont; cff_font *cffont; pdf_obj *descriptor, *tmp; @@ -106,7 +106,8 @@ pdf_font_open_type1c (pdf_font *font) if (cffont->flag & FONTTYPE_CIDFONT) { cff_close (cffont); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return -1; } @@ -149,7 +150,8 @@ pdf_font_open_type1c (pdf_font *font) } sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); return 0; } @@ -230,7 +232,7 @@ pdf_font_load_type1c (pdf_font *font) pdf_obj *fontdict, *descriptor; char *usedchars; char *fontname, *uniqueTag, *ident, *fullname; - FILE *fp; + FILE *fp = NULL; int encoding_id; pdf_obj *fontfile, *stream_dict; char **enc_vec; @@ -708,7 +710,8 @@ pdf_font_load_type1c (pdf_font *font) cff_close (cffont); sfnt_close(sfont); - DPXFCLOSE(fp); + if (fp) + DPXFCLOSE(fp); if (verbose > 1) { MESG("[%u/%u glyphs][%ld bytes]", num_glyphs, cs_count, offset); diff --git a/Build/source/texk/xdvipdfmx/ChangeLog.TL b/Build/source/texk/xdvipdfmx/ChangeLog.TL index 3293ccb3bd5..ea73c4c304d 100644 --- a/Build/source/texk/xdvipdfmx/ChangeLog.TL +++ b/Build/source/texk/xdvipdfmx/ChangeLog.TL @@ -1,6 +1,12 @@ ChangeLog.TL: TeX Live (TL) changes for xdvipdfmx ================================================= +2012-04-27 Peter Breitenlohner <peb@mppmu.mpg.de> + + Reduce differences between dvipdfmx and xdvipdfmx. + * cid.[ch], cidtype[02].c, mem.[ch], truetype.c, tt_cmap.c: + Trivial modifications. + 2012-04-25 Peter Breitenlohner <peb@mppmu.mpg.de> Enable use of MEM_DEBUG, try to avoid mem_debug_check warning. diff --git a/Build/source/texk/xdvipdfmx/src/cid.c b/Build/source/texk/xdvipdfmx/src/cid.c index 3fea81f0be6..59a4ca40707 100644 --- a/Build/source/texk/xdvipdfmx/src/cid.c +++ b/Build/source/texk/xdvipdfmx/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.34 2011/03/06 03:14:13 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -59,16 +59,18 @@ static struct { const char *registry; const char *ordering; - /* Heighest Supplement values supported by PDF-1.0, 1.1, ... */ + /* Heighest Supplement values supported by PDF-1.0, 1.1, ...; see + * also http://partners.adobe.com/public/developer/font/index.html#ckf + */ int supplement[16]; } CIDFont_stdcc_def[] = { - {"Adobe", "UCS", {-1, -1, 0, 0, 0, 0, 0}}, - {"Adobe", "GB1", {-1, -1, 0, 2, 4, 4, 4}}, - {"Adobe", "CNS1", {-1, -1, 0, 0, 3, 4, 4}}, - {"Adobe", "Japan1", {-1, -1, 2, 2, 4, 5, 6}}, - {"Adobe", "Korea1", {-1, -1, 1, 1, 2, 2, 2}}, - {"Adobe", "Identity", {-1, -1, 0, 0, 0, 0, 0}}, - {NULL, NULL, {0,0,0,0,0,0,0}} + {"Adobe", "UCS", {-1, -1, 0, 0, 0, 0, 0, 0}}, + {"Adobe", "GB1", {-1, -1, 0, 2, 4, 4, 4, 4}}, + {"Adobe", "CNS1", {-1, -1, 0, 0, 3, 4, 4, 4}}, + {"Adobe", "Japan1", {-1, -1, 2, 2, 4, 5, 6, 6}}, + {"Adobe", "Korea1", {-1, -1, 1, 1, 2, 2, 2, 2}}, + {"Adobe", "Identity", {-1, -1, 0, 0, 0, 0, 0, 0}}, + {NULL, NULL, { 0, 0, 0, 0, 0, 0, 0, 0}} }; #define UCS_CC 0 #define ACC_START 1 @@ -113,11 +115,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/xdvipdfmx/src/cid.h b/Build/source/texk/xdvipdfmx/src/cid.h index 97b846e6f4f..cfdff86a883 100644 --- a/Build/source/texk/xdvipdfmx/src/cid.h +++ b/Build/source/texk/xdvipdfmx/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. @@ -44,7 +44,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/xdvipdfmx/src/cidtype0.c b/Build/source/texk/xdvipdfmx/src/cidtype0.c index 3f5cd1a90d2..f0b2be75664 100644 --- a/Build/source/texk/xdvipdfmx/src/cidtype0.c +++ b/Build/source/texk/xdvipdfmx/src/cidtype0.c @@ -1,8 +1,8 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/cidtype0.c,v 1.39 2008/10/13 19:42:48 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/cidtype0.c,v 1.40 2011/03/06 03:14:13 chofchof 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> This program is free software; you can redistribute it and/or modify diff --git a/Build/source/texk/xdvipdfmx/src/cidtype2.c b/Build/source/texk/xdvipdfmx/src/cidtype2.c index 7d3df254c59..8ff1bea2dfd 100644 --- a/Build/source/texk/xdvipdfmx/src/cidtype2.c +++ b/Build/source/texk/xdvipdfmx/src/cidtype2.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/cidtype2.c,v 1.36 2008/05/17 04:18:47 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/cidtype2.c,v 1.38 2011/03/06 03:14:13 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -548,6 +548,7 @@ CIDFont_type2_dofont (CIDFont *font) sfont = sfnt_open(fp); } #endif + if (!sfont) { ERROR("Could not open TTF file: %s", font->ident); } diff --git a/Build/source/texk/xdvipdfmx/src/mem.c b/Build/source/texk/xdvipdfmx/src/mem.c index 0e1ebeea227..b0f02309b0b 100644 --- a/Build/source/texk/xdvipdfmx/src/mem.c +++ b/Build/source/texk/xdvipdfmx/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.8 2009/09/18 23:56:02 matthias Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -171,10 +171,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/xdvipdfmx/src/mem.h b/Build/source/texk/xdvipdfmx/src/mem.h index a4d76f8746a..852a011e168 100644 --- a/Build/source/texk/xdvipdfmx/src/mem.h +++ b/Build/source/texk/xdvipdfmx/src/mem.h @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/mem.h,v 1.5 2007/11/17 18:08:58 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/mem.h,v 1.6 2009/11/29 01:18:20 matthias Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. diff --git a/Build/source/texk/xdvipdfmx/src/truetype.c b/Build/source/texk/xdvipdfmx/src/truetype.c index 15bde765995..ffbe747d62e 100644 --- a/Build/source/texk/xdvipdfmx/src/truetype.c +++ b/Build/source/texk/xdvipdfmx/src/truetype.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/truetype.c,v 1.11 2009/08/28 00:26:17 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/truetype.c,v 1.12 2011/03/06 03:14:15 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -92,6 +92,7 @@ pdf_font_open_truetype (pdf_font *font) sfont = sfnt_open(fp); } #endif + if (!sfont) { WARN("Could not open TrueType font: %s", ident); if (fp) @@ -886,7 +887,7 @@ pdf_font_load_truetype (pdf_font *font) #ifdef ENABLE_NOEMBED int embedding = pdf_font_get_flag(font, PDF_FONT_FLAG_NOEMBED) ? 0 : 1; #endif /* ENABLE_NOEMBED */ - int index = pdf_font_get_index(font); + int index = pdf_font_get_index(font); char **enc_vec; pdf_obj *fontfile; FILE *fp = NULL; @@ -909,6 +910,7 @@ pdf_font_load_truetype (pdf_font *font) sfont = sfnt_open(fp); } #endif + if (!sfont) { ERROR("Unable to open TrueType/dfont file: %s", ident); if (fp) diff --git a/Build/source/texk/xdvipdfmx/src/tt_cmap.c b/Build/source/texk/xdvipdfmx/src/tt_cmap.c index 0a5890d583a..363f9fe65f1 100644 --- a/Build/source/texk/xdvipdfmx/src/tt_cmap.c +++ b/Build/source/texk/xdvipdfmx/src/tt_cmap.c @@ -1,8 +1,8 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/tt_cmap.c,v 1.26 2008/05/08 18:51:59 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/tt_cmap.c,v 1.27 2009/09/18 23:56:02 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> This program is free software; you can redistribute it and/or modify @@ -1685,9 +1685,10 @@ fprintf(stderr, "otf_load_Unicode_CMap(%s, %d)\n", map_name, ttc_index); if (!fp) return -1; sfont = dfont_open(fp, ttc_index); } else { - sfont = sfnt_open(fp, -1); + sfont = sfnt_open(fp); } #endif + if (!sfont) { ERROR("Could not open OpenType/TrueType/dfont font file \"%s\"", map_name); } |