cf0035c
From 38f883fe129a5e89306252a4676eaaf4bc968824 Mon Sep 17 00:00:00 2001
cf0035c
Message-Id: <38f883fe129a5e89306252a4676eaaf4bc968824.1542272532.git.mjg@fedoraproject.org>
cf0035c
From: Tor Andersson <tor.andersson@artifex.com>
cf0035c
Date: Mon, 22 Oct 2018 17:16:35 +0200
cf0035c
Subject: [PATCH] Fix text used as clip mask in pdfwrite device.
cf0035c
cf0035c
Push the clip state, and pass the correct text rendering mode state.
cf0035c
---
cf0035c
 source/pdf/pdf-device.c | 12 ++++++++++--
cf0035c
 1 file changed, 10 insertions(+), 2 deletions(-)
cf0035c
cf0035c
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
cf0035c
index 4dd729b8..427e3b38 100644
cf0035c
--- a/source/pdf/pdf-device.c
cf0035c
+++ b/source/pdf/pdf-device.c
cf0035c
@@ -734,9 +734,13 @@ pdf_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matri
cf0035c
 {
cf0035c
 	pdf_device *pdev = (pdf_device*)dev;
cf0035c
 	fz_text_span *span;
cf0035c
+
cf0035c
+	pdf_dev_end_text(ctx, pdev);
cf0035c
+	pdf_dev_push(ctx, pdev);
cf0035c
+
cf0035c
 	for (span = text->head; span; span = span->next)
cf0035c
 	{
cf0035c
-		pdf_dev_begin_text(ctx, pdev, span->trm, 0);
cf0035c
+		pdf_dev_begin_text(ctx, pdev, span->trm, 7);
cf0035c
 		pdf_dev_ctm(ctx, pdev, ctm);
cf0035c
 		pdf_dev_font(ctx, pdev, span->font);
cf0035c
 		pdf_dev_text_span(ctx, pdev, span);
cf0035c
@@ -748,9 +752,13 @@ pdf_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c
cf0035c
 {
cf0035c
 	pdf_device *pdev = (pdf_device*)dev;
cf0035c
 	fz_text_span *span;
cf0035c
+
cf0035c
+	pdf_dev_end_text(ctx, pdev);
cf0035c
+	pdf_dev_push(ctx, pdev);
cf0035c
+
cf0035c
 	for (span = text->head; span; span = span->next)
cf0035c
 	{
cf0035c
-		pdf_dev_begin_text(ctx, pdev, span->trm, 0);
cf0035c
+		pdf_dev_begin_text(ctx, pdev, span->trm, 7);
cf0035c
 		pdf_dev_font(ctx, pdev, span->font);
cf0035c
 		pdf_dev_ctm(ctx, pdev, ctm);
cf0035c
 		pdf_dev_text_span(ctx, pdev, span);
cf0035c
-- 
cf0035c
2.19.1.1238.g4b45f61cc0
cf0035c