diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-05-19 12:30:05 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-05-19 13:04:37 +0200 |
commit | 598344369ae46f140e9f617e26227e48c6d97fb3 (patch) | |
tree | a3e251605506c59647b073a7423f84aa6448905a /source/pdf | |
parent | db938eebb82e08f6de82c4f1d8536d589a94ddcf (diff) | |
download | mupdf-598344369ae46f140e9f617e26227e48c6d97fb3.tar.xz |
Fall back to encoding the glyph index as ASCII in Type3 fonts.
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-encoding.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-type3.c | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source/pdf/pdf-encoding.c b/source/pdf/pdf-encoding.c index f23747dc..ca15b456 100644 --- a/source/pdf/pdf-encoding.c +++ b/source/pdf/pdf-encoding.c @@ -63,7 +63,7 @@ pdf_lookup_agl(const char *name) else if (buf[0] == 'a' && buf[1] != 0 && buf[2] != 0) code = strtol(buf + 1, NULL, 10); - return (code >= 0 && code <= 0x10ffff) ? code : 0; + return (code > 0 && code <= 0x10ffff) ? code : 0xFFFD; } static const char *empty_dup_list[] = { 0 }; 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); |