diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-09-11 19:29:42 -0500 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-09-14 17:44:13 +0100 |
commit | 89ae81f651bfa112b8e07317eb6983beaf7cb212 (patch) | |
tree | 3f99dad1253b795629e66d45b915c1d72043242b /fitz/res_font.c | |
parent | cefb81f1886685580a40b17b5e495a8a8a1ebeaf (diff) | |
download | mupdf-89ae81f651bfa112b8e07317eb6983beaf7cb212.tar.xz |
Initial import of exception handling code
Import exception handling code from WSS, modified to fit into the
fitz world.
With this code we have 'real' fz_try/fz_catch/fz_rethrow functions,
handling a fz_except type. We therefore rename the existing fz_throw/
fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note.
We don't actually use fz_try/fz_catch/fz_rethrow yet...
Diffstat (limited to 'fitz/res_font.c')
-rw-r--r-- | fitz/res_font.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c index ffee1d46..c78b5995 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -150,7 +150,7 @@ fz_init_freetype(void) fterr = FT_Init_FreeType(&fz_ftlib); if (fterr) - return fz_throw("cannot init freetype: %s", ft_error_string(fterr)); + return fz_error_make("cannot init freetype: %s", ft_error_string(fterr)); FT_Library_Version(fz_ftlib, &maj, &min, &pat); if (maj == 2 && min == 1 && pat < 7) @@ -158,7 +158,7 @@ fz_init_freetype(void) fterr = FT_Done_FreeType(fz_ftlib); if (fterr) fz_warn("freetype finalizing: %s", ft_error_string(fterr)); - return fz_throw("freetype version too old: %d.%d.%d", maj, min, pat); + return fz_error_make("freetype version too old: %d.%d.%d", maj, min, pat); } fz_ftlib_refs++; @@ -189,11 +189,11 @@ fz_new_font_from_file(fz_font **fontp, char *path, int index) error = fz_init_freetype(); if (error) - return fz_rethrow(error, "cannot init freetype library"); + return fz_error_note(error, "cannot init freetype library"); fterr = FT_New_Face(fz_ftlib, path, index, &face); if (fterr) - return fz_throw("freetype: cannot load font: %s", ft_error_string(fterr)); + return fz_error_make("freetype: cannot load font: %s", ft_error_string(fterr)); font = fz_new_font(face->family_name); font->ft_face = face; @@ -216,11 +216,11 @@ fz_new_font_from_memory(fz_font **fontp, unsigned char *data, int len, int index error = fz_init_freetype(); if (error) - return fz_rethrow(error, "cannot init freetype library"); + return fz_error_note(error, "cannot init freetype library"); fterr = FT_New_Memory_Face(fz_ftlib, data, len, index, &face); if (fterr) - return fz_throw("freetype: cannot load font: %s", ft_error_string(fterr)); + return fz_error_make("freetype: cannot load font: %s", ft_error_string(fterr)); font = fz_new_font(face->family_name); font->ft_face = face; @@ -534,7 +534,7 @@ fz_render_t3_glyph(fz_font *font, int gid, fz_matrix trm, fz_colorspace *model) dev = fz_new_bbox_device(&bbox); error = font->t3run(font->t3xref, font->t3resources, contents, dev, ctm); if (error) - fz_catch(error, "cannot draw type3 glyph"); + fz_error_handle(error, "cannot draw type3 glyph"); if (dev->flags & FZ_CHARPROC_MASK) { @@ -567,7 +567,7 @@ fz_render_t3_glyph(fz_font *font, int gid, fz_matrix trm, fz_colorspace *model) dev = fz_new_draw_device_type3(cache, glyph); error = font->t3run(font->t3xref, font->t3resources, contents, dev, ctm); if (error) - fz_catch(error, "cannot draw type3 glyph"); + fz_error_handle(error, "cannot draw type3 glyph"); fz_free_device(dev); fz_free_glyph_cache(cache); |