diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-06-20 21:56:08 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-06-20 21:56:08 +0200 |
commit | b282908b5e1660cd44db89ddbe5ab9af03185295 (patch) | |
tree | 39b2e555358f1f433a1c957981122b1479a7bc32 | |
parent | 194ac682d758ef26a9958ef39c851974808f33d9 (diff) | |
download | mupdf-b282908b5e1660cd44db89ddbe5ab9af03185295.tar.xz |
Move font size check from interpreter to font rendering.
-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': |