diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2018-02-06 01:42:38 +0100 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2018-02-06 13:25:15 +0100 |
commit | 90421d4cd157c743264643794a5522a1dd46eda9 (patch) | |
tree | 9c3860a0c2852a927fd9669aa731939587c2fd7f | |
parent | 862245679f67ff35d9868bad5b7ede1c7b1c0873 (diff) | |
download | mupdf-90421d4cd157c743264643794a5522a1dd46eda9.tar.xz |
Bug 698990: Start new run of font width only if not at end.
Previously, while at the very last glyph mupdf would allocate a
new array for a run of distinct glyph widths and then not drop it
while leaving the function. Now a new run of font widths is only
started if not at the very last glyph.
-rw-r--r-- | source/pdf/pdf-font.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c index c7aaa9fd..8ca89e93 100644 --- a/source/pdf/pdf-font.c +++ b/source/pdf/pdf-font.c @@ -1737,7 +1737,8 @@ pdf_add_cid_font_widths(fz_context *ctx, pdf_document *doc, pdf_font_desc *fontd /* End of same widths for consecutive ids. Current will * be pushed as prev. below during next iteration */ publish = 1; - run_obj = pdf_new_array(ctx, doc, 10); + if (curr_code < face->num_glyphs) + run_obj = pdf_new_array(ctx, doc, 10); new_state = FW_RUN; /* And the new first code is our current code */ new_first_code = curr_code; @@ -1802,9 +1803,12 @@ pdf_add_cid_font_widths(fz_context *ctx, pdf_document *doc, pdf_font_desc *fontd break; } - state = new_state; - first_code = new_first_code; - publish = 0; + if (curr_code < face->num_glyphs) + { + state = new_state; + first_code = new_first_code; + publish = 0; + } } prev_size = curr_size; |