A fork of Gluon's emoji library, extended with automatic sprite downloading and multi-vendor support.
On first run, the library automatically:
- Resolves the latest emoji-data commit from GitHub (falls back to cache or a known-good commit if offline).
- Downloads
emoji.jsonfor that commit and generates a localemoji.csv. - Downloads the sprite sheets for the chosen vendor (20, 32, 64 px).
- Caches everything under
~/.emoji-fx/{vendor}/{commit}/for subsequent runs.
Call once at application startup before using any emoji API:
EmojiInitializer.initialize(EmojiVendor.TWITTER)
.thenAccept(ok -> {
if (ok) {
// library is ready
}
});The download directory defaults to ~/.emoji-fx/, but can be customized by passing a Path as the second argument:
EmojiInitializer.initialize(EmojiVendor.FACEBOOK, Path.of("/your/custom/directory"))
.thenAccept(ok -> {
if (!ok) log.warn("Emoji assets failed to load");
})
.join();Three emoji image sets are supported:
| Vendor | Identifier |
|---|---|
EmojiVendor.GOOGLE |
|
EmojiVendor.TWITTER |
Twitter (Twemoji) |
EmojiVendor.FACEBOOK |
EmojiData contains the public API to create Emoji objects from text, unicode, or hex codepoints.
Fetch 👋 from short name:
Optional<Emoji> emoji = EmojiData.emojiFromShortName("wave");Search emojis by partial text:
List<Emoji> emojis = EmojiData.search("wav");Fetch 👋 from unicode:
Optional<Emoji> emoji = EmojiData.emojiFromUnicodeString("\uD83D\uDC4B");Fetch 👋 from hex codepoint:
Optional<Emoji> emoji = EmojiData.emojiFromCodepoints("1F44B-1F3FC");Parse a UTF-8 string into a mixed list of text and emoji objects:
List<Object> nodes = TextUtil.convertToStringAndEmojiObjects("hello \uD83D\uDC4B");<dependency>
<groupId>io.github.b077as.emojifx</groupId>
<artifactId>emoji</artifactId>
<version>1.0.1</version>
</dependency>All contributions are welcome!
- Submit issues for bug reports, questions, or feature requests.
- Contributions can be submitted via pull request.