From 92668c4346480ff4038ecd9ee7beacb688900392 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 3 Jul 2018 18:57:02 +0100 Subject: Allow for CIDToGIDMap in font being "/Identity". Previously we would have tripped over this, thrown an error and aborted loading the whole page. Any non-stream, non "Identity" CIDToGIDMaps now produce a warning rather than an error so we don't stop processing the entire page. --- source/pdf/pdf-font.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c index f600fc1b..b29a1a18 100644 --- a/source/pdf/pdf-font.c +++ b/source/pdf/pdf-font.c @@ -1083,7 +1083,7 @@ load_cid_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict, pdf_obj *encodi /* Apply encoding */ cidtogidmap = pdf_dict_get(ctx, dict, PDF_NAME(CIDToGIDMap)); - if (pdf_is_indirect(ctx, cidtogidmap)) + if (pdf_is_stream(ctx, cidtogidmap)) { fz_buffer *buf; size_t z, len; @@ -1100,6 +1100,10 @@ load_cid_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict, pdf_obj *encodi fz_drop_buffer(ctx, buf); } + else if (!pdf_name_eq(ctx, PDF_NAME(Identity), cidtogidmap)) + { + fz_warn(ctx, "ignoring unknown CIDToGIDMap entry"); + } /* if font is external, cidtogidmap should not be identity */ /* so we map from cid to unicode and then map that through the (3 1) */ -- cgit v1.2.3