Make sure we initialize all callbacks upon creation

Also fixes issue with unicode callbacks never being set really.
This commit is contained in:
Behdad Esfahbod 2010-05-24 17:50:19 +01:00
parent bf36a1074a
commit f97bf4f812
2 changed files with 9 additions and 18 deletions

View File

@ -75,14 +75,12 @@ hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
hb_font_funcs_t _hb_font_funcs_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
TRUE, /* immutable */
{
hb_font_get_glyph_nil,
hb_font_get_contour_point_nil,
hb_font_get_glyph_metrics_nil,
hb_font_get_kerning_nil
hb_font_get_glyph_nil,
hb_font_get_contour_point_nil,
hb_font_get_glyph_metrics_nil,
hb_font_get_kerning_nil
}
};
@ -94,6 +92,8 @@ hb_font_funcs_create (void)
if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
return &_hb_font_funcs_nil;
ffuncs->v = _hb_font_funcs_nil.v;
return ffuncs;
}
@ -125,11 +125,7 @@ hb_font_funcs_copy (hb_font_funcs_t *other_ffuncs)
if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
return &_hb_font_funcs_nil;
*ffuncs = *other_ffuncs;
/* re-init refcount */
HB_OBJECT_DO_INIT (ffuncs);
ffuncs->immutable = FALSE;
ffuncs->v = other_ffuncs->v;
return ffuncs;
}

View File

@ -40,9 +40,7 @@ static unsigned int hb_unicode_get_eastasian_width_nil (hb_codepoint_t unicode H
hb_unicode_funcs_t _hb_unicode_funcs_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
TRUE, /* immutable */
{
hb_unicode_get_general_category_nil,
hb_unicode_get_combining_class_nil,
@ -60,8 +58,7 @@ hb_unicode_funcs_create (void)
if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
return &_hb_unicode_funcs_nil;
*ufuncs = _hb_unicode_funcs_nil;
HB_OBJECT_DO_INIT (ufuncs);
ufuncs->v = _hb_unicode_funcs_nil.v;
return ufuncs;
}
@ -94,9 +91,7 @@ hb_unicode_funcs_copy (hb_unicode_funcs_t *other_ufuncs)
if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
return &_hb_unicode_funcs_nil;
*ufuncs = *other_ufuncs;
HB_OBJECT_DO_INIT (ufuncs);
ufuncs->immutable = FALSE;
ufuncs->v = other_ufuncs->v;
return ufuncs;
}