summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-type3.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-05-19 12:30:05 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-05-19 13:04:37 +0200
commit598344369ae46f140e9f617e26227e48c6d97fb3 (patch)
treea3e251605506c59647b073a7423f84aa6448905a /source/pdf/pdf-type3.c
parentdb938eebb82e08f6de82c4f1d8536d589a94ddcf (diff)
downloadmupdf-598344369ae46f140e9f617e26227e48c6d97fb3.tar.xz
Fall back to encoding the glyph index as ASCII in Type3 fonts.
Diffstat (limited to 'source/pdf/pdf-type3.c')
-rw-r--r--source/pdf/pdf-type3.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/pdf/pdf-type3.c b/source/pdf/pdf-type3.c
index 7432c4cd..b7c10c4e 100644
--- a/source/pdf/pdf-type3.c
+++ b/source/pdf/pdf-type3.c
@@ -110,6 +110,14 @@ pdf_load_type3_font(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *d
pdf_load_to_unicode(ctx, doc, fontdesc, estrings, NULL, pdf_dict_get(ctx, dict, PDF_NAME_ToUnicode));
+ /* Use the glyph index as ASCII when we can't figure out a proper encoding */
+ if (fontdesc->cid_to_ucs_len == 256)
+ {
+ for (i = 32; i < 127; ++i)
+ if (fontdesc->cid_to_ucs[i] == 0xFFFD)
+ fontdesc->cid_to_ucs[i] = i;
+ }
+
/* Widths */
pdf_set_default_hmtx(ctx, fontdesc, 0);