[API] font: move user_data before destroy()

This is the common convention for language binding tools.
This commit is contained in:
Behdad Esfahbod 2011-04-20 03:03:32 -04:00
parent e5847f75fb
commit 5668189c12
4 changed files with 27 additions and 27 deletions

View File

@ -63,8 +63,8 @@ struct _hb_face_t {
hb_reference_count_t ref_count;
hb_get_table_func_t get_table;
hb_destroy_func_t destroy;
void *user_data;
hb_destroy_func_t destroy;
hb_blob_t *head_blob;
const struct head *head_table;
@ -87,8 +87,8 @@ struct _hb_font_t {
unsigned int y_ppem;
hb_font_funcs_t *klass;
hb_destroy_func_t destroy;
void *user_data;
hb_destroy_func_t destroy;
};

View File

@ -296,8 +296,8 @@ static hb_face_t _hb_face_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
NULL, /* get_table */
NULL, /* destroy */
NULL, /* user_data */
NULL, /* destroy */
NULL, /* head_blob */
NULL, /* head_table */
@ -308,8 +308,8 @@ static hb_face_t _hb_face_nil = {
hb_face_t *
hb_face_create_for_tables (hb_get_table_func_t get_table,
hb_destroy_func_t destroy,
void *user_data)
void *user_data,
hb_destroy_func_t destroy)
{
hb_face_t *face;
@ -320,8 +320,8 @@ hb_face_create_for_tables (hb_get_table_func_t get_table,
}
face->get_table = get_table;
face->destroy = destroy;
face->user_data = user_data;
face->destroy = destroy;
face->ot_layout = _hb_ot_layout_new (face);
@ -386,8 +386,8 @@ hb_face_create_for_data (hb_blob_t *blob,
return &_hb_face_nil;
return hb_face_create_for_tables (_hb_face_for_data_get_table,
(hb_destroy_func_t) _hb_face_for_data_closure_destroy,
closure);
closure,
(hb_destroy_func_t) _hb_face_for_data_closure_destroy);
}
@ -454,8 +454,8 @@ static hb_font_t _hb_font_nil = {
0, /* y_ppem */
NULL, /* klass */
NULL, /* destroy */
NULL /* user_data */
NULL, /* user_data */
NULL /* destroy */
};
hb_font_t *
@ -498,8 +498,8 @@ hb_font_destroy (hb_font_t *font)
void
hb_font_set_funcs (hb_font_t *font,
hb_font_funcs_t *klass,
hb_destroy_func_t destroy,
void *user_data)
void *user_data,
hb_destroy_func_t destroy)
{
if (HB_OBJECT_IS_INERT (font))
return;
@ -513,28 +513,28 @@ hb_font_set_funcs (hb_font_t *font,
hb_font_funcs_reference (klass);
hb_font_funcs_destroy (font->klass);
font->klass = klass;
font->destroy = destroy;
font->user_data = user_data;
font->destroy = destroy;
}
void
hb_font_unset_funcs (hb_font_t *font,
hb_font_funcs_t **klass,
hb_destroy_func_t *destroy,
void **user_data)
void **user_data,
hb_destroy_func_t *destroy)
{
/* None of the input arguments can be NULL. */
*klass = font->klass;
*destroy = font->destroy;
*user_data = font->user_data;
*destroy = font->destroy;
if (HB_OBJECT_IS_INERT (font))
return;
font->klass = NULL;
font->destroy = NULL;
font->user_data = NULL;
font->destroy = NULL;
}
void

View File

@ -49,8 +49,8 @@ typedef hb_blob_t * (*hb_get_table_func_t) (hb_tag_t tag, void *user_data);
/* calls destroy() when not needing user_data anymore */
hb_face_t *
hb_face_create_for_tables (hb_get_table_func_t get_table,
hb_destroy_func_t destroy,
void *user_data);
void *user_data,
hb_destroy_func_t destroy);
hb_face_t *
hb_face_reference (hb_face_t *face);
@ -218,8 +218,8 @@ hb_font_destroy (hb_font_t *font);
void
hb_font_set_funcs (hb_font_t *font,
hb_font_funcs_t *klass,
hb_destroy_func_t destroy,
void *user_data);
void *user_data,
hb_destroy_func_t destroy);
/* Returns what was set and unsets it, but doesn't destroy(user_data).
* This is useful for wrapping / chaining font_funcs_t's.
@ -234,8 +234,8 @@ hb_font_set_funcs (hb_font_t *font,
void
hb_font_unset_funcs (hb_font_t *font,
hb_font_funcs_t **klass,
hb_destroy_func_t *destroy,
void **user_data);
void **user_data,
hb_destroy_func_t *destroy);
/*

View File

@ -189,7 +189,7 @@ get_table (hb_tag_t tag, void *user_data)
return hb_blob_create ((const char *) buffer, length,
HB_MEMORY_MODE_WRITABLE,
free, buffer);
buffer, free);
}
@ -206,11 +206,11 @@ hb_ft_face_create (FT_Face ft_face,
(unsigned int) ft_face->stream->size,
/* TODO: Check FT_FACE_FLAG_EXTERNAL_STREAM? */
HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE,
destroy, ft_face);
ft_face, destroy);
face = hb_face_create_for_data (blob, ft_face->face_index);
hb_blob_destroy (blob);
} else {
face = hb_face_create_for_tables (get_table, destroy, ft_face);
face = hb_face_create_for_tables (get_table, ft_face, destroy);
}
return face;
@ -247,7 +247,7 @@ hb_ft_font_create (FT_Face ft_face,
font = hb_font_create ();
hb_font_set_funcs (font,
hb_ft_get_font_funcs (),
destroy, ft_face);
ft_face, destroy);
hb_font_set_scale (font,
((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM) >> 16,
((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM) >> 16);