summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-03-28 02:48:14 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-03-28 03:09:45 +0200
commit0a1f76ca178f8bc7b9ee5e6bf820f5ccffb9f97a (patch)
treecb40ba68e44580c1e815b926d7dd75c62eaf0948
parent65b33c4210b2ae49faf4f09f14d193ea769b5830 (diff)
downloadmupdf-0a1f76ca178f8bc7b9ee5e6bf820f5ccffb9f97a.tar.xz
Handle broken fonts with more grace.
-rw-r--r--mupdf/pdf_interpret.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mupdf/pdf_interpret.c b/mupdf/pdf_interpret.c
index db6ba214..c070163c 100644
--- a/mupdf/pdf_interpret.c
+++ b/mupdf/pdf_interpret.c
@@ -775,10 +775,14 @@ static void pdf_run_TL(pdf_csi *csi)
static fz_error pdf_run_Tf(pdf_csi *csi, fz_obj *rdb)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
+ pdf_fontdesc *font;
fz_obj *dict;
fz_obj *obj;
fz_error error;
+ gstate->size = csi->stack[0];
+ gstate->font = nil;
+
dict = fz_dictgets(rdb, "Font");
if (!dict)
return fz_throw("cannot find Font dictionary");
@@ -797,7 +801,6 @@ static fz_error pdf_run_Tf(pdf_csi *csi, fz_obj *rdb)
if (error)
return fz_rethrow(error, "cannot load font (%d 0 R)", fz_tonum(obj));
- gstate->size = csi->stack[0];
return fz_okay;
}
@@ -1202,7 +1205,7 @@ pdf_runkeyword(pdf_csi *csi, fz_obj *rdb, fz_stream *file, char *buf)
case B('T','f'):
error = pdf_run_Tf(csi, rdb);
if (error)
- return fz_rethrow(error, "cannot set font");
+ fz_catch(error, "cannot set font");
break;
case B('T','j'): pdf_run_Tj(csi); break;
case B('T','m'): pdf_run_Tm(csi); break;