diff options
Diffstat (limited to 'intl/unicharutil/util/nsUnicodeProperties.h')
-rw-r--r-- | intl/unicharutil/util/nsUnicodeProperties.h | 63 |
1 files changed, 21 insertions, 42 deletions
diff --git a/intl/unicharutil/util/nsUnicodeProperties.h b/intl/unicharutil/util/nsUnicodeProperties.h index ba5526a4d..ee1d77252 100644 --- a/intl/unicharutil/util/nsUnicodeProperties.h +++ b/intl/unicharutil/util/nsUnicodeProperties.h @@ -12,10 +12,8 @@ #include "nsUnicodeScriptCodes.h" #include "harfbuzz/hb.h" -#if ENABLE_INTL_API #include "unicode/uchar.h" #include "unicode/uscript.h" -#endif const nsCharProps2& GetCharProps2(uint32_t aCh); @@ -56,7 +54,16 @@ enum XidmodType { XIDMOD_NOT_CHARS }; -#if ENABLE_INTL_API // ICU is available, so simply forward to its API +enum EmojiPresentation { + TextOnly = 0, + TextDefault = 1, + EmojiDefault = 2 +}; + +const uint32_t kVariationSelector15 = 0xFE0E; // text presentation +const uint32_t kVariationSelector16 = 0xFE0F; // emoji presentation + +// ICU is available, so simply forward to its API extern const hb_unicode_general_category_t sICUtoHBcategory[]; @@ -172,46 +179,18 @@ IsEastAsianWidthFWH(uint32_t aCh) return false; } -#else // not ENABLE_INTL_API - -// Return whether the char has a mirrored-pair counterpart. -uint32_t GetMirroredChar(uint32_t aCh); - -bool HasMirroredChar(uint32_t aChr); - -uint8_t GetCombiningClass(uint32_t aCh); - -// returns the detailed General Category in terms of HB_UNICODE_* values -uint8_t GetGeneralCategory(uint32_t aCh); - -nsCharType GetBidiCat(uint32_t aCh); - -uint8_t GetLineBreakClass(uint32_t aCh); - -Script GetScriptCode(uint32_t aCh); - -uint32_t GetScriptTagForCode(Script aScriptCode); - -PairedBracketType GetPairedBracketType(uint32_t aCh); -uint32_t GetPairedBracket(uint32_t aCh); - -/** - * Return the numeric value of the character. The value returned is the value - * of the Numeric_Value in field 7 of the UCD, or -1 if field 7 is empty. - * To restrict to decimal digits, the caller should also check whether - * GetGeneralCategory returns HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER - */ -int8_t GetNumericValue(uint32_t aCh); - -uint32_t GetUppercase(uint32_t aCh); -uint32_t GetLowercase(uint32_t aCh); -uint32_t GetTitlecaseForLower(uint32_t aCh); // maps LC to titlecase, UC unchanged -uint32_t GetTitlecaseForAll(uint32_t aCh); // maps both UC and LC to titlecase - -// Return whether the char has EastAsianWidth class F or W or H. -bool IsEastAsianWidthFWH(uint32_t aCh); +inline EmojiPresentation +GetEmojiPresentation(uint32_t aCh) +{ + if (!u_hasBinaryProperty(aCh, UCHAR_EMOJI)) { + return TextOnly; + } -#endif // !ENABLE_INTL_API + if (u_hasBinaryProperty(aCh, UCHAR_EMOJI_PRESENTATION)) { + return EmojiDefault; + } + return TextDefault; +} // returns the simplified Gen Category as defined in nsIUGenCategory inline nsIUGenCategory::nsUGenCategory GetGenCategory(uint32_t aCh) { |