summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-op-run.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-10-19 11:50:13 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-10-19 11:50:25 +0200
commit6444204a8cdc07e01ee63f843e8ef6f89f37c85d (patch)
treebaef56e5d3bb0ee4b0689bcac5ae521b860905f8 /source/pdf/pdf-op-run.c
parentee657bcce322d97869cf437caddf5d4c962ed217 (diff)
downloadmupdf-6444204a8cdc07e01ee63f843e8ef6f89f37c85d.tar.xz
Fix 695582: add knockout group for text that is both stroke and fill.
Diffstat (limited to 'source/pdf/pdf-op-run.c')
-rw-r--r--source/pdf/pdf-op-run.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c
index faed37a5..dbd9386d 100644
--- a/source/pdf/pdf-op-run.c
+++ b/source/pdf/pdf-op-run.c
@@ -722,6 +722,7 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr)
int doclip;
int doinvisible;
softmask_save softmask = { NULL };
+ int knockout_group = 0;
if (!pr->text)
return gstate;
@@ -749,6 +750,8 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr)
fz_rect tb = pr->text_bbox;
fz_transform_rect(&tb, &gstate->ctm);
+ if (dostroke)
+ fz_adjust_rect_for_stroke(ctx, &tb, gstate->stroke_state, &gstate->ctm);
/* Don't bother sending a text group with nothing in it */
if (text->len == 0)
@@ -757,6 +760,24 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr)
if (dofill || dostroke)
gstate = pdf_begin_group(ctx, pr, &tb, &softmask);
+ if (dofill && dostroke)
+ {
+ /* We may need to push a knockout group */
+ if (gstate->stroke.alpha == 0)
+ {
+ /* No need for group, as stroke won't do anything */
+ }
+ else if (gstate->stroke.alpha == 1.0f && gstate->blendmode == FZ_BLEND_NORMAL)
+ {
+ /* No need for group, as stroke won't show up */
+ }
+ else
+ {
+ knockout_group = 1;
+ fz_begin_group(ctx, pr->dev, &tb, 0, 1, FZ_BLEND_NORMAL, 1);
+ }
+ }
+
if (doinvisible)
fz_ignore_text(ctx, pr->dev, text, &gstate->ctm);
@@ -819,6 +840,9 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr)
}
}
+ if (knockout_group)
+ fz_end_group(ctx, pr->dev);
+
if (dofill || dostroke)
pdf_end_group(ctx, pr, &softmask);