[API] Add hb_face_make/is_immutable()
This commit is contained in:
parent
20c8b908dd
commit
7fc5a30cb4
|
@ -81,6 +81,8 @@ struct _hb_font_funcs_t {
|
||||||
struct _hb_face_t {
|
struct _hb_face_t {
|
||||||
hb_object_header_t header;
|
hb_object_header_t header;
|
||||||
|
|
||||||
|
hb_bool_t immutable;
|
||||||
|
|
||||||
hb_get_table_func_t get_table;
|
hb_get_table_func_t get_table;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
hb_destroy_func_t destroy;
|
hb_destroy_func_t destroy;
|
||||||
|
|
|
@ -320,6 +320,8 @@ hb_font_get_kerning (hb_font_t *font,
|
||||||
static hb_face_t _hb_face_nil = {
|
static hb_face_t _hb_face_nil = {
|
||||||
HB_OBJECT_HEADER_STATIC,
|
HB_OBJECT_HEADER_STATIC,
|
||||||
|
|
||||||
|
TRUE, /* immutable */
|
||||||
|
|
||||||
NULL, /* get_table */
|
NULL, /* get_table */
|
||||||
NULL, /* user_data */
|
NULL, /* user_data */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
|
@ -456,6 +458,21 @@ hb_face_get_user_data (hb_face_t *face,
|
||||||
return hb_object_get_user_data (face, key);
|
return hb_object_get_user_data (face, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_face_make_immutable (hb_face_t *face)
|
||||||
|
{
|
||||||
|
if (hb_object_is_inert (face))
|
||||||
|
return;
|
||||||
|
|
||||||
|
face->immutable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_face_is_immutable (hb_face_t *face)
|
||||||
|
{
|
||||||
|
return face->immutable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
hb_blob_t *
|
hb_blob_t *
|
||||||
hb_face_reference_table (hb_face_t *face,
|
hb_face_reference_table (hb_face_t *face,
|
||||||
|
@ -515,6 +532,7 @@ hb_font_create (hb_face_t *face)
|
||||||
if (!(font = hb_object_create<hb_font_t> ()))
|
if (!(font = hb_object_create<hb_font_t> ()))
|
||||||
return &_hb_font_nil;
|
return &_hb_font_nil;
|
||||||
|
|
||||||
|
hb_face_make_immutable (face);
|
||||||
font->face = hb_face_reference (face);
|
font->face = hb_face_reference (face);
|
||||||
font->klass = &_hb_font_funcs_nil;
|
font->klass = &_hb_font_funcs_nil;
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,12 @@ void *
|
||||||
hb_face_get_user_data (hb_face_t *face,
|
hb_face_get_user_data (hb_face_t *face,
|
||||||
hb_user_data_key_t *key);
|
hb_user_data_key_t *key);
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_face_make_immutable (hb_face_t *face);
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_face_is_immutable (hb_face_t *face);
|
||||||
|
|
||||||
|
|
||||||
hb_blob_t *
|
hb_blob_t *
|
||||||
hb_face_reference_table (hb_face_t *face,
|
hb_face_reference_table (hb_face_t *face,
|
||||||
|
|
|
@ -156,7 +156,9 @@ _test_fontfuncs_nil (hb_font_funcs_t *ffuncs)
|
||||||
blob = hb_blob_create (test_data, sizeof (test_data), HB_MEMORY_MODE_READONLY, NULL, NULL);
|
blob = hb_blob_create (test_data, sizeof (test_data), HB_MEMORY_MODE_READONLY, NULL, NULL);
|
||||||
face = hb_face_create (blob, 0);
|
face = hb_face_create (blob, 0);
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
|
g_assert (!hb_face_is_immutable (face));
|
||||||
font = hb_font_create (face);
|
font = hb_font_create (face);
|
||||||
|
g_assert (hb_face_is_immutable (face));
|
||||||
hb_face_destroy (face);
|
hb_face_destroy (face);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,8 @@ typedef struct {
|
||||||
static const object_t objects[] =
|
static const object_t objects[] =
|
||||||
{
|
{
|
||||||
OBJECT_WITHOUT_IMMUTABILITY (buffer),
|
OBJECT_WITHOUT_IMMUTABILITY (buffer),
|
||||||
OBJECT_WITHOUT_IMMUTABILITY (face),
|
|
||||||
OBJECT_WITH_IMMUTABILITY (blob),
|
OBJECT_WITH_IMMUTABILITY (blob),
|
||||||
|
OBJECT_WITH_IMMUTABILITY (face),
|
||||||
OBJECT_WITH_IMMUTABILITY (font),
|
OBJECT_WITH_IMMUTABILITY (font),
|
||||||
OBJECT_WITH_IMMUTABILITY (font_funcs),
|
OBJECT_WITH_IMMUTABILITY (font_funcs),
|
||||||
OBJECT_WITH_IMMUTABILITY (unicode_funcs)
|
OBJECT_WITH_IMMUTABILITY (unicode_funcs)
|
||||||
|
|
Loading…
Reference in New Issue