From e4d9ec8cc927d6d1e3a24628cc0577fe38cae01f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 3 Jul 2009 01:49:30 +0200 Subject: Use StandardEncoding for non-embedded simple fonts without a BaseEncoding. --- mupdf/mupdf.h | 2 ++ mupdf/pdf_font.c | 4 ++++ mupdf/pdf_fontenc.c | 6 ++++-- mupdf/pdf_fontfile.c | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mupdf/mupdf.h b/mupdf/mupdf.h index 037fbcc7..39ee9294 100644 --- a/mupdf/mupdf.h +++ b/mupdf/mupdf.h @@ -448,6 +448,8 @@ struct pdf_fontdesc_s int nvmtx, vmtxcap; pdf_vmtx dvmtx; pdf_vmtx *vmtx; + + int isembedded; }; /* fontmtx.c */ diff --git a/mupdf/pdf_font.c b/mupdf/pdf_font.c index 108ed2d6..b599df04 100644 --- a/mupdf/pdf_font.c +++ b/mupdf/pdf_font.c @@ -205,6 +205,8 @@ pdf_newfontdesc(void) fontdesc->dvmtx.y = 880; fontdesc->dvmtx.w = -1000; + fontdesc->isembedded = 0; + return fontdesc; } @@ -339,6 +341,8 @@ loadsimplefont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *r base = fz_dictgets(encoding, "BaseEncoding"); if (fz_isname(base)) pdf_loadencoding(estrings, fz_toname(base)); + else if (!fontdesc->isembedded) + pdf_loadencoding(estrings, "StandardEncoding"); diff = fz_dictgets(encoding, "Differences"); if (fz_isarray(diff)) diff --git a/mupdf/pdf_fontenc.c b/mupdf/pdf_fontenc.c index d45f4edb..dd31915d 100644 --- a/mupdf/pdf_fontenc.c +++ b/mupdf/pdf_fontenc.c @@ -18,6 +18,8 @@ void pdf_loadencoding(char **estrings, char *encoding) bstrings = (char**) pdf_macexpert; if (!strcmp(encoding, "WinAnsiEncoding")) bstrings = (char**) pdf_winansi; + if (!strcmp(encoding, "StandardEncoding")) + bstrings = (char**) pdf_standard; if (bstrings) for (i = 0; i < 256; i++) @@ -194,8 +196,6 @@ const char * const pdf_winansi[256] = { _notdef, _notdef, _notdef, "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis" }; -#if 0 - const char * const pdf_standard[256] = { _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, @@ -236,6 +236,8 @@ const char * const pdf_standard[256] = { _notdef, _notdef, _notdef, "dotlessi", _notdef, _notdef, "lslash", "oslash", "oe", "germandbls", _notdef, _notdef, _notdef, _notdef }; +#if 0 + const char * const pdf_expert[256] = { _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, _notdef, diff --git a/mupdf/pdf_fontfile.c b/mupdf/pdf_fontfile.c index 5c327943..dfaa6528 100644 --- a/mupdf/pdf_fontfile.c +++ b/mupdf/pdf_fontfile.c @@ -282,6 +282,8 @@ pdf_loadembeddedfont(pdf_fontdesc *font, pdf_xref *xref, fz_obj *stmref) font->buffer = buf->rp; /* save the buffer so we can free it later */ fz_free(buf); /* only free the fz_buffer struct, not the contained data */ + font->isembedded = 1; + return fz_okay; } -- cgit v1.2.3