#include "hb-unicode-private.hh"
-#include <glib.h>
-
-HB_BEGIN_DECLS
#if !GLIB_CHECK_VERSION(2,29,14)
static const hb_script_t
/* Unicode-6.0 additions */
HB_SCRIPT_BATAK,
HB_SCRIPT_BRAHMI,
- HB_SCRIPT_MANDAIC
+ HB_SCRIPT_MANDAIC,
+
+ /* Unicode-6.1 additions */
+ HB_SCRIPT_CHAKMA,
+ HB_SCRIPT_MEROITIC_CURSIVE,
+ HB_SCRIPT_MEROITIC_HIEROGLYPHS,
+ HB_SCRIPT_MIAO,
+ HB_SCRIPT_SHARADA,
+ HB_SCRIPT_SORA_SOMPENG,
+ HB_SCRIPT_TAKRI
};
#endif
* sees it and makes sure it's compilable. */
if (!a || !b)
- return FALSE;
+ return false;
gchar utf8[12];
gchar *normalized;
len = g_unichar_to_utf8 (a, utf8);
len += g_unichar_to_utf8 (b, utf8 + len);
normalized = g_utf8_normalize (utf8, len, G_NORMALIZE_NFC);
-
len = g_utf8_strlen (normalized, -1);
+ if (unlikely (!len))
+ return false;
+
if (len == 1) {
*ab = g_utf8_get_char (normalized);
- ret = TRUE;
+ ret = true;
} else {
- ret = FALSE;
+ ret = false;
}
g_free (normalized);
len = g_unichar_to_utf8 (ab, utf8);
normalized = g_utf8_normalize (utf8, len, G_NORMALIZE_NFD);
-
len = g_utf8_strlen (normalized, -1);
+ if (unlikely (!len))
+ return false;
+
if (len == 1) {
*a = g_utf8_get_char (normalized);
*b = 0;
*b = 0;
}
g_free (recomposed);
- ret = TRUE;
+ ret = true;
} else {
/* If decomposed to more than two characters, take the last one,
* and recompose the rest to get the first component. */
/* We expect that recomposed has exactly one character now. */
*a = g_utf8_get_char (recomposed);
g_free (recomposed);
- ret = TRUE;
+ ret = true;
}
g_free (normalized);
}
-extern HB_INTERNAL hb_unicode_funcs_t _hb_unicode_funcs_glib;
-hb_unicode_funcs_t _hb_glib_unicode_funcs = {
+extern HB_INTERNAL const hb_unicode_funcs_t _hb_glib_unicode_funcs;
+const hb_unicode_funcs_t _hb_glib_unicode_funcs = {
HB_OBJECT_HEADER_STATIC,
NULL, /* parent */
- TRUE, /* immutable */
+ true, /* immutable */
{
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_glib_unicode_##name,
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
hb_unicode_funcs_t *
hb_glib_get_unicode_funcs (void)
{
- return &_hb_glib_unicode_funcs;
+ return const_cast<hb_unicode_funcs_t *> (&_hb_glib_unicode_funcs);
}
-
-HB_END_DECLS