summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2023-11-30 15:51:03 -0500
committerBehdad Esfahbod <behdad@behdad.org>2023-11-30 21:54:07 -0500
commit10fffac83c576f5aeba7d804e39470b4a88b79dc (patch)
tree01b4967bdd0a8882f6de9cc77acfeba8fdb90898
parentf9358f26b851132248806da105341bbab415ba46 (diff)
[pdf] Set both fill and stroke colors in show_text_glyphs
Since a user-font might be calling stroke, and PDF has separate stroke and fill colors. Note that this bug was not exposed in Poppler. It's probably a bug there. But multiple other viewers expoed this bug. Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/813
-rw-r--r--src/cairo-pdf-surface.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 50f4daa57..713880703 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -52,6 +52,7 @@
#include "cairo-composite-rectangles-private.h"
#include "cairo-default-context-private.h"
#include "cairo-error-private.h"
+#include "cairo-user-font-private.h"
#include "cairo-image-surface-inline.h"
#include "cairo-image-info-private.h"
#include "cairo-recording-surface-inline.h"
@@ -9297,6 +9298,13 @@ _cairo_pdf_surface_show_text_glyphs (void *abstract_surface,
if (unlikely (status))
goto cleanup;
+ /* User-fonts can use strokes; reset the stroke pattern as well. */
+ if (_cairo_font_face_is_user(scaled_font->font_face)) {
+ status = _cairo_pdf_surface_select_pattern (surface, source, pattern_res, TRUE);
+ if (unlikely (status))
+ goto cleanup;
+ }
+
/* Each call to show_glyphs() with a transclucent pattern must
* be in a separate text object otherwise overlapping text
* from separate calls to show_glyphs will not composite with