Implement Unicode compatibility decompositions
Based on patch from Philip Withnall.
https://bugs.freedesktop.org/show_bug.cgi?id=41095
diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc
index b05b290..f300fed 100644
--- a/src/hb-unicode.cc
+++ b/src/hb-unicode.cc
@@ -99,6 +99,15 @@
}
+static unsigned int
+hb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
+ hb_codepoint_t u HB_UNUSED,
+ hb_codepoint_t *decomposed HB_UNUSED,
+ void *user_data HB_UNUSED)
+{
+ return 0;
+}
+
hb_unicode_funcs_t *
hb_unicode_funcs_get_default (void)
@@ -312,6 +321,23 @@
return ufuncs->func.decompose (ufuncs, ab, a, b, ufuncs->user_data.decompose);
}
+unsigned int
+hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
+ hb_codepoint_t u,
+ hb_codepoint_t *decomposed)
+{
+ unsigned int ret = ufuncs->func.decompose_compatibility (ufuncs, u,
+ decomposed,
+ ufuncs->user_data.decompose_compatibility);
+ if (ret == 1 && u == decomposed[0]) {
+ decomposed[0] = 0;
+ return 0;
+ }
+
+ decomposed[ret] = 0;
+
+ return ret;
+}
unsigned int
@@ -380,4 +406,3 @@
return c;
}
-