[cairo-ft-font] Ignore FT_Load_Glyph errors other than out-of-memory

Same for FT_Render_Glyph.

When the user asks us to render a glyph that is not available in the font,
it's mostly an unavoidable kind of error for them, as in, they can't
avoid such a call.  So it's not nice to put cairo_t in an error state and
refuse any further drawying.

Many PDF files are created using buggy software and cause such glpyh-not-found
errors for CID 0 for example.

Eventually we should propagate these kind of errors up and return it from
the function call causing it, but that needs API change to add return value
to all text functions, so for now we just ignore these errors.
This commit is contained in:
Behdad Esfahbod 2007-09-12 17:45:11 -04:00
parent 21ab44f11d
commit 79d975f84b

View file

@ -1092,7 +1092,9 @@ _render_glyph_bitmap (FT_Face face,
* we avoid the FT_LOAD_NO_RECURSE flag.
*/
error = FT_Render_Glyph (glyphslot, FT_RENDER_MODE_NORMAL);
if (error) {
/* XXX ignoring all other errors for now. They are not fatal, typically
* just a glyph-not-found. */
if (error == FT_Err_Out_Of_Memory) {
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return CAIRO_STATUS_NO_MEMORY;
}
@ -1887,8 +1889,9 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
error = FT_Load_Glyph (scaled_font->unscaled->face,
_cairo_scaled_glyph_index(scaled_glyph),
load_flags);
if (error) {
/* XXX ignoring all other errors for now. They are not fatal, typically
* just a glyph-not-found. */
if (error == FT_Err_Out_Of_Memory) {
status = CAIRO_STATUS_NO_MEMORY;
goto FAIL;
}
@ -2038,8 +2041,9 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
error = FT_Load_Glyph (face,
_cairo_scaled_glyph_index(scaled_glyph),
load_flags | FT_LOAD_NO_BITMAP);
if (error) {
/* XXX ignoring all other errors for now. They are not fatal, typically
* just a glyph-not-found. */
if (error == FT_Err_Out_Of_Memory) {
_cairo_ft_unscaled_font_unlock_face (unscaled);
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return CAIRO_STATUS_NO_MEMORY;