diff --git a/src/hb-blob.c b/src/hb-blob.c index 512bec98d..cf9dd539f 100644 --- a/src/hb-blob.c +++ b/src/hb-blob.c @@ -95,6 +95,12 @@ hb_blob_reference (hb_blob_t *blob) HB_OBJECT_DO_REFERENCE (blob); } +unsigned int +hb_blob_get_reference_count (hb_blob_t *blob) +{ + HB_OBJECT_DO_GET_REFERENCE_COUNT (blob); +} + void hb_blob_destroy (hb_blob_t *blob) { diff --git a/src/hb-blob.h b/src/hb-blob.h index 1066821ce..21aa36592 100644 --- a/src/hb-blob.h +++ b/src/hb-blob.h @@ -49,6 +49,9 @@ hb_blob_create (const char *data, hb_blob_t * hb_blob_reference (hb_blob_t *blob); +unsigned int +hb_blob_get_reference_count (hb_blob_t *blob); + void hb_blob_destroy (hb_blob_t *blob); diff --git a/src/hb-font.c b/src/hb-font.c index b2cf440e6..078a3bc7c 100644 --- a/src/hb-font.c +++ b/src/hb-font.c @@ -62,6 +62,12 @@ hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks) HB_OBJECT_DO_REFERENCE (fcallbacks); } +unsigned int +hb_font_callbacks_get_reference_count (hb_font_callbacks_t *fcallbacks) +{ + HB_OBJECT_DO_GET_REFERENCE_COUNT (fcallbacks); +} + void hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks) { @@ -120,6 +126,12 @@ hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks) HB_OBJECT_DO_REFERENCE (ucallbacks); } +unsigned int +hb_unicode_callbacks_get_reference_count (hb_unicode_callbacks_t *ucallbacks) +{ + HB_OBJECT_DO_GET_REFERENCE_COUNT (ucallbacks); +} + void hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks) { @@ -203,6 +215,12 @@ hb_face_reference (hb_face_t *face) HB_OBJECT_DO_REFERENCE (face); } +unsigned int +hb_face_get_reference_count (hb_face_t *face) +{ + HB_OBJECT_DO_GET_REFERENCE_COUNT (face); +} + void hb_face_destroy (hb_face_t *face) { @@ -280,6 +298,12 @@ hb_font_reference (hb_font_t *font) HB_OBJECT_DO_REFERENCE (font); } +unsigned int +hb_font_get_reference_count (hb_font_t *font) +{ + HB_OBJECT_DO_GET_REFERENCE_COUNT (font); +} + void hb_font_destroy (hb_font_t *font) { diff --git a/src/hb-font.h b/src/hb-font.h index d28714578..2c85339c8 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -41,6 +41,9 @@ hb_font_callbacks_create (void); hb_font_callbacks_t * hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks); +unsigned int +hb_font_callbacks_get_reference_count (hb_font_callbacks_t *fcallbacks); + void hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks); @@ -78,6 +81,9 @@ hb_unicode_callbacks_create (void); hb_unicode_callbacks_t * hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks); +unsigned int +hb_unicode_callbacks_get_reference_count (hb_unicode_callbacks_t *ucallbacks); + void hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks); @@ -126,6 +132,9 @@ hb_face_create_for_tables (hb_get_table_func_t get_table, hb_face_t * hb_face_reference (hb_face_t *face); +unsigned int +hb_face_get_reference_count (hb_face_t *face); + void hb_face_destroy (hb_face_t *face); @@ -151,6 +160,9 @@ hb_font_create (hb_face_t *face); hb_font_t * hb_font_reference (hb_font_t *font); +unsigned int +hb_font_get_reference_count (hb_font_t *font); + void hb_font_destroy (hb_font_t *font); diff --git a/src/hb-object-private.h b/src/hb-object-private.h index 541bad948..4ef282335 100644 --- a/src/hb-object-private.h +++ b/src/hb-object-private.h @@ -84,6 +84,13 @@ typedef struct { return obj; \ } HB_STMT_END +#define HB_OBJECT_DO_GET_REFERENCE_COUNT(obj) \ + HB_STMT_START { \ + if (HB_OBJECT_IS_INERT (obj)) \ + return 0; \ + return HB_REFERENCE_COUNT_GET_VALUE (obj->ref_count); \ + } HB_STMT_END + #define HB_OBJECT_DO_DESTROY(obj) \ HB_STMT_START { \ if (HB_OBJECT_IS_INERT (obj)) \