[cairo-commit] 2 commits - src/cairo-ft-font.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 11 04:18:20 UTC 2023


 src/cairo-ft-font.c |   53 ++++++++++++----------------------------------------
 1 file changed, 13 insertions(+), 40 deletions(-)

New commits:
commit 6b5519626c0f809a58f072e3b402963ec45f29ab
Merge: 7f6526e65 3fc3d8b8f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Feb 11 04:18:18 2023 +0000

    Merge branch 'ft-use-outline-glyph-for-path' into 'master'
    
    FT: Always use the outline glyph to get the path
    
    See merge request cairo/cairo!455

commit 3fc3d8b8f03774dcd4159031b5085fdc4ab29719
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu Feb 9 20:46:04 2023 +1030

    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.

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;


More information about the cairo-commit mailing list