Skip to content
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

Doesn't render unicode characters such as β€œπŸ€–β€ (U+1F916) and β€œβ Έβ€ ? #28

Closed
ahmetkca opened this issue Jan 26, 2023 · 12 comments

Comments

@ahmetkca
Copy link

ahmetkca commented Jan 26, 2023

I have a cli application with spinner and I also use some unicode characters such as β€œπŸ€–β€ (U+1F916) and β€œβ Έβ€œ.
They show up as outline rectangles instead. I have also tried to use Nerd Font by specify custom --font-dir and --font-family

@ahmetkca ahmetkca changed the title Doesn't render unicode characters? Doesn't render unicode characters such as β€œπŸ€–β€ (U+1F916)? Jan 26, 2023
@ahmetkca
Copy link
Author

ahmetkca commented Jan 26, 2023

I have tried resvg renderer instead of fontdue and it was able to render β€œβ Έβ€œ and it didn't render anything for β€œπŸ€–β€ at all.

I think the problem is with the renderer. I don't know maybe there is a better renderer?

@ahmetkca ahmetkca changed the title Doesn't render unicode characters such as β€œπŸ€–β€ (U+1F916)? Doesn't render unicode characters such as β€œπŸ€–β€ (U+1F916) and β€œβ Έβ€ ? Jan 26, 2023
@ku1ik
Copy link
Contributor

ku1ik commented Feb 6, 2023

Can you provide example .cast file so we can try to reproduce the problem? Also, what OS?

@Zhengqbbb
Copy link

maybe can try add option --renderer "resvg"

@charlesnicholson
Copy link

I just hit this too on macOS 13.2.1 on a 2022 M2 MacBook Pro:

Expected:
improg-expected

Actual (no options):
improg-bad-agg

Actual (--render "resvg"):
improg-bad-agg-resvg

I'm happy to share the cast file but GitHub doesn't allow the ".cast" file type as an attachment; how would you like to receive it? Alternately, if it's easier, my terminal app is trivial to reproduce, just clone and run make and then ./build/demo: https://github.com/charlesnicholson/improg. It has some whitespace bugs on Linux and Windows but at least the emoji do render :)

@charlesnicholson
Copy link

I just discovered the --font-family flag, and they fix the display of the unicode characters in my prompt, but the 2-column emoji are all still broken. This happens with and without the --renderer resvg flag.

./agg-aarch64-apple-darwin --renderer resvg --font-family "Hack Nerd Font" improg-bad.cast improg.gif

@ku1ik
Copy link
Contributor

ku1ik commented Mar 30, 2023

I've just released 1.4.0 with much improved font loading and rendering behaviour. Please give it a try. Also see new Fonts section in README.

issue-28

@charlesnicholson
Copy link

Thanks for the quick update! Unfortunately I'm not seeing any improvements for the various emoji (U+1F6..). With agg built from the 1.4.0 tag:

../agg/target/release/agg improg.cast improg.gif --font-family "MesloLGS NF" --renderer resvg
improg resvg

../agg/target/release/agg improg.cast improg.gif --font-family "MesloLGS NF"
improg

Here's a screen grab from my terminal as the demo is running:
Screenshot 2023-03-30 at 9 21 54 AM

Here's the cast file I'm using.
improg.cast.zip

Perhaps it has something to do with my font? I'm using a nerd-patched Meno: https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Meslo/M/Regular/complete/Meslo%20LG%20M%20Regular%20Nerd%20Font%20Complete.ttf

@ku1ik
Copy link
Contributor

ku1ik commented Mar 30, 2023

@charlesnicholson See Fonts section in README for info on emoji support. Without Noto Emoji font on your system you won't get any emoji rendered.

@charlesnicholson
Copy link

Ah, thanks, gotcha. Should I open another ticket for supporting colored emoji with the user's font?

@ku1ik
Copy link
Contributor

ku1ik commented Mar 30, 2023

As for color emojis - agg uses fontdue library in its default renderer backend and this lib doesn't yet support color fonts. See mooman219/fontdue#47 . Once fontdue adds support for it, e.g. for Noto Color Emoji as mentioned in that issue, we'll have it in agg.

We also have this alternative SVG based renderer - resvg - but similarly, it can't deal with color emoji properly yet. See linebender/resvg#485 (comment)

In other words, you could open a ticket but I don't plan to look into that until either of the libs gets better support for it, or until we write another renderer using a different text rendering library. So it's not really going to happen soon.

@charlesnicholson
Copy link

I see, thanks for the response! I've been using https://github.com/icholy/ttygif and it works with whatever the user's font + setup are; I was hoping to move to asciinema but I guess it's not quite there yet :)

@ku1ik ku1ik closed this as completed Mar 30, 2023
@ku1ik
Copy link
Contributor

ku1ik commented Oct 27, 2024

I just released agg 1.5.0 with improved support for emoji, including rendering color ones πŸŽ‰

https://github.com/asciinema/agg/releases/tag/v1.5.0
https://docs.asciinema.org/manual/agg/usage/#emoji

If you have a chance to give it a shot then let me know how it performs now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants