From 10fffac83c576f5aeba7d804e39470b4a88b79dc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 30 Nov 2023 15:51:03 -0500 Subject: [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 --- src/cairo-pdf-surface.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- cgit v1.2.3