From 4a436b90db469ffdab8ae4fea378e64ecf3f4b20 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Thu, 10 Jan 2013 14:06:19 +0000 Subject: Change calculation of post->count for special fonts with unused index. git-svn-id: svn://tug.org/texlive/trunk@28787 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfmx/ChangeLog | 5 +++++ Build/source/texk/dvipdfmx/src/tt_post.c | 10 ++++++---- Build/source/texk/xdvipdfmx/ChangeLog | 5 +++++ Build/source/texk/xdvipdfmx/src/tt_post.c | 8 +++++--- 4 files changed, 21 insertions(+), 7 deletions(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/dvipdfmx/ChangeLog b/Build/source/texk/dvipdfmx/ChangeLog index 5fe4b753127..2624bcfd355 100644 --- a/Build/source/texk/dvipdfmx/ChangeLog +++ b/Build/source/texk/dvipdfmx/ChangeLog @@ -1,3 +1,8 @@ +2013-01-10 Akira Kakuto + + * read_v2_post_names() in tt_post.c: Change calculation of post->count + for special fonts with unused index. + 2013-01-10 Peter Breitenlohner * src/cid.c: Avoid casts (const char *) -> (char *). diff --git a/Build/source/texk/dvipdfmx/src/tt_post.c b/Build/source/texk/dvipdfmx/src/tt_post.c index 8c6f6e293d0..46adba1afcf 100644 --- a/Build/source/texk/dvipdfmx/src/tt_post.c +++ b/Build/source/texk/dvipdfmx/src/tt_post.c @@ -38,17 +38,19 @@ static const char *macglyphorder[258]; static int read_v2_post_names (struct tt_post_table *post, sfnt *sfont) { - USHORT i, idx, *indices; + USHORT i, idx, *indices, maxidx; int len; post->numberOfGlyphs = sfnt_get_ushort(sfont); indices = NEW(post->numberOfGlyphs, USHORT); - post->count = 0; + maxidx = 257; for (i = 0; i < post->numberOfGlyphs; i++) { idx = sfnt_get_ushort(sfont); if (idx >= 258) { + if (idx > maxidx) + maxidx = idx; if (idx > 32767) { /* Although this is strictly speaking out of spec, it seems to work and there are real-life fonts that use it. @@ -65,11 +67,11 @@ read_v2_post_names (struct tt_post_table *post, sfnt *sfont) in such a case */ idx = 0; } - post->count++; } indices[i] = idx; } + post->count = maxidx - 257; if (post->count < 1) { post->names = NULL; } else { @@ -185,7 +187,7 @@ tt_release_post_table (struct tt_post_table *post) ASSERT(post); if (post->glyphNamePtr && post->Version != 0x00010000UL) - RELEASE(post->glyphNamePtr); + RELEASE((void *)post->glyphNamePtr); if (post->names) { for (i = 0; i < post->count; i++) { if (post->names[i]) diff --git a/Build/source/texk/xdvipdfmx/ChangeLog b/Build/source/texk/xdvipdfmx/ChangeLog index ae781d4a93b..6776875fd6b 100644 --- a/Build/source/texk/xdvipdfmx/ChangeLog +++ b/Build/source/texk/xdvipdfmx/ChangeLog @@ -1,3 +1,8 @@ +2013-01-10 Akira Kakuto + + * read_v2_post_names() in tt_post.c: Change calculation of post->count + for special fonts with unused index. + 2013-01-10 Peter Breitenlohner * src/cid.c: Avoid casts (const char *) -> (char *). diff --git a/Build/source/texk/xdvipdfmx/src/tt_post.c b/Build/source/texk/xdvipdfmx/src/tt_post.c index e7c940539a1..0deb3ab8b23 100644 --- a/Build/source/texk/xdvipdfmx/src/tt_post.c +++ b/Build/source/texk/xdvipdfmx/src/tt_post.c @@ -38,17 +38,19 @@ static const char *macglyphorder[258]; static int read_v2_post_names (struct tt_post_table *post, sfnt *sfont) { - USHORT i, idx, *indices; + USHORT i, idx, *indices, maxidx; int len; post->numberOfGlyphs = sfnt_get_ushort(sfont); indices = NEW(post->numberOfGlyphs, USHORT); - post->count = 0; + maxidx = 257; for (i = 0; i < post->numberOfGlyphs; i++) { idx = sfnt_get_ushort(sfont); if (idx >= 258) { + if (idx > maxidx) + maxidx = idx; if (idx > 32767) { /* Although this is strictly speaking out of spec, it seems to work and there are real-life fonts that use it. @@ -65,11 +67,11 @@ read_v2_post_names (struct tt_post_table *post, sfnt *sfont) in such a case */ idx = 0; } - post->count++; } indices[i] = idx; } + post->count = maxidx - 257; if (post->count < 1) { post->names = NULL; } else { -- cgit v1.2.3