textimg: Emoji TTF font setting not working
Describe the bug
Emoji TTF font setting not working.
To Reproduce
Whatever the TTF font I use from the env. var. or with the option, emojis are not displayed.
# set emoji font in env var
export TEXTIMG_EMOJI_FONT_FILE=/usr/share/fonts/noto/NotoColorEmoji.ttf
export TEXTIMG_EMOJI_FONT_FILE=/usr/share/fonts/joypixels/JoyPixels.ttf
# from env var
echo ใ๐a๐๏ผ๐ใ๐ | ./textimg -i -o emoji.png
# explicit option
echo ใ๐a๐๏ผ๐ใ๐ | ./textimg -i -e /usr/share/fonts/joypixels/JoyPixels.ttf -o emoji.png
Output image:

Expected behavior
Emoji displayed as in the documentation https://github.com/jiro4989/textimg#emoji-font-ttf.
Environment (please complete the following information)
- OS: ArchLinux
- Version: textimg 3.1.7
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 22 (17 by maintainers)
Yeah last comment there is 6 years ago and they are talking about unicode v3/4 while we are at Unicode 15 now. This library will not support emoji anytime soon if ever. So either i will stay that way or maybe anoter more modern lib can be used.
hmmโฆ
Result:
Emoji using TTF files cannot be drawn.
It may be a font reading TTF, TTC or rendering problem. Please give me a few days.
hmm? The
-eoption is working.a.png:
b.png:
Please forgive me for my untruthful reading of the issues.๐ I will investigate the cause of the bug.
I finally understand. Indeed,
TEXTIMG_EMOJI_FONT_FILEis not working as you said.a.png:
b.png:
It has the wrong warning message and the wrong font priority. This is a textimg bug.
If you want to draw Japanese, set
TEXTIMG_FONT_FILEto a font that supports Japanese.TEXTIMG_FONT_FILEis used for drawing non-emoticons.See: https://github.com/jiro4989/textimg#fonts
I donโt know ArchLinuxโs font folder. I donโt even know what fonts will be installed.
You can draw Japanese with these fonts.
https://github.com/jiro4989/textimg/blob/80e940a6926266beb65b371b19b9202b7d1028ed/config/config.go#L62-L69
I donโt have an Arch Linux environment, so I canโt test it. Solve the problem yourself.
Probably, I think that the JoyPixels font does not support Japanese.