[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
This commit is contained in:
Behdad Esfahbod 2023-11-30 15:51:03 -05:00
parent f9358f26b8
commit 10fffac83c

View file

@ -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