diff options
-rw-r--r-- | fitz/fitz.h | 1 | ||||
-rw-r--r-- | fitz/res_font.c | 4 | ||||
-rw-r--r-- | mupdf/mupdf.h | 1 | ||||
-rw-r--r-- | mupdf/pdf_font.c | 3 | ||||
-rw-r--r-- | mupdf/pdf_fontfile.c | 2 |
5 files changed, 6 insertions, 5 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h index fcedbebe..b7787acc 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -661,6 +661,7 @@ struct fz_font_s void *ftface; /* has an FT_Face if used */ int ftsubstitute; /* ... substitute metrics */ int fthint; /* ... force hinting for DynaLab fonts */ + unsigned char *ftdata; fz_matrix t3matrix; fz_obj *t3resources; diff --git a/fitz/res_font.c b/fitz/res_font.c index cfbb08bf..2fddcf2a 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -18,6 +18,7 @@ fz_newfont(void) font->ftface = nil; font->ftsubstitute = 0; font->fthint = 0; + font->ftdata = nil; font->t3matrix = fz_identity; font->t3resources = nil; @@ -71,6 +72,9 @@ fz_dropfont(fz_font *font) fz_finalizefreetype(); } + if (font->ftdata) + fz_free(font->ftdata); + if (font->widthtable) fz_free(font->widthtable); diff --git a/mupdf/mupdf.h b/mupdf/mupdf.h index 7b782071..9528221a 100644 --- a/mupdf/mupdf.h +++ b/mupdf/mupdf.h @@ -376,7 +376,6 @@ struct pdf_fontdesc_s int refs; fz_font *font; - unsigned char *buffer; /* contains allocated memory that should be freed */ /* FontDescriptor */ int flags; diff --git a/mupdf/pdf_font.c b/mupdf/pdf_font.c index 1a2e566d..a95a5dcd 100644 --- a/mupdf/pdf_font.c +++ b/mupdf/pdf_font.c @@ -162,8 +162,6 @@ pdf_dropfont(pdf_fontdesc *fontdesc) { if (fontdesc->font) fz_dropfont(fontdesc->font); - if (fontdesc->buffer) - fz_free(fontdesc->buffer); if (fontdesc->encoding) pdf_dropcmap(fontdesc->encoding); if (fontdesc->tottfcmap) @@ -187,7 +185,6 @@ pdf_newfontdesc(void) fontdesc->refs = 1; fontdesc->font = nil; - fontdesc->buffer = nil; fontdesc->flags = 0; fontdesc->italicangle = 0; diff --git a/mupdf/pdf_fontfile.c b/mupdf/pdf_fontfile.c index b0bf828a..df565bc8 100644 --- a/mupdf/pdf_fontfile.c +++ b/mupdf/pdf_fontfile.c @@ -284,7 +284,7 @@ pdf_loadembeddedfont(pdf_fontdesc *fontdesc, pdf_xref *xref, fz_obj *stmref) return fz_rethrow(error, "cannot load embedded font (%d %d R)", fz_tonum(stmref), fz_togen(stmref)); } - fontdesc->buffer = buf->data; /* save the buffer so we can free it later */ + fontdesc->font->ftdata = buf->data; /* save the buffer so we can free it later */ fz_free(buf); /* only free the fz_buffer struct, not the contained data */ fontdesc->isembedded = 1; |