summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-05-01 13:49:31 +0200
committerTor Andersson <tor.andersson@artifex.com>2013-05-01 13:50:16 +0200
commitae7b70dce175e02f5eab4b960267c8fba4a02b22 (patch)
treef6c3a213f9255cb072090c7548302f997dfbaf71
parent01667aed31156e9cd93a2934ef79ec29898291ef (diff)
downloadmupdf-ae7b70dce175e02f5eab4b960267c8fba4a02b22.tar.xz
Try to use ToUnicode cmap to encode identity-encoded substitute fonts.
-rw-r--r--pdf/pdf_font.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index b1621657..de43796f 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -868,6 +868,17 @@ load_cid_font(pdf_document *xref, pdf_obj *dict, pdf_obj *encoding, pdf_obj *to_
pdf_load_to_unicode(xref, fontdesc, NULL, collection, to_unicode);
+ /* If we have an identity encoding, we're supposed to use the glyph ids directly.
+ * If we only have a substitute font, that won't work.
+ * Make a last ditch attempt by using
+ * the ToUnicode table if it exists to map via the substitute font's cmap. */
+ if (strstr(fontdesc->encoding->cmap_name, "Identity-") && fontdesc->font->ft_substitute)
+ {
+ fz_warn(ctx, "non-embedded font using identity encoding: %s", basefont);
+ if (fontdesc->to_unicode && !fontdesc->to_ttf_cmap)
+ fontdesc->to_ttf_cmap = pdf_keep_cmap(ctx, fontdesc->to_unicode);
+ }
+
/* Horizontal */
dw = 1000;