summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]);
}
}
}