summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2007-09-12 17:45:11 -0400
committerCarl Worth <cworth@cworth.org>2007-11-26 21:24:41 -0800
commit1ea1fadf7ec53fcd27b8ed8acd655d913e72e091 (patch)
tree57215e0177b566eb639640d866f7b9db3138b5b3
parent57bc62a61e6f2dd36c5680d3f486791a968f33ac (diff)
[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. (cherry picked from commit 79d975f84bcc32e91db517d71a7312e2e1d653d4)
-rw-r--r--src/cairo-ft-font.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 69e35d25e..d8bb64ac6 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1091,7 +1091,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;
}
@@ -1885,8 +1887,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;
}
@@ -2036,8 +2039,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;