summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorJjgod Jiang <gzjjgod@gmail.com>2015-04-26 13:36:42 +0000
committerJjgod Jiang <gzjjgod@gmail.com>2015-04-26 13:36:42 +0000
commit28d4c07de79a077327077a5faf2c462cafd56399 (patch)
tree4df630187fd1e6e6e6af49ce9aa6eb965ce56fe1 /Build
parent667d6bbddd82edf55440de0d01d3250d1367780e (diff)
Support loading CID type 0 font from TrueType Collection
Try not only otf files but also ttc files when reading CID type 0 font. git-svn-id: svn://tug.org/texlive/trunk@37053 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog7
-rw-r--r--Build/source/texk/dvipdfm-x/cidtype0.c28
-rw-r--r--Build/source/texk/dvipdfm-x/cidtype2.c8
-rw-r--r--Build/source/texk/dvipdfm-x/truetype.c2
4 files changed, 36 insertions, 9 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index edbfdbc02c1..aed0743afec 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,10 @@
+2015-04-26 Jiang Jiang <gzjjgod@gmail.com>
+
+ * cidtype0.c, cidtype2.c: Support loading CID type 0 font from
+ TrueType Collection.
+
+ * truetype.c: Fix offset in offset for TrueType loading.
+
2015-04-25 Jiang Jiang <gzjjgod@gmail.com>
* cff_dict.c: Be more permissive in CFF dict parsing, fix Yuppy SC
diff --git a/Build/source/texk/dvipdfm-x/cidtype0.c b/Build/source/texk/dvipdfm-x/cidtype0.c
index 18c99e6129f..c2cbdea13d2 100644
--- a/Build/source/texk/dvipdfm-x/cidtype0.c
+++ b/Build/source/texk/dvipdfm-x/cidtype0.c
@@ -899,15 +899,21 @@ CIDFont_type0_t1cdofont (CIDFont *font)
ERROR("Unexpected error: Font not actually used???");
fp = DPXFOPEN(font->ident, DPX_RES_TYPE_OTFONT);
- if (!fp)
- ERROR("Could not open OpenType font file: %s", font->ident);
+ if (!fp) {
+ fp = DPXFOPEN(font->ident, DPX_RES_TYPE_TTFONT);
+ if (!fp)
+ ERROR("Could not open OpenType font file: %s", font->ident);
+ }
sfont = sfnt_open(fp);
if (!sfont)
ERROR("Could not open OpenType font file: %s", font->ident);
- if (sfnt_read_table_directory(sfont, 0) < 0 ||
- sfont->type != SFNT_TYPE_POSTSCRIPT)
+ if (sfont->type == SFNT_TYPE_TTC)
+ offset = ttc_read_offset(sfont, CIDFont_get_opt_index(font));
+
+ if ((sfont->type != SFNT_TYPE_TTC && sfont->type != SFNT_TYPE_POSTSCRIPT) ||
+ sfnt_read_table_directory(sfont, offset) < 0)
ERROR("Not a CFF/OpenType font (5)?");
offset = sfnt_find_table_pos(sfont, "CFF ");
if (offset == 0)
@@ -1147,15 +1153,21 @@ CIDFont_type0_t1copen (CIDFont *font, const char *name,
ASSERT(font);
fp = DPXFOPEN(name, DPX_RES_TYPE_OTFONT);
- if (!fp)
- return -1;
+ if (!fp) {
+ fp = DPXFOPEN(name, DPX_RES_TYPE_TTFONT);
+ if (!fp) return -1;
+ }
sfont = sfnt_open(fp);
if (!sfont) {
ERROR("Not a CFF/OpenType font (7)?");
}
- if (sfont->type != SFNT_TYPE_POSTSCRIPT ||
- sfnt_read_table_directory(sfont, 0) < 0 ||
+
+ if (sfont && sfont->type == SFNT_TYPE_TTC)
+ offset = ttc_read_offset(sfont, opt->index);
+
+ if ((sfont->type != SFNT_TYPE_TTC && sfont->type != SFNT_TYPE_POSTSCRIPT) ||
+ sfnt_read_table_directory(sfont, offset) < 0 ||
(offset = sfnt_find_table_pos(sfont, "CFF ")) == 0) {
ERROR("Not a CFF/OpenType font (8)?");
}
diff --git a/Build/source/texk/dvipdfm-x/cidtype2.c b/Build/source/texk/dvipdfm-x/cidtype2.c
index 1a7ef085a24..757a6a37216 100644
--- a/Build/source/texk/dvipdfm-x/cidtype2.c
+++ b/Build/source/texk/dvipdfm-x/cidtype2.c
@@ -975,6 +975,14 @@ CIDFont_type2_open (CIDFont *font, const char *name,
ERROR("Reading TrueType table directory failed.");
}
+ /* Ignore TrueType Collection with CFF table. */
+ if (sfont->type == SFNT_TYPE_TTC && sfnt_find_table_pos(sfont, "CFF ")) {
+ sfnt_close(sfont);
+ if (fp)
+ DPXFCLOSE(fp);
+ return -1;
+ }
+
{
char *shortname;
long namelen;
diff --git a/Build/source/texk/dvipdfm-x/truetype.c b/Build/source/texk/dvipdfm-x/truetype.c
index 715b1d05077..911a5967710 100644
--- a/Build/source/texk/dvipdfm-x/truetype.c
+++ b/Build/source/texk/dvipdfm-x/truetype.c
@@ -919,7 +919,7 @@ pdf_font_load_truetype (pdf_font *font)
unsigned long offset;
offset = ttc_read_offset(sfont, index);
if (offset == 0) ERROR("Invalid TTC index in %s.", ident);
- error = sfnt_read_table_directory(sfont, ttc_read_offset(sfont, offset));
+ error = sfnt_read_table_directory(sfont, offset);
} else {
error = sfnt_read_table_directory(sfont, sfont->offset);
}