-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emoji TTF font setting not working #199
Comments
Emoji image variant works however. git clone https://github.com/googlefonts/noto-emoji /tmp/noto-emoji
export TEXTIMG_EMOJI_DIR=/tmp/noto-emoji/png/128
echo あ😃a👍!👀ん👄 | ./textimg -o emoji.png |
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.
|
You can draw Japanese with these fonts. Lines 62 to 69 in 80e940a
|
I don't think it's related to the OS flavor.
Japanese character not displayed is expected but the emoji should be. |
If you want to draw Japanese, set 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. |
It's not about Japanese chars or ArchLinux. It's a bug in textimg where emoji font option is ignored!
|
See WARN message.
|
This is what happens when I run $ textimg あいうえお😀 -f /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc -o /images/z.png $ export TEXTIMG_FONT_FILE='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc'
$ textimg あいうえお😀 -o /images/z.png export TEXTIMG_EMOJI_FONT_FILE=/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf
export TEXTIMG_FONT_FILE='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc'
textimg あいうえお😀 -o /images/z.png $ textimg あいうえお -f zzz.ttf -o /images/z.png
2023/02/11 05:43:36 textimg [WARN] /root/go/pkg/mod/github.com/jiro4989/textimg/v3@v3.1.8/config/face.go:42 zzz.ttf is not found. please set font path with `-f` option |
textimg uses two fonts to draw characters.
In your environment, the font specified by default in TEXTIMG_FONT_FILE does not exist, so Japanese cannot be drawn. |
The default font used by textimg is based on the path installed in Ubuntu. Rendering Japanese has failed because a font ( |
textimg doesn't support every font path on every OS. |
No, no. I didn't understand the issues. |
I finally understand. Indeed, textimg あいうえお😀 -o /images/a.png
export TEXTIMG_EMOJI_FONT_FILE='sushi.ttf'
textimg あいうえお😀 -o /images/b.png
a.png: b.png: It has the wrong warning message and the wrong font priority. |
Please forgive me for my untruthful reading of the issues.🙇 |
hmm? The
a.png: b.png:
|
It may be a font reading TTF, TTC or rendering problem. Please give me a few days. |
hmm...
package main
import (
"fmt"
"strings"
)
func main() {
// alphabet
const startAlphabetCodePoint rune = 'A'
const endAlphabetCodePoint rune = 'z'
var sb strings.Builder
appendRangeStrings(&sb, startAlphabetCodePoint, endAlphabetCodePoint)
// emoji
const startEmojiCodePoint rune = 0x1f600
const endEmojiCodePoint = startEmojiCodePoint + 1000
appendRangeStrings(&sb, startEmojiCodePoint, endEmojiCodePoint)
fmt.Println(sb.String())
}
func appendRangeStrings(sb *strings.Builder, s, e rune) {
counter := 1
for i := s; i <= e; i++ {
r := []rune{i}
s := string(r)
sb.WriteString(s)
if counter%50 == 0 {
sb.WriteString("\n")
}
counter++
}
sb.WriteString("\n")
} $ go run main.go
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr
stuvwxyz
😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏😐😑😒😓😔😕😖😗😘😙😚😛😜😝😞😟😠😡😢😣😤😥😦😧😨😩😪😫😬😭😮😯😰😱
😲😳😴😵😶😷😸😹😺😻😼😽😾😿🙀🙁🙂🙃🙄🙅🙆🙇🙈🙉🙊🙋🙌🙍🙎🙏🙐🙑🙒🙓🙔🙕🙖🙗🙘🙙🙚🙛🙜🙝🙞🙟🙠🙡🙢🙣
🙤🙥🙦🙧🙨🙩🙪🙫🙬🙭🙮🙯🙰🙱🙲🙳🙴🙵🙶🙷🙸🙹🙺🙻🙼🙽🙾🙿🚀🚁🚂🚃🚄🚅🚆🚇🚈🚉🚊🚋🚌🚍🚎🚏🚐🚑🚒🚓🚔🚕
🚖🚗🚘🚙🚚🚛🚜🚝🚞🚟🚠🚡🚢🚣🚤🚥🚦🚧🚨🚩🚪🚫🚬🚭🚮🚯🚰🚱🚲🚳🚴🚵🚶🚷🚸🚹🚺🚻🚼🚽🚾🚿🛀🛁🛂🛃🛄🛅🛆🛇
🛈🛉🛊🛋🛌🛍🛎🛏🛐🛑🛒🛓🛔🛕🛖🛗🛜🛝🛞🛟🛠🛡🛢🛣🛤🛥🛦🛧🛨🛩🛪🛫🛬🛰🛱🛲🛳🛴🛵🛶🛷🛸🛹
🛺🛻🛼🜀🜁🜂🜃🜄🜅🜆🜇🜈🜉🜊🜋🜌🜍🜎🜏🜐🜑🜒🜓🜔🜕🜖🜗🜘🜙🜚🜛🜜🜝🜞🜟🜠🜡🜢🜣🜤🜥🜦🜧🜨🜩🜪🜫
🜬🜭🜮🜯🜰🜱🜲🜳🜴🜵🜶🜷🜸🜹🜺🜻🜼🜽🜾🜿🝀🝁🝂🝃🝄🝅🝆🝇🝈🝉🝊🝋🝌🝍🝎🝏🝐🝑🝒🝓🝔🝕🝖🝗🝘🝙🝚🝛🝜🝝
🝞🝟🝠🝡🝢🝣🝤🝥🝦🝧🝨🝩🝪🝫🝬🝭🝮🝯🝰🝱🝲🝳🝴🝵🝶🝻🝼🝽🝾🝿🞀🞁🞂🞃🞄🞅🞆🞇🞈🞉🞊🞋🞌🞍🞎🞏
🞐🞑🞒🞓🞔🞕🞖🞗🞘🞙🞚🞛🞜🞝🞞🞟🞠🞡🞢🞣🞤🞥🞦🞧🞨🞩🞪🞫🞬🞭🞮🞯🞰🞱🞲🞳🞴🞵🞶🞷🞸🞹🞺🞻🞼🞽🞾🞿🟀🟁
🟂🟃🟄🟅🟆🟇🟈🟉🟊🟋🟌🟍🟎🟏🟐🟑🟒🟓🟔🟕🟖🟗🟘🟙🟠🟡🟢🟣🟤🟥🟦🟧🟨🟩🟪🟫🟰
🠀🠁🠂🠃🠄🠅🠆🠇🠈🠉🠊🠋🠐🠑🠒🠓🠔🠕🠖🠗🠘🠙🠚🠛🠜🠝🠞🠟🠠🠡🠢🠣🠤🠥
🠦🠧🠨🠩🠪🠫🠬🠭🠮🠯🠰🠱🠲🠳🠴🠵🠶🠷🠸🠹🠺🠻🠼🠽🠾🠿🡀🡁🡂🡃🡄🡅🡆🡇🡐🡑🡒🡓🡔🡕🡖🡗
🡘🡙🡠🡡🡢🡣🡤🡥🡦🡧🡨🡩🡪🡫🡬🡭🡮🡯🡰🡱🡲🡳🡴🡵🡶🡷🡸🡹🡺🡻🡼🡽🡾🡿🢀🢁🢂🢃🢄🢅🢆🢇
🢐🢑🢒🢓🢔🢕🢖🢗🢘🢙🢚🢛🢜🢝🢞🢟🢠🢡🢢🢣🢤🢥🢦🢧🢨🢩🢪🢫🢬🢭🢰🢱
🤀🤁🤂🤃🤄🤅🤆🤇🤈🤉🤊🤋🤌🤍🤎🤏🤐🤑🤒🤓🤔🤕🤖🤗🤘🤙🤚🤛🤜🤝🤞🤟
🤠🤡🤢🤣🤤🤥🤦🤧🤨🤩🤪🤫🤬🤭🤮🤯🤰🤱🤲🤳🤴🤵🤶🤷🤸🤹🤺🤻🤼🤽🤾🤿🥀🥁🥂🥃🥄🥅🥆🥇🥈🥉🥊🥋🥌🥍🥎🥏🥐🥑
🥒🥓🥔🥕🥖🥗🥘🥙🥚🥛🥜🥝🥞🥟🥠🥡🥢🥣🥤🥥🥦🥧🥨🥩🥪🥫🥬🥭🥮🥯🥰🥱🥲🥳🥴🥵🥶🥷🥸🥹🥺🥻🥼🥽🥾🥿🦀🦁🦂🦃
🦄🦅🦆🦇🦈🦉🦊🦋🦌🦍🦎🦏🦐🦑🦒🦓🦔🦕🦖🦗🦘🦙🦚🦛🦜🦝🦞🦟🦠🦡🦢🦣🦤🦥🦦🦧🦨🦩🦪🦫🦬🦭🦮🦯🦰🦱🦲🦳🦴🦵
🦶🦷🦸🦹🦺🦻🦼🦽🦾🦿🧀🧁🧂🧃🧄🧅🧆🧇🧈🧉🧊🧋🧌🧍🧎🧏🧐🧑🧒🧓🧔🧕🧖🧗🧘🧙🧚🧛🧜🧝🧞🧟🧠🧡🧢🧣🧤🧥🧦🧧
🧨 $ go run main.go | textimg -i -e /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf -o ~/Downloads/emoji.png Result: Emoji using TTF files cannot be drawn. |
I can see why this would work. textimg reads the image of emoji codepoint of filename when you set Line 32 in 210ddc5
And writes image pixels to output. But, textimg use the ttf file when you set |
@noraj This seems to be an issue with the golang/freetype library. When I first implemented textimg, I couldn't draw color emoji, so I implemented it using emoji image files. And since this issue is still unresolved, textimg cannot support color emoji TTF either. 😓 |
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. |
I searched for an alternative library, but it's probably not in Go language. |
Sad news. |
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.
Output image:
Expected behavior
Emoji displayed as in the documentation https://github.com/jiro4989/textimg#emoji-font-ttf.
Environment (please complete the following information)
The text was updated successfully, but these errors were encountered: