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
This commit is contained in:
Makoto Kato
2017-11-12 16:06:18 +09:00
parent 5cfde89943
commit be3ccf2605

View File

@@ -46,6 +46,12 @@ enum IdentifierType {
IDTYPE_ALLOWED = 1,
};
enum EmojiPresentation {
TextOnly = 0,
TextDefault = 1,
EmojiDefault = 2
};
extern const hb_unicode_general_category_t sICUtoHBcategory[];
inline uint32_t
@@ -172,6 +178,19 @@ 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)];