Package com.github.tommyettinger.textra
Class EmojiProcessor
java.lang.Object
com.github.tommyettinger.textra.EmojiProcessor
Allows getting a RegExodus
This can parse every emoji in Emoji 14, which is what our version of Twemoji uses. It probably can't parse every emoji in Noto Color Emoji at this point, and might not handle all of OpenMoji, either.
Taken mostly from emoji-regex, which is MIT-licensed.
Replacer that can replace any "correct Unicode" emoji sequences with the single
PUA-char representation used by a Font to represent most emoji.
This can parse every emoji in Emoji 14, which is what our version of Twemoji uses. It probably can't parse every emoji in Noto Color Emoji at this point, and might not handle all of OpenMoji, either.
Taken mostly from emoji-regex, which is MIT-licensed.
-
Method Summary
Modifier and TypeMethodDescriptionstatic regexodus.ReplacergetReplacer(Font font) Gets a RegExodusReplacerthat will replace any standard Unicode 14 or lower emoji that can be displayed by the given Font with the special Unicode PUA char used by that Font to show that emoji.static voidInitializes the singleton that stores the massive regular expressionPatternthis uses internally.
-
Method Details
-
initialize
public static void initialize()Initializes the singleton that stores the massive regular expressionPatternthis uses internally. -
getReplacer
Gets a RegExodusReplacerthat will replace any standard Unicode 14 or lower emoji that can be displayed by the given Font with the special Unicode PUA char used by that Font to show that emoji. The given Font must have aFont.nameLookup, typically by adding an atlas withKnownFonts.addEmoji(Font). If there is no nameLookup in the given Font, this will replace any recognized emoji with the char'?'.- Parameters:
font- a Font that already has emoji added to it, typically Twemoji viaKnownFonts.addEmoji(Font)- Returns:
- a Replacer that can be used to replace any readable Unicode emoji in text with their Font-specific char representations
-