asciinema / agg

asciinema gif generator
https://docs.asciinema.org/manual/agg/
Apache License 2.0
1.21k stars 44 forks source link

CJK rendering #10

Closed kjrstory closed 1 week ago

kjrstory commented 2 years ago

I am a South Korean user. The application I use has Korean output. In asciinema, it is displayed normally as follows. image However, when converting this to gif using, it is not output normally as shown below. han Is there anyone who can solve it?

ku1ik commented 2 years ago

From what I see all the symbols are rendered correctly but they're overlapping, there's not enough room between them. This is due to lack of support for double-width text characters. In the web player this is handled by web browser's rendering engine, while here we'd need to implement detection of such double-width chars and adjust their placement accordingly.

tats-u commented 2 months ago

You may want to use the unicode-width crate to get fine rendering result. While you don't want to analyze the designated fonts directly, I think this way is the best.

https://crates.io/crates/unicode-width

ku1ik commented 1 month ago

I just upgraded avt version used by agg, which uses unicode-width. This will enable implementation of proper (better) rendering of double-width chars. Will try to get it into the upcoming agg release.

tats-u commented 1 month ago

Not fixed even in main.

cargo run -- --font-family "UDEV Gothic NF"  $HOME/agg-test.txt $HOME/agg-test.gif

agg-test

git log --oneline -1
e6e9602 (HEAD -> main, origin/main) Add docker image publish GH workflow

agg-test.txt

UDEV Gothic: https://github.com/yuru7/udev-gothic/releases

cfoust commented 2 weeks ago

Any plans to fix this? I also need support for I can consider switching from vhs.

ku1ik commented 1 week ago

This has been fixed in 1.5.0 - https://github.com/asciinema/agg/releases/tag/v1.5.0

tats-u commented 1 week ago

agg-test

I updated the main and ran the same command. Glad it's been fixed!

ku1ik commented 1 week ago

Great, thanks for the confirmation :+1: