summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-08-10 23:05:05 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-08-10 23:05:05 -0400
commit4c1f130ea8328ff492e72b9a0eebbe6a083d7b7a (patch)
tree1eb53f0982e211935f9672abc2a6cfad2c147a31
parentf2fab897d32061d9a0329384cd4b0fd71748ea97 (diff)
downloadpango-4c1f130ea8328ff492e72b9a0eebbe6a083d7b7a.tar.gz
[HB] Initialize unicode funcs to nil getters
-rw-r--r--pango/opentype/hb-unicode.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/pango/opentype/hb-unicode.c b/pango/opentype/hb-unicode.c
index 46b90b85..47c0396e 100644
--- a/pango/opentype/hb-unicode.c
+++ b/pango/opentype/hb-unicode.c
@@ -32,14 +32,20 @@
* hb_unicode_funcs_t
*/
+static hb_codepoint_t hb_unicode_get_mirroring_char_nil (hb_codepoint_t unicode) { return unicode; }
+static hb_category_t hb_unicode_get_general_category_nil (hb_codepoint_t unicode) { return HB_CATEGORY_OTHER_LETTER; }
+static hb_script_t hb_unicode_get_script_nil (hb_codepoint_t unicode) { return HB_SCRIPT_UNKNOWN; }
+static unsigned int hb_unicode_get_combining_class_nil (hb_codepoint_t unicode) { return 0; }
+static unsigned int hb_unicode_get_eastasian_width_nil (hb_codepoint_t unicode) { return 1; }
+
static hb_unicode_funcs_t _hb_unicode_funcs_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
- NULL, /*get_general_category */
- NULL, /*get_combining_class */
- NULL, /*get_mirroring_char */
- NULL, /*get_script */
- NULL /*get_eastasian_width */
+ hb_unicode_get_general_category_nil,
+ hb_unicode_get_combining_class_nil,
+ hb_unicode_get_mirroring_char_nil,
+ hb_unicode_get_script_nil,
+ hb_unicode_get_eastasian_width_nil
};
hb_unicode_funcs_t *
@@ -50,6 +56,9 @@ hb_unicode_funcs_create (void)
if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
return &_hb_unicode_funcs_nil;
+ *ufuncs = _hb_unicode_funcs_nil;
+ HB_OBJECT_DO_INIT (ufuncs);
+
return ufuncs;
}
@@ -95,7 +104,7 @@ hb_unicode_funcs_set_mirroring_char_func (hb_unicode_funcs_t *ufuncs,
if (HB_OBJECT_IS_INERT (ufuncs))
return;
- ufuncs->get_mirroring_char = mirroring_char_func;
+ ufuncs->get_mirroring_char = mirroring_char_func ? mirroring_char_func : hb_unicode_get_mirroring_char_nil;
}
void
@@ -105,7 +114,7 @@ hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
if (HB_OBJECT_IS_INERT (ufuncs))
return;
- ufuncs->get_general_category = general_category_func;
+ ufuncs->get_general_category = general_category_func ? general_category_func : hb_unicode_get_general_category_nil;
}
void
@@ -115,7 +124,7 @@ hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
if (HB_OBJECT_IS_INERT (ufuncs))
return;
- ufuncs->get_script = script_func;
+ ufuncs->get_script = script_func ? script_func : hb_unicode_get_script_nil;
}
void
@@ -125,7 +134,7 @@ hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
if (HB_OBJECT_IS_INERT (ufuncs))
return;
- ufuncs->get_combining_class = combining_class_func;
+ ufuncs->get_combining_class = combining_class_func ? combining_class_func : hb_unicode_get_combining_class_nil;
}
void
@@ -135,6 +144,6 @@ hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
if (HB_OBJECT_IS_INERT (ufuncs))
return;
- ufuncs->get_eastasian_width = eastasian_width_func;
+ ufuncs->get_eastasian_width = eastasian_width_func ? eastasian_width_func : hb_unicode_get_eastasian_width_nil;
}