diff options
author | Robin Watts <robin.watts@artifex.com> | 2017-11-14 12:36:41 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-11-14 15:13:48 +0000 |
commit | 56864bf8a93b996cde3b6212e0f8e543032096ba (patch) | |
tree | da28800eb12b2f33ff3caa1dac6de1965c4d958f | |
parent | 8e540356340df6c4b1ba332c112045726da263d1 (diff) | |
download | mupdf-56864bf8a93b996cde3b6212e0f8e543032096ba.tar.xz |
Ensure that after_text functions get ctm.
Also wrap their contents in q/Q, so they can't screw up the
rest of the stream.
-rw-r--r-- | include/mupdf/pdf/interpret.h | 2 | ||||
-rw-r--r-- | source/pdf/pdf-op-filter.c | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/include/mupdf/pdf/interpret.h b/include/mupdf/pdf/interpret.h index f7104499..cbe1d665 100644 --- a/include/mupdf/pdf/interpret.h +++ b/include/mupdf/pdf/interpret.h @@ -248,7 +248,7 @@ pdf_processor *pdf_new_filter_processor(fz_context *ctx, pdf_document *doc, pdf_ typedef int (pdf_text_filter_fn)(fz_context *ctx, void *opaque, int *ucsbuf, int ucslen, fz_matrix *trm, fz_rect *bbox); -typedef void (pdf_after_text_object_fn)(fz_context *ctx, void *opaque, pdf_document *doc, pdf_processor *chain); +typedef void (pdf_after_text_object_fn)(fz_context *ctx, void *opaque, pdf_document *doc, pdf_processor *chain, const fz_matrix *ctm); /* pdf_new_filter_processor_with_text_filter: Create a filter diff --git a/source/pdf/pdf-op-filter.c b/source/pdf/pdf-op-filter.c index b69f51ac..c3f64b3f 100644 --- a/source/pdf/pdf-op-filter.c +++ b/source/pdf/pdf-op-filter.c @@ -1035,7 +1035,16 @@ pdf_filter_ET(fz_context *ctx, pdf_processor *proc) if (p->chain->op_ET) p->chain->op_ET(ctx, p->chain); if (p->after_text) - p->after_text(ctx, p->opaque, p->doc, p->chain); + { + fz_matrix ctm; + + fz_concat(&ctm, &p->gstate->sent.ctm, &p->gstate->pending.ctm); + if (p->chain->op_q) + p->chain->op_q(ctx, p->chain); + p->after_text(ctx, p->opaque, p->doc, p->chain, &ctm); + if (p->chain->op_Q) + p->chain->op_Q(ctx, p->chain); + } } /* text state */ |