Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetype

This commit is contained in:
Adrian Johnson 2016-03-26 21:45:33 +10:30
parent 8f6790123e
commit cdd5c92ced
12 changed files with 20 additions and 2 deletions

View file

@ -160,6 +160,7 @@ _cairo_device_create_in_error (cairo_status_t status)
case CAIRO_STATUS_DEVICE_FINISHED:
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_device_t *) &_nil_device;

View file

@ -95,6 +95,7 @@ enum _cairo_int_status {
CAIRO_INT_STATUS_DEVICE_FINISHED,
CAIRO_INT_STATUS_JBIG2_GLOBAL_MISSING,
CAIRO_INT_STATUS_PNG_ERROR,
CAIRO_INT_STATUS_FREETYPE_ERROR,
CAIRO_INT_STATUS_LAST_STATUS,

View file

@ -223,7 +223,10 @@ _ft_to_cairo_error (FT_Error error)
* Populate as needed. */
switch (error)
{
default: return CAIRO_STATUS_NO_MEMORY;
case FT_Err_Out_Of_Memory:
return CAIRO_STATUS_NO_MEMORY;
default:
return CAIRO_STATUS_FREETYPE_ERROR;
}
}

View file

@ -160,6 +160,8 @@ cairo_status_to_string (cairo_status_t status)
return "CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID used but no CAIRO_MIME_TYPE_JBIG2_GLOBAL data provided";
case CAIRO_STATUS_PNG_ERROR:
return "error occurred in libpng while reading from or writing to a PNG file";
case CAIRO_STATUS_FREETYPE_ERROR:
return "error occurred in libfreetype";
default:
case CAIRO_STATUS_LAST_STATUS:
return "<unknown error status>";

View file

@ -108,6 +108,7 @@ _cairo_region_create_in_error (cairo_status_t status)
case CAIRO_STATUS_DEVICE_FINISHED:
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_region_t *) &_cairo_region_nil;

View file

@ -129,6 +129,7 @@ _cairo_scan_converter_create_in_error (cairo_status_t status)
case CAIRO_STATUS_DEVICE_FINISHED: RETURN_NIL;
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
default:
break;
}
@ -243,6 +244,7 @@ _cairo_span_renderer_create_in_error (cairo_status_t status)
case CAIRO_STATUS_DEVICE_FINISHED: RETURN_NIL;
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING: RETURN_NIL;
case CAIRO_STATUS_PNG_ERROR: RETURN_NIL;
case CAIRO_STATUS_FREETYPE_ERROR: RETURN_NIL;
default:
break;
}

View file

@ -2726,6 +2726,7 @@ _cairo_surface_create_in_error (cairo_status_t status)
case CAIRO_STATUS_DEVICE_FINISHED:
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t *) &_cairo_surface_nil;

View file

@ -154,7 +154,8 @@ static const cairo_t _cairo_nil[] = {
DEFINE_NIL_CONTEXT (CAIRO_STATUS_INVALID_MESH_CONSTRUCTION),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_DEVICE_FINISHED),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_JBIG2_GLOBAL_MISSING),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_PNG_ERROR)
DEFINE_NIL_CONTEXT (CAIRO_STATUS_PNG_ERROR),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_FREETYPE_ERROR)
};
COMPILE_TIME_ASSERT (ARRAY_LENGTH (_cairo_nil) == CAIRO_STATUS_LAST_STATUS - 1);

View file

@ -293,6 +293,7 @@ typedef struct _cairo_user_data_key {
* @CAIRO_STATUS_JBIG2_GLOBAL_MISSING: %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID has been used on at least one image
* but no image provided %CAIRO_MIME_TYPE_JBIG2_GLOBAL (Since 1.14)
* @CAIRO_STATUS_PNG_ERROR: error occurred in libpng while reading from or writing to a PNG file (Since 1.16)
* @CAIRO_STATUS_FREETYPE_ERROR: error occurred in libfreetype (Since 1.16)
* @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of
* status values defined in this enumeration. When using this value, note
* that the version of cairo at run-time may have additional status values
@ -350,6 +351,7 @@ typedef enum _cairo_status {
CAIRO_STATUS_DEVICE_FINISHED,
CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
CAIRO_STATUS_PNG_ERROR,
CAIRO_STATUS_FREETYPE_ERROR,
CAIRO_STATUS_LAST_STATUS
} cairo_status_t;

View file

@ -53,6 +53,7 @@ cairo_gobject_status_get_type (void)
{ CAIRO_STATUS_DEVICE_FINISHED, "CAIRO_STATUS_DEVICE_FINISHED", "device-finished" },
{ CAIRO_STATUS_JBIG2_GLOBAL_MISSING, "CAIRO_STATUS_JBIG2_GLOBAL_MISSING", "jbig2-global_missing" },
{ CAIRO_STATUS_PNG_ERROR, "CAIRO_STATUS_PNG_ERROR", "png-error" },
{ CAIRO_STATUS_FREETYPE_ERROR, "CAIRO_STATUS_FREETYPE_ERROR", "freetype-error" },
{ CAIRO_STATUS_LAST_STATUS, "CAIRO_STATUS_LAST_STATUS", "last-status" },
{ 0, NULL, NULL }
};

View file

@ -227,6 +227,8 @@ typedef enum _csi_status {
CSI_STATUS_DEVICE_FINISHED = CAIRO_STATUS_DEVICE_FINISHED,
CSI_STATUS_JBIG2_GLOBAL_MISSING = CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
CSI_STATUS_PNG_ERROR = CAIRO_STATUS_PNG_ERROR,
CSI_STATUS_FREETYPE_ERROR = CAIRO_STATUS_FREETYPE_ERROR,
/* cairo-script-interpreter specific errors */

View file

@ -1583,6 +1583,7 @@ _status_to_string (cairo_status_t status)
f(DEVICE_FINISHED);
f(JBIG2_GLOBAL_MISSING);
f(PNG_ERROR);
f(FREETYPE_ERROR);
case CAIRO_STATUS_LAST_STATUS:
break;
}