raphamorim / rio

A hardware-accelerated GPU terminal emulator focusing to run in desktops and browsers.
https://raphamorim.io/rio
MIT License
3.88k stars 124 forks source link

Variable fonts support - bold text doesn't render as bold #345

Closed bagasme closed 1 month ago

bagasme commented 12 months ago

Hi,

On my Rio config (~/.config/rio/config), I use locally installed variable font (here GitLab Mono):

...
[fonts]
family = "GitLab Mono"
size = 18
...

When I run vttest no. 2 (Test of screen features), bold texts are displayed as regular weight instead of bold: Rio vttest

On another terminal (e.g. kgx aka GNOME console), these render correctly: kgx vttest

It seems like Rio (especially underlying sugarloaf library) treats variable fonts as static regular fonts (or does Rio not support variable fonts?). These can be confirmed when running Rio with debugging logs (RIO_LOG_LEVEL=debug rio). The log excerpt have:

...
[INFO] sugarloaf::font Font search: family 'GitLab Mono' with style 'normal' and weight '400'
[WARN] sugarloaf::font Font 'GitLab Mono' found in /home/bagas/.local/share/fonts/GitLabMono/GitLabMono.ttf
[INFO] sugarloaf::font Font search: family 'GitLab Mono' with style 'italic' and weight '400'
[WARN] sugarloaf::font Font 'GitLab Mono' found in /home/bagas/.local/share/fonts/GitLabMono/GitLabMono-Italic.ttf
[INFO] sugarloaf::font Font search: family 'GitLab Mono' with style 'normal' and weight '800'
[WARN] sugarloaf::font Font 'GitLab Mono' found in /home/bagas/.local/share/fonts/GitLabMono/GitLabMono.ttf
[INFO] sugarloaf::font Font search: family 'GitLab Mono' with style 'italic' and weight '800'
[WARN] sugarloaf::font Font 'GitLab Mono' found in /home/bagas/.local/share/fonts/GitLabMono/GitLabMono-Italic.ttf
...

Here is the complete gzipped log of Rio session.

raphamorim commented 11 months ago

Hey @bagasme,

Thanks for the issue. Does it work when you use other font?

bagasme commented 11 months ago

Hey @bagasme,

Thanks for the issue. Does it work when you use other font?

I don't have this issue when using traditional static fonts (like Source Code Pro). I can also reproduce this issue with another variable font (I test with Victor Mono).

Victor Mono vttest

raphamorim commented 11 months ago

Hmm, looks Rio isn't finding the correct bold font then. Marking as a bug

raphamorim commented 1 month ago

Implemented support to auto bold and italic on main

Image