From 3bf8379408ce9b1e08d130bcd1076766e36f1bef Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 14 Nov 2008 09:50:29 +0000 Subject: [PATCH] [type1] Propagate fatal NO_MEMORY erro from FreeType. If FreeType fails to load the glyph, check for a fatal error before falling back (and effectively masking the fatal condition). --- src/cairo-type1-subset.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c index bbff33d92..e55575854 100644 --- a/src/cairo-type1-subset.c +++ b/src/cairo-type1-subset.c @@ -553,14 +553,24 @@ cairo_type1_font_subset_get_glyph_names_and_widths (cairo_type1_font_subset_t *f error = FT_Load_Glyph (font->face, i, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM); - if (error != 0) + if (error != FT_Err_Ok) { + /* propagate fatal errors from FreeType */ + if (error == FT_Err_Out_Of_Memory) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_INT_STATUS_UNSUPPORTED; + } font->glyphs[i].width = font->face->glyph->metrics.horiAdvance; error = FT_Get_Glyph_Name(font->face, i, buffer, sizeof buffer); - if (error != 0) + if (error != FT_Err_Ok) { + /* propagate fatal errors from FreeType */ + if (error == FT_Err_Out_Of_Memory) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_INT_STATUS_UNSUPPORTED; + } font->glyphs[i].name = strdup (buffer); if (font->glyphs[i].name == NULL)