Bug 1032671 - Part 1. Add emoji presentation API for UTR#51. r?jfkthame
From ICU 57, ICU supports emoji presentation as draft API.
MozReview-Commit-ID: 6JgQMv4Ky9m
--- a/intl/unicharutil/util/nsUnicodeProperties.h
+++ b/intl/unicharutil/util/nsUnicodeProperties.h
@@ -41,16 +41,22 @@ enum PairedBracketType {
/* Flags for Unicode security IdentifierType.txt attributes. Only a subset
of these are currently checked by Gecko, so we only define flags for the
ones we need. */
enum IdentifierType {
IDTYPE_RESTRICTED = 0,
IDTYPE_ALLOWED = 1,
};
+enum EmojiPresentation {
+ TextOnly = 0,
+ TextDefault = 1,
+ EmojiDefault = 2
+};
+
extern const hb_unicode_general_category_t sICUtoHBcategory[];
inline uint32_t
GetMirroredChar(uint32_t aCh)
{
return u_charMirror(aCh);
}
@@ -167,16 +173,29 @@ IsEastAsianWidthFWH(uint32_t aCh)
}
inline bool
IsDefaultIgnorable(uint32_t aCh)
{
return u_hasBinaryProperty(aCh, UCHAR_DEFAULT_IGNORABLE_CODE_POINT);
}
+inline EmojiPresentation
+GetEmojiPresentation(uint32_t aCh)
+{
+ if (!u_hasBinaryProperty(aCh, UCHAR_EMOJI)) {
+ return TextOnly;
+ }
+
+ if (u_hasBinaryProperty(aCh, UCHAR_EMOJI_PRESENTATION)) {
+ return EmojiDefault;
+ }
+ return TextDefault;
+}
+
// returns the simplified Gen Category as defined in nsUGenCategory
inline nsUGenCategory GetGenCategory(uint32_t aCh) {
return sDetailedToGeneralCategory[GetGeneralCategory(aCh)];
}
inline VerticalOrientation GetVerticalOrientation(uint32_t aCh) {
return VerticalOrientation(GetCharProps2(aCh).mVertOrient);
}