svg-font: return SVG_FONT_ERROR on error

This commit is contained in:
Adrian Johnson 2023-01-20 20:37:45 +10:30
parent 2c557d7cea
commit cbcf962da2
12 changed files with 14 additions and 5 deletions

View file

@ -405,6 +405,7 @@ _cairo_debug_status_to_string (cairo_int_status_t status)
case CAIRO_INT_STATUS_WIN32_GDI_ERROR: return "WIN32_GDI_ERROR";
case CAIRO_INT_STATUS_TAG_ERROR: return "TAG_ERROR";
case CAIRO_INT_STATUS_DWRITE_ERROR: return "DWRITE_ERROR";
case CAIRO_INT_STATUS_SVG_FONT_ERROR: return "SVG_FONT_ERROR";
case CAIRO_INT_STATUS_LAST_STATUS: return "LAST_STATUS";

View file

@ -164,6 +164,7 @@ _cairo_device_create_in_error (cairo_status_t status)
case CAIRO_STATUS_WIN32_GDI_ERROR:
case CAIRO_STATUS_TAG_ERROR:
case CAIRO_STATUS_DWRITE_ERROR:
case CAIRO_STATUS_SVG_FONT_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_device_t *) &_nil_device;

View file

@ -99,6 +99,7 @@ enum _cairo_int_status {
CAIRO_INT_STATUS_WIN32_GDI_ERROR,
CAIRO_INT_STATUS_TAG_ERROR,
CAIRO_INT_STATUS_DWRITE_ERROR,
CAIRO_INT_STATUS_SVG_FONT_ERROR,
CAIRO_INT_STATUS_LAST_STATUS,

View file

@ -2982,9 +2982,6 @@ _cairo_ft_scaled_glyph_init_record_svg_glyph (cairo_ft_scaled_font_t *scaled_fon
palette,
num_palette_entries,
cr);
if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED)
status = CAIRO_INT_STATUS_UNSUPPORTED;
if (status == CAIRO_STATUS_SUCCESS)
status = cairo_status (cr);
}

View file

@ -176,6 +176,8 @@ cairo_status_to_string (cairo_status_t status)
return "invalid tag name, attributes, or nesting";
case CAIRO_STATUS_DWRITE_ERROR:
return "Window Direct Write error";
case CAIRO_STATUS_SVG_FONT_ERROR:
return "error occured while rendering an OpenType-SVG font";
default:
case CAIRO_STATUS_LAST_STATUS:
return "<unknown error status>";

View file

@ -112,6 +112,7 @@ _cairo_region_create_in_error (cairo_status_t status)
case CAIRO_STATUS_WIN32_GDI_ERROR:
case CAIRO_STATUS_TAG_ERROR:
case CAIRO_STATUS_DWRITE_ERROR:
case CAIRO_STATUS_SVG_FONT_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_region_t *) &_cairo_region_nil;

View file

@ -133,6 +133,7 @@ _cairo_scan_converter_create_in_error (cairo_status_t status)
case CAIRO_STATUS_WIN32_GDI_ERROR:
case CAIRO_STATUS_TAG_ERROR:
case CAIRO_STATUS_DWRITE_ERROR:
case CAIRO_STATUS_SVG_FONT_ERROR:
default:
break;
}
@ -251,6 +252,7 @@ _cairo_span_renderer_create_in_error (cairo_status_t status)
case CAIRO_STATUS_WIN32_GDI_ERROR: RETURN_NIL;
case CAIRO_STATUS_TAG_ERROR: RETURN_NIL;
case CAIRO_STATUS_DWRITE_ERROR: RETURN_NIL;
case CAIRO_STATUS_SVG_FONT_ERROR: RETURN_NIL;
default:
break;
}

View file

@ -3151,6 +3151,7 @@ _cairo_surface_create_in_error (cairo_status_t status)
case CAIRO_STATUS_WIN32_GDI_ERROR:
case CAIRO_INT_STATUS_DWRITE_ERROR:
case CAIRO_STATUS_TAG_ERROR:
case CAIRO_STATUS_SVG_FONT_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t *) &_cairo_surface_nil;

View file

@ -3141,7 +3141,7 @@ _cairo_render_svg_glyph (const char *svg_document,
/* First parse elements into a tree and populate ids hash table */
if (!parse_svg (svg_render, svg_document)) {
print_error (svg_render, "Parse SVG document failed");
status = CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED;
status = CAIRO_STATUS_SVG_FONT_ERROR;
goto cleanup;
}

View file

@ -372,7 +372,8 @@ static const cairo_t _cairo_nil[] = {
DEFINE_NIL_CONTEXT (CAIRO_STATUS_FREETYPE_ERROR),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_WIN32_GDI_ERROR),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_TAG_ERROR),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_DWRITE_ERROR)
DEFINE_NIL_CONTEXT (CAIRO_STATUS_DWRITE_ERROR),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_SVG_FONT_ERROR)
};
COMPILE_TIME_ASSERT (ARRAY_LENGTH (_cairo_nil) == CAIRO_STATUS_LAST_STATUS - 1);

View file

@ -358,6 +358,7 @@ typedef enum _cairo_status {
CAIRO_STATUS_WIN32_GDI_ERROR,
CAIRO_STATUS_TAG_ERROR,
CAIRO_STATUS_DWRITE_ERROR,
CAIRO_STATUS_SVG_FONT_ERROR,
CAIRO_STATUS_LAST_STATUS
} cairo_status_t;

View file

@ -1600,6 +1600,7 @@ _status_to_string (cairo_status_t status)
f(WIN32_GDI_ERROR);
f(TAG_ERROR);
f(DWRITE_ERROR);
f(SVG_FONT_ERROR);
case CAIRO_STATUS_LAST_STATUS:
break;
}