[cairo-commit] Branch '1.8' - 2 commits - src/cairo-ft-font.c src/cairo-win32-font.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 10 05:05:29 PDT 2009


 src/cairo-ft-font.c    |    3 ++-
 src/cairo-win32-font.c |   10 ++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

New commits:
commit c21a9eecb0e1d383c0f4c8e554fbfac1daf0518b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 10 12:59:36 2009 +0100

    [win32-font] Non-fatal error from GetGlyphOutlineW(GGO_METRICS)
    
    If GetGlyphOutlineW(GGO_METRICS) fails to retreive the metrics for the
    specified glyph it returns GDI_ERROR. Like ft, do not interpret this as a
    fatal error but just mark the glyph as empty.
    
    Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20255
    Bug 20255 -- cairo_scaled_font_glyph_extents breaks with invalid glyph id

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 67ddf68..a9a9353 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -984,12 +984,9 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f
 	if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
 			      GGO_METRICS | GGO_GLYPH_INDEX,
 			      &metrics, 0, NULL, &matrix) == GDI_ERROR) {
-	  status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
-	  memset (&metrics, 0, sizeof (GLYPHMETRICS));
+	    memset (&metrics, 0, sizeof (GLYPHMETRICS));
 	}
 	cairo_win32_scaled_font_done_font (&scaled_font->base);
-	if (status)
-	    return status;
 
 	if (scaled_font->swap_axes) {
 	    extents.x_bearing = - metrics.gmptGlyphOrigin.y / scaled_font->y_scale;
@@ -1028,12 +1025,9 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f
 	if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
 	                      GGO_METRICS | GGO_GLYPH_INDEX,
 			      &metrics, 0, NULL, &matrix) == GDI_ERROR) {
-	  status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
-	  memset (&metrics, 0, sizeof (GLYPHMETRICS));
+	    memset (&metrics, 0, sizeof (GLYPHMETRICS));
 	}
 	_cairo_win32_scaled_font_done_unscaled_font (&scaled_font->base);
-	if (status)
-	    return status;
 
 	extents.x_bearing = (double)metrics.gmptGlyphOrigin.x / scaled_font->em_square;
 	extents.y_bearing = - (double)metrics.gmptGlyphOrigin.y / scaled_font->em_square;
commit 2fd0beab2a7a2945ccf9641594414893266e649d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 3 20:28:49 2009 +0100

    [ft] Don't call FT_Done_Face() on a face we do not own
    
    _font_map_release_face_lock_held() was being called unconditionally during
    _cairo_ft_font_reset_static_data(). This presents two problems. The first
    is that we call FT_Done_Face() on an object not owned by cairo, and the
    second is that the bookkeeping is then incorrect which will trigger an
    assert later.

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 19bfe46..0b1e624 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -233,7 +233,8 @@ _cairo_ft_unscaled_font_map_destroy (void)
 	    _cairo_hash_table_remove (font_map->hash_table,
 				      &unscaled->base.hash_entry);
 
-	    _font_map_release_face_lock_held (font_map, unscaled);
+	    if (! unscaled->from_face)
+		_font_map_release_face_lock_held (font_map, unscaled);
 	    _cairo_ft_unscaled_font_fini (unscaled);
 	    free (unscaled);
 	}


More information about the cairo-commit mailing list