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

[BUG] Font rendering issue in Graphs (MesloLGS NF) #100

Closed
sgleizes opened this issue Aug 31, 2020 · 11 comments
Closed

[BUG] Font rendering issue in Graphs (MesloLGS NF) #100

sgleizes opened this issue Aug 31, 2020 · 11 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@sgleizes
Copy link

sgleizes commented Aug 31, 2020

Describe the bug

I hadn't used bashtop in a while and just recently migrated to bpytop. First of all thank you for this amazing piece of software.
Upon trying out the new version, the braille characters are no longer displayed properly in graphs.
This used to work in past bashtop versions, and the issue occurs with the latest bashtop and bpytop. I didn't change fonts in the mean time.

I've tried using a different font, and it seems the graphs only display properly when I select a Bold font style.
So it works with MesloLGS NF Bold, but not with the Regular variant. Same thing for Fira Mono, etc.

Expected behavior

Graphs should display properly regardless of the font style used.

Screenshots

Screenshot_20200831_173332

Info (please complete the following information):

  • bpytop version: 1.0.21
  • psutil version: 5.7.2
  • Linux distribution and version: Arch (latest)
  • Terminal used: Konsole
  • Font used: MesloLGS NF Regular
  • Python version: 3.8.5

For reference the font used is the one recommended for powerlevel10k (https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k)

@sgleizes sgleizes added the bug Something isn't working label Aug 31, 2020
@aristocratos
Copy link
Owner

aristocratos commented Aug 31, 2020

This used to work in past bashtop versions, and the issue occurs with the latest bashtop and bpytop.

The braille symbols used in the graphs are the same as it always has been. But there seems to be a lot of problems with certain versions or configurations of konsole.

The font rendering in it self is not anything I have control over, it's entirely in the hands of the user depending on terminal, system configuration, etc...

@aristocratos aristocratos removed the bug Something isn't working label Aug 31, 2020
@sgleizes
Copy link
Author

Indeed you are right, this is most likely due to a konsole update.
I will close this to avoid polluting open issues since the resolution does not depend on you. I will post here if I ever find more information.

@aristocratos
Copy link
Owner

I will post here if I ever find more information.

That would be great, there seem to be multiple issues with konsole but I haven't been able to reproduce any myself so can't say if it's a specific version that's at fault.

@sgleizes
Copy link
Author

Alright just found it. It's actually not a konsole issue but a font fallback/configuration issue.

I installed the package gnu-free-fonts (on arch) a while ago, which provides FreeMono and its weird-looking braille patterns. This had changed the fallback font used to display the braille patterns to FreeMono, which was previously resolving to Verdana. The following command allows to diagnose which font is being picked to display a braille character:
FC_DEBUG=4 pango-view --font="MesloGLS NF" -t "⠁" | grep family:

Removing the package restored the original rendering properly. An alternative solution would be to change the font configuration to specify the font fallback explicitly. This thread has some information about how to do this, but I can't confirm since removing the package was an acceptable resolution in my case. The arch wiki could be helpful as well.

@XenHat
Copy link

XenHat commented Sep 13, 2020

related: cjbassi/ytop#79

TLDR: remove gnu-free-fonts as mentioned above, or create a font configuration to replace `GNU FreeFont with another font.

It is easy to test if you are affected by this issue by using a braille character in your shell prompt. I used here:

 echo $PS1
\[\e[0;32m\]\u\[\e[0m\]\[\e[0m\]@\[\e[1;34m\]\h \[\e[0;35m\]\W\[\e[1;33m\]\[\e[0m\]

You can then run a terminal emulator with "simplistic" font fallback, such as alacritty,termite, st, xst or kermit.
This was my result out of the box (issue is present):
image

And this was the result after removing gnu-free-fonts:

image

P.S. An interesting note is that gnome-terminal can render braille correctly, while kermit, st and termite does not. All those terminal emulators are built using the VTE library, so there must be something specific to them which causes this font selection issue.

In short, I can confirm that removing gnu-free-fonts works.
Someone more versed in the arts of freefont could create a config file that pushes those fonts at the very end of the lookup list... I tried and I haven't succeeded yet.

EDIT: Typos and such

@aristocratos aristocratos added the documentation Improvements or additions to documentation label Sep 14, 2020
@aristocratos
Copy link
Owner

@sgleizes @XenHat

I will add a condensed version of this find to the README.md to bring attention to it if others are having problems.

@sgleizes
Copy link
Author

Great. I would like to report also that I've been having other rendering issues with konsole, and I've tried with many fonts (Symbola, ubraille, ...) but I always get spacing issues between braille characters:
Screenshot_20200915_132055
As you can see the vertical characters are not aligned properly and the further the graph goes, the worst this becomes. Also, the CPU percentages are shifted right for every braille character displayed. It looks like the braille characters are taking more space than they should, at least horizontally.
I'm not sure what I should try now, it might be something related to the way konsole renders these characters, as it works perfectly on termite.

@aristocratos
Copy link
Owner

@sgleizes

the vertical characters are not aligned properly

This problem with konsole have been reported multiple times for bashtop also, I haven't been able to reproduce it myself. But I'm thinking it's also related to the fallback font, possibly that the used terminal font and the fallback font for the braille characters gets rendered differently by konsole for some unknown reason.

You could try with the following font that contains the braille characters and see if it does any difference.

terminess-ttf-nerdfont.zip

I would suggest you report this to https://bugs.kde.org/ and hopefully they'll do something about it.

@sgleizes
Copy link
Author

Indeed it does work properly with the font you provided. I think you nailed the issue here.
I added this information to the existing bug report: https://bugs.kde.org/show_bug.cgi?id=425973

@tomszar
Copy link

tomszar commented May 15, 2024

Alright just found it. It's actually not a konsole issue but a font fallback/configuration issue.

I installed the package gnu-free-fonts (on arch) a while ago, which provides FreeMono and its weird-looking braille patterns. This had changed the fallback font used to display the braille patterns to FreeMono, which was previously resolving to Verdana. The following command allows to diagnose which font is being picked to display a braille character: FC_DEBUG=4 pango-view --font="MesloGLS NF" -t "⠁" | grep family:

Removing the package restored the original rendering properly. An alternative solution would be to change the font configuration to specify the font fallback explicitly. This thread has some information about how to do this, but I can't confirm since removing the package was an acceptable resolution in my case. The arch wiki could be helpful as well.

I had the same issue using alacritty and removing gnu-free-fonts (on arch as well) solved it.

@correabuscar
Copy link

On Gentoo, installing Terminus font ([ebuild N ] media-fonts/terminus-font-4.49.1-r1::gentoo USE="X center-tilde otf pcf-unicode psf ru-g -a-like-o -distinct-l -pcf-8bit -quote -ru-dv -ru-i -ru-k" 634 KiB) and switching to it from Cousine, solved the alignment issue mentioned above(but there's an issue for it here also), for me.

ie. solved this (see that 5, well for 100% it becomes 1%(not shown here)):
align

now with terminus it's well aligned:
terminus

using qterminal 2.0.1 (was same on 1.4.0), but issue isn't present in alacritty(due to simpler fallback? forgot where i read that)

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

No branches or pull requests

5 participants