diff options
-rw-r--r-- | draw/glyphcache.c | 9 | ||||
-rw-r--r-- | mupdf/pdf_interpret.c | 11 |
2 files changed, 10 insertions, 10 deletions
diff --git a/draw/glyphcache.c b/draw/glyphcache.c index ac148340..0f8abf75 100644 --- a/draw/glyphcache.c +++ b/draw/glyphcache.c @@ -1,5 +1,6 @@ #include "fitz.h" +#define MAXFONTSIZE 1000 #define MAXGLYPHSIZE 256 #define MAXCACHESIZE (1024*1024) @@ -67,6 +68,14 @@ fz_renderglyph(fz_glyphcache *cache, fz_font *font, int cid, fz_matrix ctm) { fz_glyphkey key; fz_pixmap *val; + float size = fz_matrixexpansion(ctm); + + if (size > MAXFONTSIZE) + { + /* TODO: this case should be handled by rendering glyph as a path fill */ + fz_warn("font size too large (%g), not rendering glyph", size); + return nil; + } key.font = font; key.cid = cid; diff --git a/mupdf/pdf_interpret.c b/mupdf/pdf_interpret.c index c59ba014..8ee794cd 100644 --- a/mupdf/pdf_interpret.c +++ b/mupdf/pdf_interpret.c @@ -864,16 +864,7 @@ Lsetcolor: return fz_rethrow(error, "cannot load font (%d %d R)", fz_tonum(obj), fz_togen(obj)); gstate->size = fz_toreal(csi->stack[1]); - if (gstate->size < -1000) - { - gstate->size = -1000; - fz_warn("font size too large, capping to %g", gstate->size); - } - if (gstate->size > 1000) - { - gstate->size = 1000; - fz_warn("font size too large, capping to %g", gstate->size); - } + break; } case 'r': |