mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 05:48:00 +02:00
[toy-font-face] Return defaults for error objects.
Similar to the behaviour of the other objects, we return the default conditions if the object is in any error (and not just a nil object).
This commit is contained in:
parent
d478d5ed5c
commit
65f9760d66
1 changed files with 24 additions and 4 deletions
|
|
@ -394,7 +394,12 @@ _cairo_font_face_is_toy (cairo_font_face_t *font_face)
|
|||
cairo_font_face_t *
|
||||
_cairo_toy_font_face_get_implementation (cairo_font_face_t *font_face)
|
||||
{
|
||||
cairo_toy_font_face_t *toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
cairo_toy_font_face_t *toy_font_face;
|
||||
|
||||
if (font_face->status)
|
||||
return NULL;
|
||||
|
||||
toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
if (! _cairo_font_face_is_toy (font_face)) {
|
||||
if (_cairo_font_face_set_error (font_face, CAIRO_STATUS_FONT_TYPE_MISMATCH))
|
||||
return NULL;
|
||||
|
|
@ -416,7 +421,12 @@ _cairo_toy_font_face_get_implementation (cairo_font_face_t *font_face)
|
|||
const char *
|
||||
cairo_toy_font_face_get_family (cairo_font_face_t *font_face)
|
||||
{
|
||||
cairo_toy_font_face_t *toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
cairo_toy_font_face_t *toy_font_face;
|
||||
|
||||
if (font_face->status)
|
||||
return CAIRO_FONT_FAMILY_DEFAULT;
|
||||
|
||||
toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
if (! _cairo_font_face_is_toy (font_face)) {
|
||||
if (_cairo_font_face_set_error (font_face, CAIRO_STATUS_FONT_TYPE_MISMATCH))
|
||||
return CAIRO_FONT_FAMILY_DEFAULT;
|
||||
|
|
@ -438,7 +448,12 @@ cairo_toy_font_face_get_family (cairo_font_face_t *font_face)
|
|||
cairo_font_slant_t
|
||||
cairo_toy_font_face_get_slant (cairo_font_face_t *font_face)
|
||||
{
|
||||
cairo_toy_font_face_t *toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
cairo_toy_font_face_t *toy_font_face;
|
||||
|
||||
if (font_face->status)
|
||||
return CAIRO_FONT_SLANT_DEFAULT;
|
||||
|
||||
toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
if (! _cairo_font_face_is_toy (font_face)) {
|
||||
if (_cairo_font_face_set_error (font_face, CAIRO_STATUS_FONT_TYPE_MISMATCH))
|
||||
return CAIRO_FONT_SLANT_DEFAULT;
|
||||
|
|
@ -460,7 +475,12 @@ slim_hidden_def (cairo_toy_font_face_get_slant);
|
|||
cairo_font_weight_t
|
||||
cairo_toy_font_face_get_weight (cairo_font_face_t *font_face)
|
||||
{
|
||||
cairo_toy_font_face_t *toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
cairo_toy_font_face_t *toy_font_face;
|
||||
|
||||
if (font_face->status)
|
||||
return CAIRO_FONT_WEIGHT_DEFAULT;
|
||||
|
||||
toy_font_face = (cairo_toy_font_face_t *) font_face;
|
||||
if (! _cairo_font_face_is_toy (font_face)) {
|
||||
if (_cairo_font_face_set_error (font_face, CAIRO_STATUS_FONT_TYPE_MISMATCH))
|
||||
return CAIRO_FONT_WEIGHT_DEFAULT;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue