summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-08-10 23:25:28 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-08-10 23:25:28 -0400
commite434cc3d4f720a453eaff20f8d6ab61ae098c4a0 (patch)
tree67d4cd412ee229a6251f584378415fca2c3726d3
parent8b3ad4afc0ce0f4db72142e1a6ee7883e5702dd6 (diff)
downloadpango-e434cc3d4f720a453eaff20f8d6ab61ae098c4a0.tar.gz
[HB] Add hb_unicode_funcs_make_immutable()
-rw-r--r--pango/opentype/hb-unicode-private.h2
-rw-r--r--pango/opentype/hb-unicode.c22
-rw-r--r--pango/opentype/hb-unicode.h2
3 files changed, 21 insertions, 5 deletions
diff --git a/pango/opentype/hb-unicode-private.h b/pango/opentype/hb-unicode-private.h
index 27938967..5f62d395 100644
--- a/pango/opentype/hb-unicode-private.h
+++ b/pango/opentype/hb-unicode-private.h
@@ -40,6 +40,8 @@ HB_BEGIN_DECLS
struct _hb_unicode_funcs_t {
hb_reference_count_t ref_count;
+ hb_bool_t immutable;
+
hb_unicode_get_general_category_func_t get_general_category;
hb_unicode_get_combining_class_func_t get_combining_class;
hb_unicode_get_mirroring_char_func_t get_mirroring_char;
diff --git a/pango/opentype/hb-unicode.c b/pango/opentype/hb-unicode.c
index 91da4922..3da5dc4e 100644
--- a/pango/opentype/hb-unicode.c
+++ b/pango/opentype/hb-unicode.c
@@ -41,6 +41,8 @@ static unsigned int hb_unicode_get_eastasian_width_nil (hb_codepoint_t unicode)
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,
hb_unicode_get_mirroring_char_nil,
@@ -92,16 +94,26 @@ hb_unicode_funcs_copy (hb_unicode_funcs_t *other_ufuncs)
*ufuncs = *other_ufuncs;
HB_OBJECT_DO_INIT (ufuncs);
+ ufuncs->immutable = FALSE;
return ufuncs;
}
+void
+hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs)
+{
+ if (HB_OBJECT_IS_INERT (ufuncs))
+ return;
+
+ ufuncs->immutable = TRUE;
+}
+
void
hb_unicode_funcs_set_mirroring_char_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_get_mirroring_char_func_t mirroring_char_func)
{
- if (HB_OBJECT_IS_INERT (ufuncs))
+ if (ufuncs->immutable)
return;
ufuncs->get_mirroring_char = mirroring_char_func ? mirroring_char_func : hb_unicode_get_mirroring_char_nil;
@@ -111,7 +123,7 @@ void
hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_get_general_category_func_t general_category_func)
{
- if (HB_OBJECT_IS_INERT (ufuncs))
+ if (ufuncs->immutable)
return;
ufuncs->get_general_category = general_category_func ? general_category_func : hb_unicode_get_general_category_nil;
@@ -121,7 +133,7 @@ void
hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_get_script_func_t script_func)
{
- if (HB_OBJECT_IS_INERT (ufuncs))
+ if (ufuncs->immutable)
return;
ufuncs->get_script = script_func ? script_func : hb_unicode_get_script_nil;
@@ -131,7 +143,7 @@ void
hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_get_combining_class_func_t combining_class_func)
{
- if (HB_OBJECT_IS_INERT (ufuncs))
+ if (ufuncs->immutable)
return;
ufuncs->get_combining_class = combining_class_func ? combining_class_func : hb_unicode_get_combining_class_nil;
@@ -141,7 +153,7 @@ void
hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_get_eastasian_width_func_t eastasian_width_func)
{
- if (HB_OBJECT_IS_INERT (ufuncs))
+ if (ufuncs->immutable)
return;
ufuncs->get_eastasian_width = eastasian_width_func ? eastasian_width_func : hb_unicode_get_eastasian_width_nil;
diff --git a/pango/opentype/hb-unicode.h b/pango/opentype/hb-unicode.h
index 5d8431c4..61829014 100644
--- a/pango/opentype/hb-unicode.h
+++ b/pango/opentype/hb-unicode.h
@@ -180,6 +180,8 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);
hb_unicode_funcs_t *
hb_unicode_funcs_copy (hb_unicode_funcs_t *ufuncs);
+void
+hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs);
/* funcs */