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

Konsole rendering messed up for non-mono version on master branch #746

Closed
xsrvmy opened this issue Dec 31, 2021 · 13 comments
Closed

Konsole rendering messed up for non-mono version on master branch #746

xsrvmy opened this issue Dec 31, 2021 · 13 comments

Comments

@xsrvmy
Copy link

xsrvmy commented Dec 31, 2021

🗹 Requirements

  • [ X ] I have searched the issues for my issue and found nothing related and/or helpful
  • [ X ] I have searched the FAQ for help
  • [ X ] I have searched the Wiki for help

🎯 Subject of the issue

On the master branch, patched symbols maintain their advance value from the original font, instead of being adjusted to match the target font. This messes up Konsole and emacs terminal which don't use strict grid-based rendering. The 2.1.0 version does not have this problem.

🔧 Your Setup

  • Which font are you using (e.g. Anonymice Powerline Nerd Font Complete.ttf)?
    Hack Nerd Font Complete
  • Which terminal emulator are you using (e.g. iterm2, urxvt, gnome, konsole)?
    Konsole
  • Are you using OS X, Linux or Windows? And which specific version or distribution?
    Archlinux

★ Screenshots (Optional)

@xsrvmy
Copy link
Author

xsrvmy commented Dec 31, 2021

I should also note that neither konsole nor kitty detect the new version of Hack Nerd Font Complete as monospaced, while both did for the old version.

@Finii
Copy link
Collaborator

Finii commented Dec 31, 2021

More explanation in bottom of #731, but it's better to have a proper issue (like this).
Maybe we should close 731 and continue on here.

@Finii
Copy link
Collaborator

Finii commented Dec 31, 2021

On the other hand, you say 2.1.0 is still ok? Then it must be something different. But from your description it is the same.
But then, I have not really a feeling when 2.1.0 came about ;-) It 'feels' new. For some definitions of 'new'.

Good would be a screenshot what exactly means 'mess up' 😬

@xsrvmy
Copy link
Author

xsrvmy commented Dec 31, 2021

Actually Hack Nerd Font hasn't been updated since 2.1.0 until a week ago so that's why this wasn't an issue before.

Here is an example with JetBrains mono on the master branch. It shows the same problem.
Non-mono version
image

Mono version
image

Note that in the nono-mono version, the home icon shifts the ~ to the right.

And yes, I believe #731 (comment) is the cause of this. The home button has a wider advance. Konsole apparently only realigns to the grid on color changes.

@xsrvmy
Copy link
Author

xsrvmy commented Jan 1, 2022

I decided to run a git bisect, and this seems to be the commit that broke it:
59c45ba
Flipping the order of the two lines on the current master patcher fixes the problem.

Looking at the commit message, it looks like this was to fix spacing issues in proportional fonts, but it breaks monospace fonts. So this may need to be a command-line flag in the patcher

@Finii
Copy link
Collaborator

Finii commented Jan 1, 2022

Yes, that is the reason for some issues... #731 (comment)

@Finii
Copy link
Collaborator

Finii commented Jan 2, 2022

Looking at the commit message, it looks like this was to fix spacing issues in proportional fonts, but it breaks monospace fonts. So this may need to be a command-line flag in the patcher

I think I do not really understand this. What will break monospace fonts? This can mean 'Blah Mono Nerd Font' or 'Blah Nerd Font Mono', which says two different things.

To be more abstract.. do you propose an additional category to these three?

  • Nerd Font Mono: Strictly monospaced, symbols scaled down
  • Nerd Font: Not really monospaced, symbols can be bigger than one slot
  • Nerd Font MonoBigIcons: Strictly monospaced, symbols can be bigger than one slot

And we additionally have -l and then there is -w, which results in a variant-explosion ;)

Sorry dont get me wrong. But I try to understand that on a more abstract level and here I fail with your suggestion for a new option.

@Finii
Copy link
Collaborator

Finii commented Jan 2, 2022

Looking at the commit message, it looks like this was to fix spacing issues in proportional fonts

I'm not so sure, And in the Issue, the original reporter Daniel Capella looks like using the Nerd Font Mono maybe. Later on Tim Summerer obviously uses a propotional font. Do we have propotional fonts? Or are the glyphs just replaced into a non-patched propotional font by the renderer. It's a pity people never state which font they exactly use.

Somehow I can not bend my head around the problem. The exact problem evades me.

But anyhow, both code variants (before and after the commit) do not really 'communicate' what is intended and rely on side effects of the fontforge calls. I believe we need to understand what we want and then reformulate in a way that makes it more explicit what the code intends to do (for future maintenance).

@xsrvmy
Copy link
Author

xsrvmy commented Jan 2, 2022

To clarify:

  1. Nerd Font Mono: Strictly monospaced, symbols scaled down
  2. Nerd Font at v2.1.0: Strictly monospaced, symbols can be bigger. This is the implementation with big icons that works consistently across all terminals. However, it causes overlaps if a space is not inserted after the character.
  3. Nerd Font at master: Not monospaced. This implementation still work in terminals that use a strictly grid-based rendering. However, notably it breaks in Konsole and the Emacs terminal.

My point is that, for fonts that are proportional to begin with (eg. Noto Sans which is in this repo), and for the symbol only font, option 3 should be used. But for monospaced fonts, in most contexts, option 2 makes more sense. The only time something will break is if an application thinks it's using one of the original fonts as a fallback font and doesn't put spaces after icons.
When I suggested adding a configuration option, I wasn't actually talking about what to put in the repo as a pre-patched font (although that's up for discussion). I'm just asking for an option in the patcher because KDE and emacs user actually need the old behaviour to use big icons in terminals.

@Finii
Copy link
Collaborator

Finii commented Jan 2, 2022

That seem to be the same 3 patching variants. 👍

Your Variant 3 (my second) is good for people in proportional environments, as one does not need to care about adding spaces and stuff (*). This can be Visual Studio (I guess, remember slightly I did try programming with a proportional font some years back, but that was Erlang or Haskell? So not VS...), or me personally when I do talks (with Libre Impress) and want to have Icons in the text.

The auto-detect feature is a good idea, but I guess an command line option is still (additionally) desirable.

(*) See original Issue for 59c45ba which is this and shows this image:

before_update
after_update

Afterthought... Looking on the battery icon percentage thing, ... This is probably wider than two Ws. Maybe #748 should only be used for your Variants 1 and 2 and not 3.
Maybe the battery thing is from another font, why are people always so obscure with their descriptions? 😬

P.S.

However, notably it breaks in Konsole and the Emacs terminal.

But I think it works in Tilix, which I use mostly, at least I never stumbled about problems, but then... I seldom use non-mono.
Ah yes, Tilix is proportional I guess...

@xsrvmy
Copy link
Author

xsrvmy commented Jan 2, 2022

But I think it works in Tilix, which I use mostly, at least I never stumbled about problems, but then... I seldom use non-mono.
Ah yes, Tilix is proportional I guess...

Yeah most terminals takes the advance from a single character in the font. Konsole and QTerminal seem to be the exception here (my guess is that they do it for the ligatures). And of course emacs renders the terminal like normal text.

Maybe the battery thing is from another font, why are people always so obscure with their descriptions?

Some font awesome icons are quite wide.

@xsrvmy
Copy link
Author

xsrvmy commented Jan 3, 2022

An update: Apparently turning of bidirectional text support in Konsole somewhat fixes the problem. Still have to test more thoroughly because proportional fonts still don't render along a grid with that setting on.

That being said the options is definitely worth having, because the 2.1.0 version is actually detected by terminals as a monospaced font.

Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants