Skip to content

Commit

Permalink
[type1] Propagate fatal NO_MEMORY erro from FreeType.
Browse files Browse the repository at this point in the history
If FreeType fails to load the glyph, check for a fatal error before
falling back (and effectively masking the fatal condition).
  • Loading branch information
Chris Wilson committed Nov 16, 2008
1 parent db9ed77 commit 3bf8379
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/cairo-type1-subset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3bf8379

Please sign in to comment.