[font-face] Use cairo_font_face_t instead of toy, for nil objects

And with a NULL backend.  We are not supposed to read the nil objects
afterall.

If this causes crashes, the crash site should be fixed.
This commit is contained in:
Behdad Esfahbod 2008-12-19 20:46:36 -05:00
parent e3675f8ac0
commit 8bf49b27ae
2 changed files with 11 additions and 46 deletions

View file

@ -45,79 +45,44 @@ static const cairo_font_face_backend_t _cairo_toy_font_face_backend;
/* #cairo_font_face_t */
const cairo_toy_font_face_t _cairo_font_face_nil = {
{
const cairo_font_face_t _cairo_font_face_nil = {
{ 0 }, /* hash_entry */
CAIRO_STATUS_NO_MEMORY, /* status */
CAIRO_REFERENCE_COUNT_INVALID, /* ref_count */
{ 0, 0, 0, NULL }, /* user_data */
&_cairo_toy_font_face_backend
},
CAIRO_FONT_FAMILY_DEFAULT, /* family */
TRUE, /* owns_family */
CAIRO_FONT_SLANT_DEFAULT, /* slant */
CAIRO_FONT_WEIGHT_DEFAULT, /* weight */
NULL /* impl_face */
NULL
};
static const cairo_toy_font_face_t _cairo_font_face_null_pointer = {
{
static const cairo_font_face_t _cairo_font_face_null_pointer = {
{ 0 }, /* hash_entry */
CAIRO_STATUS_NULL_POINTER, /* status */
CAIRO_REFERENCE_COUNT_INVALID, /* ref_count */
{ 0, 0, 0, NULL }, /* user_data */
&_cairo_toy_font_face_backend
},
CAIRO_FONT_FAMILY_DEFAULT, /* family */
TRUE, /* owns_family */
CAIRO_FONT_SLANT_DEFAULT, /* slant */
CAIRO_FONT_WEIGHT_DEFAULT, /* weight */
NULL /* impl_face */
NULL
};
static const cairo_toy_font_face_t _cairo_font_face_invalid_string = {
{
static const cairo_font_face_t _cairo_font_face_invalid_string = {
{ 0 }, /* hash_entry */
CAIRO_STATUS_INVALID_STRING, /* status */
CAIRO_REFERENCE_COUNT_INVALID, /* ref_count */
{ 0, 0, 0, NULL }, /* user_data */
&_cairo_toy_font_face_backend
},
CAIRO_FONT_FAMILY_DEFAULT, /* family */
TRUE, /* owns_family */
CAIRO_FONT_SLANT_DEFAULT, /* slant */
CAIRO_FONT_WEIGHT_DEFAULT, /* weight */
NULL /* impl_face */
NULL
};
static const cairo_toy_font_face_t _cairo_font_face_invalid_slant = {
{
static const cairo_font_face_t _cairo_font_face_invalid_slant = {
{ 0 }, /* hash_entry */
CAIRO_STATUS_INVALID_SLANT, /* status */
CAIRO_REFERENCE_COUNT_INVALID, /* ref_count */
{ 0, 0, 0, NULL }, /* user_data */
&_cairo_toy_font_face_backend
},
CAIRO_FONT_FAMILY_DEFAULT, /* family */
TRUE, /* owns_family */
CAIRO_FONT_SLANT_DEFAULT, /* slant */
CAIRO_FONT_WEIGHT_DEFAULT, /* weight */
NULL /* impl_face */
NULL
};
static const cairo_toy_font_face_t _cairo_font_face_invalid_weight = {
{
static const cairo_font_face_t _cairo_font_face_invalid_weight = {
{ 0 }, /* hash_entry */
CAIRO_STATUS_INVALID_WEIGHT, /* status */
CAIRO_REFERENCE_COUNT_INVALID, /* ref_count */
{ 0, 0, 0, NULL }, /* user_data */
&_cairo_toy_font_face_backend
},
CAIRO_FONT_FAMILY_DEFAULT, /* family */
TRUE, /* owns_family */
CAIRO_FONT_SLANT_DEFAULT, /* slant */
CAIRO_FONT_WEIGHT_DEFAULT, /* weight */
NULL /* impl_face */
NULL
};
cairo_status_t

View file

@ -1368,7 +1368,7 @@ _cairo_color_equal (const cairo_color_t *color_a,
/* cairo-font-face.c */
extern const cairo_private cairo_toy_font_face_t _cairo_font_face_nil;
extern const cairo_private cairo_font_face_t _cairo_font_face_nil;
cairo_private void
_cairo_font_face_init (cairo_font_face_t *font_face,