summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvipdfmx/src
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/xdvipdfmx/src')
-rw-r--r--Build/source/texk/xdvipdfmx/src/tt_post.c8
1 files changed, 5 insertions, 3 deletions
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 {