From d4e81f3c56d8e98c2debcbe22ad82958739f8f1f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 23 Jul 2012 18:05:00 +0200 Subject: Prefer larger Width value if more than one is given for each glyph. Fixes bug #692267 --- pdf/pdf_font.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]); } } } -- cgit v1.2.3