From 3fc3d8b8f03774dcd4159031b5085fdc4ab29719 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 9 Feb 2023 20:46:04 +1030 Subject: FT: Always use the outline glyph to get the path Trying to extract the path from a color recording does not work in all cases such as paths in groups. --- src/cairo-ft-font.c | 53 +++++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 75d6f8c16..22a6a622b 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -3408,7 +3408,6 @@ _cairo_ft_scaled_glyph_init (void *abstract_font, int load_flags = scaled_font->ft_options.load_flags; cairo_bool_t vertical_layout = FALSE; cairo_status_t status = CAIRO_STATUS_SUCCESS; - cairo_bool_t scaled_glyph_loaded = FALSE; cairo_ft_glyph_private_t *glyph_priv; int color_flag = 0; @@ -3528,46 +3527,20 @@ _cairo_ft_scaled_glyph_init (void *abstract_font, if (info & CAIRO_SCALED_GLYPH_INFO_PATH) { cairo_path_fixed_t *path = NULL; /* hide compiler warning */ - if (scaled_glyph->has_info & CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE) { - path = _cairo_path_fixed_create (); - if (!path) { - status = _cairo_error (CAIRO_STATUS_NO_MEMORY); - goto FAIL; - } - - status = _cairo_recording_surface_get_path (scaled_glyph->recording_surface, path); - if (unlikely (status)) { - _cairo_path_fixed_destroy (path); - goto FAIL; - } - - } else { - /* - * A kludge -- the above code will trash the outline, - * so reload it. This will probably never occur though - */ - if ((info & (CAIRO_SCALED_GLYPH_INFO_SURFACE | CAIRO_SCALED_GLYPH_INFO_COLOR_SURFACE)) != 0) { - scaled_glyph_loaded = FALSE; - load_flags |= FT_LOAD_NO_BITMAP; - } - - if (!scaled_glyph_loaded) { - status = _cairo_ft_scaled_glyph_load_glyph (scaled_font, - scaled_glyph, - face, - load_flags, - FALSE, - vertical_layout); - if (unlikely (status)) - goto FAIL; - } + /* Load non-color glyph */ + status = _cairo_ft_scaled_glyph_load_glyph (scaled_font, + scaled_glyph, + face, + load_flags, + FALSE, + vertical_layout); + if (unlikely (status)) + goto FAIL; - if (face->glyph->format == FT_GLYPH_FORMAT_OUTLINE) { - status = _cairo_ft_face_decompose_glyph_outline (face, &path); - } else { - status = CAIRO_INT_STATUS_UNSUPPORTED; - } - } + if (face->glyph->format == FT_GLYPH_FORMAT_OUTLINE) + status = _cairo_ft_face_decompose_glyph_outline (face, &path); + else + status = CAIRO_INT_STATUS_UNSUPPORTED; if (unlikely (status)) goto FAIL; -- cgit v1.2.1