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

Monospace font rendering issues in Alacritty with 2.2.1 but not 2.1.0 #896

Closed
3 tasks done
liamtimms opened this issue Aug 27, 2022 · 27 comments
Closed
3 tasks done

Comments

@liamtimms
Copy link

liamtimms commented Aug 27, 2022

🗹 Requirements

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

🎯 Subject of the issue

Experienced behavior:

Major differences in font rendering for jetbrains between releases 2.1.0 and 2.2.1.

Expected behavior:

I'd expect that spacing/rendering would continue working as in previous versions.

Example symbols:

left window is with release 2.1.0 while right is 2.2.1:

image

🔧 Your Setup

  • Which font are you using (e.g. Anonymice Powerline Nerd Font Complete.ttf)?
    • Please give the full filename
    • Where did you get the file from (download link, self patched, source downloaded from link...)
  • Which terminal emulator are you using (e.g. iterm2, urxvt, gnome, konsole)?
  • Are you using OS X, Linux or Windows? And which specific version or distribution?

font: family: jetbrainsmono medium nerd font
from: nerd-fonts-jetbrains-mono via AUR
terminal: alacritty
OS: Arch Linux

★ Screenshots (Optional)

left window is with release 2.1.0 while right is 2.2.1:

image

Also of note:

image

The install size appears to have changed significantly between the versions.

@Finii
Copy link
Collaborator

Finii commented Aug 27, 2022

Sorry to hear of and see your problem with 2.2.1.

The right image looks like it does mix fonts that should not be used together.

The JetBrains got another variant now, JetBrains Mono Nerd Font and JetBrains Mono NL Nerd Font:
https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/JetBrainsMono

The individual font files look fine at first glance.
The font family naming is buggy, but that has already been so in 2.1.0

Some questions that would help reproducing

  • Is the effect also visible in gnome-terminal, or tilix, or kitty (spares me learning alacritty)?
  • Did you reboot (I know usually not needed)?
  • Can you share the alacritty configuration (screenshot or something)?
  • Do you have the 'regular' Jet Brains Mono installed in parallel?
  • Would you have time and like to test a new set of JetBrainsMono NF when I prepare one?

This AUR installs 128 font files. With the broken family naming this can be problematic.

@simonwiles
Copy link

I had the same issue with konsole (nerd-fonts-jetbrains-mono installed from the AUR on Arch). Fwiw the PKGBUILD from the AUR installs 64 fonts for me, including the new NL variant (which is very welcome, thanks!).

Noodling around rolling back to 2.1.0 and then reinstalling 2.2.1 for testing purposes, I am no longer able to reproduce the issue. I think it was caused by a faulty post-install script that the AUR maintainer has now removed (as of 2 hours ago, commit ab7a714f).

@liamtimms
Copy link
Author

@simonwiles I just tested with the new commit and the issue is still present after a reboot.

@Finii can you explain the "font family naming is buggy" a little bit more?

Is the effect also visible in gnome-terminal, or tilix, or kitty (spares me learning alacritty)?

It seems to be ok in gnome-terminal:

image

Yet, gnome-terminal also doesn't let me pick the medium variant, which I have found much more readable. I know that Alacritty does not support ligatures and now see that "NL" stands for "no ligatures"; if ligatures handling has changed that might be part of the issue, but specifying jetbrainsmononl seems not actually to be affecting it. Possibly this is due to the buggy behavior around picking the font family you mentioned. I can file something on the alacritty bug tracker if that's more appropriate but I am keeping the nerd front downgraded in the meantime.

Did you reboot (I know usually not needed)?

Yep.

Can you share the alacritty configuration (screenshot or something)?

click for font config

# Font configuration
font:
  # Normal (roman) font face
  normal:
    # Font family
    #
    # Default:
    #   - (macOS) Menlo
    #   - (Linux/BSD) monospace
    #   - (Windows) Consolas
    #
    #family: monospace
    # family: source code pro semibold
    family: jetbrainsmono medium nerd font 

    # The `style` can be specified to pick a specific face.
    #style: Regular

  # Bold font face
  bold:
    # Font family
    #
    family: jetbrainsmono Extrabold nerd font
    # If the bold family is not specified, it will fall back to the
    # value specified for the normal font.
    # family: source code pro

    # The `style` can be specified to pick a specific face.
    style: Extrabold

  # Italic font face
  italic:
    # Font family
    #
    # If the italic family is not specified, it will fall back to the
    # value specified for the normal font.
    # family: source code pro semibold

    # The `style` can be specified to pick a specific face.
    style: Italic

  # Bold italic font face
  bold_italic:
    # Font family
    family: jetbrainsmono Extrabold Italic nerd font
    #
    # If the bold italic family is not specified, it will fall back to the
    # value specified for the normal font.
    # family: monospace

    # The `style` can be specified to pick a specific face.
    style: Bold Italic

  # Point size
  size: 12.5

Do you have the 'regular' Jet Brains Mono installed in parallel?

Nope, only the nerd font versions.

Would you have time and like to test a new set of JetBrainsMono NF when I prepare one?`

Sure.

This AUR installs 128 font files. With the broken family naming this can be problematic.

Should the NL fonts be separated into their own package?

@liamtimms
Copy link
Author

As a quick followup: switching from medium weight font improves but does not resolve the issue

with medium ( family: jetbrainsmono medium nerd font)

image

without medium (family: jetbrainsmono nerd font)

image

@Finii
Copy link
Collaborator

Finii commented Aug 27, 2022

with medium ( family: jetbrainsmono medium nerd font)

Hmm, the Family name for the JetBrainsMono Nerd Font Mono ... is that not different?

See here..

image

@liamtimms
Copy link
Author

Honestly, I have no idea. I originally tried different combinations until I got something that worked in the configuration with previous releases. I mention it mainly as a clue since it is slightly better without medium specified but still borked. While specifying the family like that seems odd, it was working without issue in 2.1.0 and does work if I downgrade back to 2.1.0. It's possible that some change in 2.2.1 has exposed an underlying bug in font selection, rendering, ligature handling, or some combination thereof.

@liamtimms
Copy link
Author

Wait ok, I think it is something to do with font family selection. Switching the family to jebrainsmono nerd font and then specifying medium style and dropping family selection from the Bold specification seems to work.

image

This seems like the intended way of configuring the font, and I think it's actually that something in font family selection was broken previously, and my workaround had stopped working with this update.

@Finii
Copy link
Collaborator

Finii commented Aug 28, 2022

Should the NL fonts be separated into their own package?

The same question holds for:

  • Should the 'Windows Compatible' fonts not be separately packed?
  • Why are 'Windows Compatible' fonts in an AUR package anyway?
  • Does it make sense to install both 'Nerd Font' and 'Nerd Font Mono' variants, or should they be separated?

At the moment we have no separation at all. For example Terminus has not only two variants like JetBrains (i.e. NL and 'with ligatures'), but 'BDF', 'PCF', 'PSF', and '4.40' 😬

WHAT? Just checked the Terminus release package, and there is only one of the 4 variants?

Hmm, 'Gohu' has also 4 variants, ... but these are packed at least in subdirs?

OK, I will check that.

@Finii can you explain the "font family naming is buggy" a little bit more?

The patched font naming is ... strange, due to historical reasons. A lot of patched fonts just get clearly wrong names.

For example have a look here:

#### Add weight/style to family [1] Put Oblique into own SubFamily (and mark it as italic) [11] 'Term' is missing from Family [12]
>|iosevka-term-boldoblique.ttf | | Iosevka Term Bold Oblique | | Iosevka Term Oblique | | Bold | | Iosevka Term | | Bold Oblique
+|Iosevka Term Nerd Font Bold Oblique.ttf | | Iosevka Term Nerd Font Bold Oblique |X| IosevkaTerm Nerd Font Oblique |X| Bold Italic |X| IosevkaTerm Nerd Font | | Bold Oblique
-|Iosevka Term Bold Oblique Nerd Font.ttf | | Iosevka Term Bold Oblique Nerd Font | | Iosevka Nerd Font | | Bold | | Iosevka Nerd Font | | Bold Oblique

The lines in that file are:
>: Unpatched (original) font name
+: Corrected family naming
-: Current family naming
Notable differences are marked with an 'X'.

The font is Iosevka Term Bold Oblique.
But 'Term' is wrongly dropped from the naming, thus mixing Iosevka (normal) and Iosevka Term :-(

With 2.2.0 font-patcher got a new parameter --makegroups that will correct that. At the moment it is only used for Cascadia Code.

See also #717, which has been changed afterwards and is introduced via #723.

Possibly this is due to the buggy behavior around picking the font family you mentioned. I can file something on the alacritty bug tracker if that's more appropriate but I am keeping the nerd front downgraded in the meantime.

Let me check some things first. Just installed all fonts and starting an investigation. Need to get alacritty... 🛠️

Ah, here, after installing all fonts in the AUR:
image

NF is the Windows Compatible version, and you see there is no NF Mono, because the family name is broken and with windows compatible mono and non-mono fonts mix :-(

Did you reboot (I know usually not needed)?

Yep.

Sorry I had to ask the obvious ;)

Would you have time and like to test a new set of JetBrainsMono NF when I prepare one?`

Sure.

Let me create an experimental package with corrected Family names. I will put the link here when it is ready (need to feed my Kids first). The link is https://github.com/Finii/nerd-fonts/tree/experimental/JetBrainsMono-makegroups/archives.

I think it's actually that something in font family selection was broken previously, and my workaround had stopped working with this update

Hmm. Lets see, with all the AUR supplied fonts installed, I get this

$ fc-list : family | grep Jet
JetBrainsMonoNL NF
JetBrainsMono Nerd Font
JetBrainsMonoNL Nerd Font Mono
JetBrainsMonoNL Nerd Font
JetBrainsMono Nerd Font Mono
JetBrainsMono NF

Then lets assume you want JetBrainsMonoNL (non-Mono), lets see which styles are there

$ fc-list : family style | grep "JetBrainsMonoNL Nerd Font:"
JetBrainsMonoNL Nerd Font:style=Medium Italic,Italic
JetBrainsMonoNL Nerd Font:style=ExtraLight Italic,Italic
JetBrainsMonoNL Nerd Font:style=Light Italic,Italic
JetBrainsMonoNL Nerd Font:style=ExtraBold Italic,Italic
JetBrainsMonoNL Nerd Font:style=Bold
JetBrainsMonoNL Nerd Font:style=ExtraLight,Regular
JetBrainsMonoNL Nerd Font:style=Light,Regular
JetBrainsMonoNL Nerd Font:style=SemiBold Italic,Italic
JetBrainsMonoNL Nerd Font:style=Medium,Regular
JetBrainsMonoNL Nerd Font:style=SemiBold,Regular
JetBrainsMonoNL Nerd Font:style=Italic
JetBrainsMonoNL Nerd Font:style=Thin,Regular
JetBrainsMonoNL Nerd Font:style=ExtraBold,Regular
JetBrainsMonoNL Nerd Font:style=Bold Italic
JetBrainsMonoNL Nerd Font:style=Regular
JetBrainsMonoNL Nerd Font:style=Thin Italic,Italic

Ok, and you want Medium...

$ fc-list : family style | grep "JetBrainsMonoNL Nerd Font:" | grep Medium
JetBrainsMonoNL Nerd Font:style=Medium Italic,Italic
JetBrainsMonoNL Nerd Font:style=Medium,Regular

Of course Medium has no Bold style, just Regular and Italic, so you need to provide a different font for the bold console stuff (probably).

Edit: Add link to corrected family naming package

@Finii
Copy link
Collaborator

Finii commented Aug 28, 2022

Hmm, the v2.1.0 has very strange filenames...

Just focusing on the 'normal' variants, i.e. not Nerd Font Mono and not Windows Compat.

image

JetBrains Mono Medium and JetBrains Mono Medium Medium?
And what is JetBrains Mono Medium Med Ita compared to JetBrains Mono Medium Italic?
ExtraBold ExtBd and ExtraBold ExBd and Extra Bold?

And this is just the filenames. The fontconfig sees this:

image

Ah I get it, somehow there was a last-minute rebuilt of the patched fonts, but the older version were not removed 🙄

image

I will try to compile a history of commits that change the family naming behavior ...

@Finii
Copy link
Collaborator

Finii commented Aug 28, 2022

As example we follow JetBrains Mono Medium:

Hmm, and then I found this, the comments are from January 2022:

image

Interestingly the family naming in the Medium Medium font is correct, while in the other it is not.
And the reason is not a change in our font-patcher, but in the source fonts (the original unpatched ones), note the peculiar naming in 1.0.2:

image

So the one working for you was the one buggy version that noone cleaned out ;)

@liamtimms
Copy link
Author

So the one working for you was the one buggy version that noone cleaned out ;)

Great, that makes sense and was my intuition from the fact that I only got it working originally through trial + error while the new configuration which is working seems much more sensible. This is a very interesting journey and also explains why I was having difficulty selecting the older version of the font in other programs.

@Finii
Copy link
Collaborator

Finii commented Aug 28, 2022

If you like, you can find a patched JetBrainsMono font with 'correct' Family naming here:

https://github.com/Finii/nerd-fonts/tree/experimental/JetBrainsMono-makegroups/archives

It uses the new --makegroups flag. Would be good to test this, as it is a candidate for Nerd Fonts 3.0.0 patched font naming :-)

Note that also the file names changed to a more standard-ish format with the style last. They still have the unexpected blanks in them, ...

@beyond9thousand
Copy link

Could this be related? Its been bothering me like crazy since my fresh linux install

image

@Finii
Copy link
Collaborator

Finii commented Oct 9, 2022

@beyond9thousand

Could this be related? Its been bothering me like crazy since my fresh linux install

Not good if it drives you crazy.

Which font did you select on https://www.programmingfonts.org, I can not see that in the screenshot?
I guess you type > in that browser window, and copy and paste that into the Alacritty window?
Can you copy & paste that also in a text comment here, or give the unicode of that > like thing?

Maybe good would be the relevant Alacritty settings, and the output of ls -l for the font file you use.

@beyond9thousand
Copy link

beyond9thousand commented Oct 9, 2022

Apologies, for further context - the character you see is actually the zsh prompt for my shell. I copied it from my terminal and pasted it over to https://www.programmingfonts.org/#jetbrainsmono

CHAR:
UNICODE: U+276F

alacritty.yml:

font:
  normal:
    family: "JetBrainsMono Nerd Font"
Font files in use:
-rw-r--r-- 1 root root 1115436 Sep 22 04:36 JetBrains Mono Bold Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1089884 Sep 22 04:36 JetBrains Mono Bold Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1111088 Sep 22 04:36 JetBrains Mono Bold Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1095412 Sep 22 04:36 JetBrains Mono ExtraBold Italic Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1116616 Sep 22 04:36 JetBrains Mono ExtraBold Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1091412 Sep 22 04:36 JetBrains Mono ExtraBold Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1112616 Sep 22 04:36 JetBrains Mono ExtraBold Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1089256 Sep 22 04:36 JetBrains Mono ExtraLight Italic Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1110460 Sep 22 04:36 JetBrains Mono ExtraLight Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1086564 Sep 22 04:36 JetBrains Mono ExtraLight Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1107768 Sep 22 04:36 JetBrains Mono ExtraLight Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1091224 Sep 22 04:36 JetBrains Mono Italic Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1112428 Sep 22 04:36 JetBrains Mono Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1091592 Sep 22 04:36 JetBrains Mono Light Italic Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1112796 Sep 22 04:36 JetBrains Mono Light Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1088476 Sep 22 04:36 JetBrains Mono Light Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1109680 Sep 22 04:36 JetBrains Mono Light Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1091272 Sep 22 04:36 JetBrains Mono Medium Italic Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1112476 Sep 22 04:36 JetBrains Mono Medium Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1086824 Sep 22 04:36 JetBrains Mono Medium Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1108028 Sep 22 04:36 JetBrains Mono Medium Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1086628 Sep 22 04:36 JetBrains Mono Regular Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1107836 Sep 22 04:36 JetBrains Mono Regular Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1094672 Sep 22 04:36 JetBrains Mono SemiBold Italic Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1115876 Sep 22 04:36 JetBrains Mono SemiBold Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1089616 Sep 22 04:36 JetBrains Mono SemiBold Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1110820 Sep 22 04:36 JetBrains Mono SemiBold Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1088500 Sep 22 04:36 JetBrains Mono Thin Italic Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1109704 Sep 22 04:36 JetBrains Mono Thin Italic Nerd Font Complete.ttf
-rw-r--r-- 1 root root 1084320 Sep 22 04:36 JetBrains Mono Thin Nerd Font Complete Mono.ttf
-rw-r--r-- 1 root root 1105524 Sep 22 04:36 JetBrains Mono Thin Nerd Font Complete.ttf

@Finii
Copy link
Collaborator

Finii commented Oct 9, 2022

Ah, thank you.
276F is not patched in by Nerd Fonts, so either it is in the source or not.

It is in the source in the currently used source font:

image

and it is in the Release (just one font checked though):

image

And that glyph looks exactly like the one in your Alacritty screenshot.
Seems the programmingfonts.org uses an old JetBrains Mono? That codepoint has been added somewhen to JB-Mono, iirc.

@beyond9thousand
Copy link

Odd. Before my current linux install, I was using the exact same font and the same alacritty config along with exactly the same zsh prompt, and it looked like it does on the programmingfonts.org

The JB-Mono that you mention, is it a separate font file?

@Finii
Copy link
Collaborator

Finii commented Oct 9, 2022

Interestingly the github repo of programmingfonts.org has a JetBrainsMono with that same glyph:

image

At least the ttf, did not check the VF etc

The JB-Mono that you mention, is it a separate font file?

I do not underdstand? I used 'JB-Mono' just to not type 'JetBrains Mono'.

@beyond9thousand
Copy link

My bad, I thought you were suggesting that a separate version of the font file exists with the glyph that I was accustomed to up until recently. Also, I just confirmed your suspicion.

It was indeed swapped out/removed in one of the new releases. I installed an outdated version of JB Nerd Fonts from the aur (the package itself is marked outdated)

I am currently on 2.1.0-1 and it renders the glyph as I remember it to be
image

@Finii
Copy link
Collaborator

Finii commented Oct 9, 2022

Hmm, here I typed > (ordinary bigger-then), u276f and u2771:

image

image

Strange is that the two 27xx chars seem to have different height, while they should not according to the font itself:

image

Edit: Add zoomed in image

@Finii
Copy link
Collaborator

Finii commented Oct 9, 2022

I'm not really sure now ... is it 'solved' for you our shall we try something still?

@beyond9thousand
Copy link

It is solved so to speak, but the discrepancies you point out are bizarre nonetheless...

@Finii
Copy link
Collaborator

Finii commented Oct 9, 2022

bizarre

Well, if you turn the font on and off on the web page, notice that some } change and others not? Also the text in the top compared to in the middle?!

jbm

@beyond9thousand
Copy link

I am having a r/thanksihateit episode

@Finii
Copy link
Collaborator

Finii commented Feb 15, 2023

Heavy Brackets now patched in via commit 59c5cb5 font-patcher: Patch in heavy angle brackets

@beyond9thousand
Copy link

Seems that further maintenance on that front is not guaranteed from the changelog, unless I am interpreting it incorrectly

@github-actions
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 Aug 21, 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

4 participants