Merge "Cherry-pick: Switch from ICU deprecated unorm_normalize to unorm2_normalize." am: 776a18aff2 am: 23040ff2d2
am: a64371fec4
Change-Id: Iddaa8212e512f992f57347f990a36caf57b064d1
diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index ee54721..0b25dc8 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -34,7 +34,7 @@
#include "hb-unicode-private.hh"
#include <unicode/uchar.h>
-#include <unicode/unorm.h>
+#include <unicode/unorm2.h>
#include <unicode/ustring.h>
#include <unicode/utf16.h>
#include <unicode/uversion.h>
@@ -200,7 +200,7 @@
if (err) return false;
icu_err = U_ZERO_ERROR;
- len = unorm_normalize (utf16, len, UNORM_NFC, 0, normalized, ARRAY_LENGTH (normalized), &icu_err);
+ len = unorm2_normalize (unorm2_getNFCInstance (&icu_err), utf16, len, normalized, ARRAY_LENGTH (normalized), &icu_err);
if (U_FAILURE (icu_err))
return false;
if (u_countChar32 (normalized, len) == 1) {
@@ -261,7 +261,7 @@
if (err) return false;
icu_err = U_ZERO_ERROR;
- len = unorm_normalize (utf16, len, UNORM_NFD, 0, normalized, ARRAY_LENGTH (normalized), &icu_err);
+ len = unorm2_normalize (unorm2_getNFDInstance (&icu_err), utf16, len, normalized, ARRAY_LENGTH (normalized), &icu_err);
if (U_FAILURE (icu_err))
return false;
@@ -281,7 +281,7 @@
* the second part :-(. */
UChar recomposed[20];
icu_err = U_ZERO_ERROR;
- unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
+ unorm2_normalize (unorm2_getNFCInstance (&icu_err), normalized, len, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
if (U_FAILURE (icu_err))
return false;
hb_codepoint_t c;
@@ -297,7 +297,7 @@
U16_PREV_UNSAFE (normalized, len, *b); /* Changes len in-place. */
UChar recomposed[18 * 2];
icu_err = U_ZERO_ERROR;
- len = unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
+ len = unorm2_normalize (unorm2_getNFCInstance (&icu_err), normalized, len, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
if (U_FAILURE (icu_err))
return false;
/* We expect that recomposed has exactly one character now. */
@@ -331,7 +331,7 @@
/* Normalise the codepoint using NFKD mode. */
icu_err = U_ZERO_ERROR;
- len = unorm_normalize (utf16, len, UNORM_NFKD, 0, normalized, ARRAY_LENGTH (normalized), &icu_err);
+ len = unorm2_normalize (unorm2_getNFKDInstance (&icu_err), utf16, len, normalized, ARRAY_LENGTH (normalized), &icu_err);
if (icu_err)
return 0;