summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-07-23 18:05:00 +0200
committerTor Andersson <tor.andersson@artifex.com>2012-07-23 18:05:00 +0200
commitd4e81f3c56d8e98c2debcbe22ad82958739f8f1f (patch)
tree1c3f1c7656a63e071a06a9a7634b52c551e96a2d
parent93afe454084a1affa050b3ae71674dcfc0ce6a20 (diff)
downloadmupdf-d4e81f3c56d8e98c2debcbe22ad82958739f8f1f.tar.xz
Prefer larger Width value if more than one is given for each glyph.
Fixes bug #692267
-rw-r--r--pdf/pdf_font.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index 647125a6..d43d45d4 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -1086,6 +1086,7 @@ pdf_make_width_table(fz_context *ctx, pdf_font_desc *fontdesc)
font->width_count = n + 1;
font->width_table = fz_malloc_array(ctx, font->width_count, sizeof(int));
+ memset(font->width_table, 0, font->width_count * sizeof(int));
fontdesc->size += font->width_count * sizeof(int);
for (i = 0; i < fontdesc->hmtx_len; i++)
@@ -1095,7 +1096,7 @@ pdf_make_width_table(fz_context *ctx, pdf_font_desc *fontdesc)
cid = pdf_lookup_cmap(fontdesc->encoding, k);
gid = pdf_font_cid_to_gid(ctx, fontdesc, cid);
if (gid >= 0 && gid < font->width_count)
- font->width_table[gid] = fontdesc->hmtx[i].w;
+ font->width_table[gid] = fz_maxi(fontdesc->hmtx[i].w, font->width_table[gid]);
}
}
}