summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-07-20 16:40:06 +0200
committerTor Andersson <tor.andersson@artifex.com>2012-07-20 16:40:26 +0200
commit587f46f9027bb6fa3eeda2b82990069ae07bff90 (patch)
tree7b69cc97566c5f2ec805738db51f646bc608f2a8
parent0c52b314e922708903f76c3a4cecfcbbeff069e8 (diff)
downloadmupdf-587f46f9027bb6fa3eeda2b82990069ae07bff90.tar.xz
Give precedence to /Subtype field when deciding on font encodings.
Fixes bug where Symbol is not embedded but encoded as a TrueType but the built-in font is a Type1. http://code.google.com/p/sumatrapdf/issues/detail?id=1310
-rw-r--r--pdf/pdf_font.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index bfd1d97d..8b6ef180 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -405,6 +405,7 @@ pdf_load_simple_font(pdf_document *xref, pdf_obj *dict)
pdf_obj *widths;
unsigned short *etable = NULL;
pdf_font_desc *fontdesc = NULL;
+ char *subtype;
FT_Face face;
FT_CharMap cmap;
int symbolic;
@@ -555,8 +556,16 @@ pdf_load_simple_font(pdf_document *xref, pdf_obj *dict)
for (i = 0; i < 256; i++)
etable[i] = ft_char_index(face, i);
- /* encode by glyph name where we can */
fz_lock(ctx, FZ_LOCK_FREETYPE);
+
+ /* built-in and substitute fonts may be a different type than what the document expects */
+ subtype = pdf_to_name(pdf_dict_gets(dict, "Subtype"));
+ if (!strcmp(subtype, "Type1"))
+ kind = TYPE1;
+ else if (!strcmp(subtype, "TrueType"))
+ kind = TRUETYPE;
+
+ /* encode by glyph name where we can */
if (kind == TYPE1)
{
for (i = 0; i < 256; i++)
@@ -649,6 +658,7 @@ pdf_load_simple_font(pdf_document *xref, pdf_obj *dict)
}
}
}
+
fz_unlock(ctx, FZ_LOCK_FREETYPE);
fontdesc->encoding = pdf_new_identity_cmap(ctx, 0, 1);