agg icon indicating copy to clipboard operation
agg copied to clipboard

Nerd Font icons are not displayed

Open qg-m-kondratenko opened this issue 1 year ago • 2 comments

Describe the bug When rendering the cast containing icons from Nerd Fonts, the icons are not displayed in the resulting gif.

To Reproduce Steps to reproduce the behavior:

  1. Create /tmp/test.cast from test.zip. It contains a recording of bash shell that uses starship with Nerd Font icons.
  2. View the recording with ascinema play /tmp/test.cast. Nerd Font icons are displayed properly. play
  3. Generate gif agg --font-family 'FiraCode Nerd Font' /tmp/test.cast /tmp/out.gif.
  4. View the gif firefox /tmp/out.gif.
  5. See the missing icons. out

Expected behavior Icons are supposed to be visible the same way as when using ascinema play /tmp/test.cast

Versions:

  • OS: Fedora Linux 39
  • agg: 1.4.3

Additional Context:

agg -vvv --font-family 'FiraCode Nerd Font' /tmp/test.cast /tmp/out.gif
[INFO  agg] terminal size: 135x34
[INFO  agg] selected font families: ["FiraCode Nerd Font"]
[INFO  agg] selected theme: dracula
[DEBUG agg::renderer::fontdue] looking up font for families=["FiraCode Nerd Font"], weight=400, style=Normal
[DEBUG agg::renderer::fontdue] found font with id=ID(380)
[INFO  agg] gif dimensions: 1180x686
[DEBUG agg::renderer::fontdue] looking up font for families=["FiraCode Nerd Font"], weight=700, style=Normal
[DEBUG agg::renderer::fontdue] found font with id=ID(440)
[DEBUG agg::renderer::fontdue] looking up font for families=["FiraCode Nerd Font"], weight=400, style=Normal
[DEBUG agg::renderer::fontdue] found font with id=ID(380)
2 / 2 [======] 100.00 % 5.05/s [INFO  agg] rendering finished in 0.39664295s

qg-m-kondratenko avatar Dec 30 '23 14:12 qg-m-kondratenko

I see that the branch icon (between "on" and "main") is rendered correctly, so that means the Nerd Font is loaded and used fine.

The package and duck icons are emojis. agg doesn't support color emojis, but you can have monochrome emojis rendered with Noto Emoji font as explained here.

So the most of this is expected and working as intended. The only thing which I'm not sure about is the missing up arrow after the $ sign... It's not an emoji, so should have rendered with FiraCode Nerd Font. Can you try with another Nerd Font, e.g. JetBrains Mono?

ku1ik avatar Feb 14 '24 09:02 ku1ik

@ku1ik Changing the font to "JetBrainsMono NF" produced the exact same result. However changing the renderer to "--renderer resvg" more or less fixed the issue for both fonts. The icons are displayed, just not the way they are displayed in the terminal.

agg -vvv --font-family 'FiraCode Nerd Font' --renderer resvg test.cast out.gif
[INFO  agg] terminal size: 135x34
[INFO  agg] selected font families: ["FiraCode Nerd Font"]
[INFO  agg] selected theme: dracula
[INFO  agg] gif dimensions: 1151x686
[WARN  usvg_text_layout] Fallback from FiraCode Nerd Font to Symbola.
[WARN  usvg_text_layout] Fallback from FiraCode Nerd Font to Symbola.
[WARN  usvg_text_layout] Fallback from FiraCode Nerd Font to Symbola.
2 / 2 [===============================] 100.00 % 13.56/s [INFO  agg] rendering finished in 0.14776781s

out

qg-m-kondratenko avatar Feb 28 '24 08:02 qg-m-kondratenko

The recently released agg 1.5.0 uses resvg renderer by default, and this renderer has also been improved quite a lot (e.g. supports color emoji now).

ku1ik avatar Oct 27 '24 10:10 ku1ik