An extended JavaFX TextFlow with custom emoji images which helps you to achieve consistency in your JavaFX cross-platform UI applications displaying emojis along text.
It helps you to parse a plane text with emoji aliases with : around the alias
(ex. 😄 ) or unicode emoji symbols
to custom emoji images with text
and wraps it in custom EmojiTextFlow that is based on JavaFX TextFlow
See demo GIFs with examples under doc/img
Example code is in:
src/main/java/ExampleJavaFXEmojiTextFlow.java
First you need to get .jar
file with EmojiTextFlow from releases, here on github
(NOTE: following configuration is from build.gradle
of emoji-text-flow-demos/list-emoji-text-flow-local-libs-demo
demo project )
- put your .jar in root
libs
directory of your javafx project. - add/change your build.gradle to have these lines:
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
//// MUST INCLUDE THESE DEPENDENCIES START
// implementation name: 'JavaFXEmojiTextFlow_emojitwo-1.0'
// implementation name: 'JavaFXEmojiTextFlow_openmoji-1.0'
implementation name: 'JavaFXEmojiTextFlow_twemoji-1.0'
// https://mvnrepository.com/artifact/org.sharegov/mjson
compile group: 'org.sharegov', name: 'mjson', version: '1.3'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
//// MUST INCLUDE THESE DEPENDENCIES END
// ... your other dependencies
}
run this example with:
./gradlew exampleEmojiTextFlowWithListView
./gradlew exampleEmojiTextFlowWithListView
./gradlew exampleTypingTextConversion
There is an old example code from https://github.com/UltimateZero/EmojiOneJava In this example EmojiTextFlow is NOT used.
./gradlew oldExampleEmojiSearch
OpenMoji: https://github.com/hfg-gmuend/openmoji
Twemoji: https://github.com/twitter/twemoji
EmojiTwo: https://github.com/EmojiTwo/emojitwo/
you can add your own ...
NOTE: you need to make sure you follow same naming of your emoji
.png
files as in this project. (See inemoji_images
there are all lowercase unicode emoji names for each emoji image file; emoji.json is used to search your files by names.)
WARNING! the name of variable should be the save as your custom emoji pack directory name! In this example both are:
my_awesome_emoji_pack
gradle.ext.emojiImagesPath = 'my_awesome_emoji_pack'
./gradlew buildJar
4. grab your custom emoji pack jar
of EmojiTextFlow from build/libs
and place it to your other project as a dependency
You can create your own emoji pack with
only few of emoji .png images and recompile it by yourself.
It will dramatically reduce .jar
file size.
Copyright (c) 2016 MK Hejazy MIT License