cursive icon indicating copy to clipboard operation
cursive copied to clipboard

[BUG] Nerdfont is not being properly rendered

Open TonyDC opened this issue 2 years ago • 2 comments
trafficstars

Describe the bug When a glyph from a Nerdfont-patched font is used, the interface is not properly rendered for some backends.

To Reproduce After cloning the repo, I added the following change:

diff --git a/cursive/examples/dialog.rs b/cursive/examples/dialog.rs
index c044205..695f0de 100644
--- a/cursive/examples/dialog.rs
+++ b/cursive/examples/dialog.rs
@@ -10,7 +10,7 @@ fn main() {
     // Creates a dialog with a single "Quit" button
     siv.add_layer(
         // Most views can be configured in a chainable way
-        Dialog::around(TextView::new("Hello Dialog!"))
+        Dialog::around(TextView::new("Hello Dialog! \u{f049d} "))
             .title("Cursive")
             .button("Foo", |_s| ())
             .button("Quit", |s| s.quit())

And then I experimented with various backends:

ncurses

cargo run --example dialog --features ncurses-backend --no-default-features

image

termion

cargo run --example dialog --features termion-backend --no-default-features

image

pancurses

cargo run --example dialog --features pancurses-backend --no-default-features

image

crossterm

cargo run --example dialog --features crossterm-backend --no-default-features

image

Expected behavior All backends should have the same result as termion.

Environment

  • Operating system used: macOS Ventura 13.4
  • Backend used: all macOS supported backends were tested
  • Current locale
$ locale

LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
  • Cursive version: git commit hash 30046dc563b3041092f0f0475ddf87a84eef25f9 (I used the main branch)

Additional context

  • the terminal emulator used was iTerm 2 (Build 3.4.19)
  • the font used was MesloMGS Nerd Font Mono
  • this issue was created as a follow-up of an issue in ncspot: https://github.com/hrkfdn/ncspot/issues/1154

TonyDC avatar Jun 04 '23 17:06 TonyDC

Hi, and thanks for the report!

It looks like ncurses is messing up the glyph width here. Not sure what we can do about it :(

We might starts defaulting to crossterm as a backend once I fix some remaining perf issues (essentially moving the buffered backend into cursive proper)

gyscos avatar Jul 07 '23 14:07 gyscos

Is this performance issue documented anywhere? It would be nice to know when deciding which backend to use.

mattfbacon avatar Sep 04 '23 17:09 mattfbacon