[API] font: move user_data before destroy()
This is the common convention for language binding tools.
diff --git a/src/hb-font-private.h b/src/hb-font-private.h
index b147bce..46686b7 100644
--- a/src/hb-font-private.h
+++ b/src/hb-font-private.h
@@ -63,8 +63,8 @@
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 @@
unsigned int y_ppem;
hb_font_funcs_t *klass;
- hb_destroy_func_t destroy;
void *user_data;
+ hb_destroy_func_t destroy;
};
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 63631a9..43112c1 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -296,8 +296,8 @@
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 @@
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 @@
}
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 @@
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 @@
0, /* y_ppem */
NULL, /* klass */
- NULL, /* destroy */
- NULL /* user_data */
+ NULL, /* user_data */
+ NULL /* destroy */
};
hb_font_t *
@@ -498,8 +498,8 @@
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_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
diff --git a/src/hb-font.h b/src/hb-font.h
index f33e56f..4b9540b 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -49,8 +49,8 @@
/* 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 @@
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 @@
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);
/*
diff --git a/src/hb-ft.c b/src/hb-ft.c
index e696fe8..96c035a 100644
--- a/src/hb-ft.c
+++ b/src/hb-ft.c
@@ -189,7 +189,7 @@
return hb_blob_create ((const char *) buffer, length,
HB_MEMORY_MODE_WRITABLE,
- free, buffer);
+ buffer, free);
}
@@ -206,11 +206,11 @@
(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 @@
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);