summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-font.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-03-03 12:18:39 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-03-03 12:48:21 +0100
commit4c16a5371c109be8d52eae8690ab96ceebf1349b (patch)
tree5597f48089c9e706ee4047b4e82442a360643166 /source/pdf/pdf-font.c
parentd84fc450c0434d9b0c7230e39a55b29d979af0fe (diff)
downloadmupdf-4c16a5371c109be8d52eae8690ab96ceebf1349b.tar.xz
pdf: Additional entries in Mac OS Roman encoding not in MacRomanEncoding.
When encoding truetype fonts via the mac roman cmap table, we should be using the additional entries introduced in PDF 1.5, which are different from the standard MacRomanEncoding table in the appendix.
Diffstat (limited to 'source/pdf/pdf-font.c')
-rw-r--r--source/pdf/pdf-font.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index a974c8d5..eaeac3c0 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -178,9 +178,9 @@ static int ft_char_index(FT_Face face, int cid)
return gid;
}
-static int ft_name_index(FT_Face face, char *name)
+static int ft_name_index(FT_Face face, const char *name)
{
- int code = FT_Get_Name_Index(face, name);
+ int code = FT_Get_Name_Index(face, (char*)name);
if (code == 0)
{
int unicode = pdf_lookup_agl(name);
@@ -300,9 +300,32 @@ static int ft_width(fz_context *ctx, pdf_font_desc *fontdesc, int cid)
return adv * 1000 / ((FT_Face)fontdesc->font->ft_face)->units_per_EM;
}
-static int lookup_mre_code(char *name)
+static const struct { int code; const char *name; } mre_diff_table[] =
+{
+ { 173, "notequal" },
+ { 176, "infinity" },
+ { 178, "lessequal" },
+ { 179, "greaterequal" },
+ { 182, "partialdiff" },
+ { 183, "summation" },
+ { 184, "product" },
+ { 185, "pi" },
+ { 186, "integral" },
+ { 189, "Omega" },
+ { 195, "radical" },
+ { 197, "approxequal" },
+ { 198, "Delta" },
+ { 215, "lozenge" },
+ { 219, "Euro" },
+ { 240, "apple" },
+};
+
+static int lookup_mre_code(const char *name)
{
int i;
+ for (i = 0; i < nelem(mre_diff_table); ++i)
+ if (!strcmp(name, mre_diff_table[i].name))
+ return mre_diff_table[i].code;
for (i = 0; i < 256; i++)
if (pdf_mac_roman[i] && !strcmp(name, pdf_mac_roman[i]))
return i;
@@ -557,7 +580,7 @@ pdf_load_simple_font_by_name(fz_context *ctx, pdf_document *doc, pdf_obj *dict,
int kind;
int glyph;
- char *estrings[256];
+ const char *estrings[256];
char ebuffer[256][32];
int i, k, n;
int fterr;