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

[Suggestion] console::Emoji Struct for Fallback Strings #121

Open
kevinmatthes opened this issue Apr 22, 2023 · 6 comments
Open

[Suggestion] console::Emoji Struct for Fallback Strings #121

kevinmatthes opened this issue Apr 22, 2023 · 6 comments

Comments

@kevinmatthes
Copy link
Collaborator

I would like to suggest to add console as dependency in order to access its Emoji wrapper struct. That struct allows for the definition of a fallback string in case that some terminals should be unable to display the configured emojis even though having a Nerd Font configured.

The library is licensed MIT such that no license issues would arise. The public GitHub repository is https://github.com/console-rs/console, the latest version -- v0.15.5 -- was published in January.

@tobealive, what do you think?

@ttytm
Copy link
Owner

ttytm commented Apr 27, 2023

Hey @kevinmatthes,

Sorry again for taking a while.

I'm not sure if there are substitute for all the characters to achieve a somewhat satisfying result. The way I thought about it until now was, that if there are missing symbols it's a good indicator that the font could use an update (or in case of this app font dependencies are missing). Afaik all updated nerd-fonts contain the same characters. Though a missing unicode font could cause issues as well. But both are listed as dependencies.

So this is from a perspective not having done a lot of testing on which characters to use as substitutes. If this should be integrated, which one e.g. should we use to substitute the graph?

@kevinmatthes
Copy link
Collaborator Author

At the moment, there are more than three levels for one graph character. I would like to suggest to reduce it to three levels in the fallback using characters like these:

  • low: ̣, . | _
  • medium: · | -,
  • high: ˙, ' | ¨, ¯

For other emojis, we could use some simple ASCII Art, like v(")v for the crab emoji, or just plain text descriptions / abbreviations of what shall be shown as emoji. After all, this is still a CLI so -- at least in my opinion -- there is no problem in having an 80s appearance; in contrast, it adds something to an application. I remember a print server configuration script which uses ASCII Art to draw a printer in the terminal.

I do not know how the Nerd Fonts work for other users but on my machine, it is still not possible to have the emojis displayed properly even with a Nerd Font installed. I still use Hack as font in KDE Konsole.

@kevinmatthes
Copy link
Collaborator Author

For some of the applied emojis, there are also other valid UTF-8 characters which can be rendered in UTF-8 fonts without any problems. The best examples are the wind directions; there are arrows with exactly the same directions in the intervals [ 0 x 2190 , 0 x 2193 ] and [ 0 x 2196 , 0 x 2199 ] .

@kevinmatthes
Copy link
Collaborator Author

( [ 2190 16 , 2193 16 ] [ 2196 16 , 2199 16 ] ) Z

@ttytm
Copy link
Owner

ttytm commented Apr 28, 2023

Good points, especially that there might be issues depending on the capabilities of the used terminal. This also was one of the functional reasons why I integrated configurable styles. It were the Unicode characters used in the graph (that aren't Nerd Font) could be subject to misalignment in some terminals. However, I haven't experienced a terminal that couldn't display Nerd Fonts yet.

I'm using Plasma as my main DE, so Konsole is not far away. If you would like to share more about the font issue you are experiencing, I would be happy to help.

In terms of integrating this suggestion: while I wouldn't start implementing on this myself, I'm open to merging it if it's submitted.

@kevinmatthes
Copy link
Collaborator Author

After some research for the console::Emoji struct, I found out that the struct determines whether to render the emoji based on the configured locale; if the locale ends with UTF-8, the emoji is rendered. This might still lead to tofu on the screen.

My suggestion would be to introduce a new configuration option named something like emoji, tofu, or ascii to control whether the fallbacks shall be rendered by default. We would need to wrap the wrapper in order to incorporate the configuration option. If the new configuration option which I would like to suggest to put into the gui category of the settings is set accordingly, the fallback strings are displayed.

With such a new option, users who prefer good old ASCII Art to emojis as well as users with restricted terminals could control how the output is generated.

What do you thing about this configuration option, @tobealive? Which name would you prefer?

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

2 participants