nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

Natively bold letter symbols become extremely high in monospace editors

Open mooreye opened this issue 1 year ago • 21 comments

🗹 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

Experienced behavior:

Natively bold unicode letters like 𝐅𝐎𝐎𝐁𝐀𝐑 are extremely high in a monospace editor like gedit.

Expected behavior:

𝐅𝐎𝐎𝐁𝐀𝐑 displays with normal height.

Example symbols:

𝐅𝐎𝐎𝐁𝐀𝐑 generated with: https://lingojam.com/BoldTextGenerator

🔧 Your Setup

  • Which font are you using (e.g. Anonymice Powerline Nerd Font Complete.ttf)? Tested with:
    • InconsolataNerdFont-Regular.ttf
    • SauceCodeProNerdFontMono-Regular.ttf
  • Where did you get the file from (download link, self patched, source downloaded from link...)
    • git clone --filter=blob:none --sparse https://github.com/ryanoasis/nerd-fonts.git
    • git sparse-checkout add patched-fonts/{Inconsolata,SourceCodePro}
    • copied to ~/.local/share/fonts/
  • Which terminal emulator are you using (e.g. iterm2, urxvt, gnome, konsole)?
    • gnome
  • Are you using OS X, Linux or Windows? And which specific version or distribution?
    • Linux, Fedora 39

★ Screenshots (Optional)

This is how hugely high line 4 becomes in gedit: 2024-02-13T22:22:20,123864172+01:00

mooreye avatar Feb 13 '24 21:02 mooreye

It seems to happen with every nerd font from https://www.nerdfonts.com/font-downloads While with any regular system-installed font there is no such issue.

mooreye avatar Feb 13 '24 21:02 mooreye

It seems to happen with every nerd font

In my environment this happens with any font and in any application.

237dmitry avatar Feb 15 '24 11:02 237dmitry

Oh, sorry to hear you have problems!

Hmm, just did one test, on my machine with Tilix and CaskadiaCove it does not happen

image

Ah gnome terminal you say ...

image

In my environment this happens with any font and in any application.

In my environment does not happen with any (of the two tested) applications

This must be something to do with your setup and what the fallback font is.

Finii avatar Mar 16 '24 00:03 Finii

In my environment does not happen with any (of the two tested) applications

Are you serious? These aren't even alphabetic characters...

Firefox:

ss-1

Tilix:

ss-2

237dmitry avatar Mar 16 '24 11:03 237dmitry

Are you serious? It's not even a font...

That it is working on my machine? Yes?!

Lets see, the codepoints are this:

image

The bold F is U+1D405.

$ fc-list :charset=1D405 family
DejaVu Math TeX Gyre
Latin Modern Math
TeX Gyre Pagella Math
TeX Gyre Termes Math
FreeSerif
TeX Gyre Schola Math
DejaVu Serif,DejaVu Serif Condensed
TeX Gyre Bonum Math
TeX Gyre DejaVu Math
FreeSans
DejaVu Serif
FreeMono

I have no clue which one is used, but the one randomly chosen seems good on my machine :-D

Anyhow that "bold codepoints" are not part of Nerd Fonts patching and not (at lost not many) of the to-be-patched fonts. That only works if some fontfallback like technique is active on your machine.

Finii avatar Mar 16 '24 11:03 Finii

It's not even a font...

I edit it already

$ fc-list :charset=1D405 family
DejaVu Math TeX Gyre
DejaVu Serif,DejaVu Serif Condensed
Noto Sans Math
DejaVu Serif

ss-3

237dmitry avatar Mar 16 '24 12:03 237dmitry

Terminal enforces line height so it's not a good place to test. Please check a GUI plaintext editor like gedit

mooreye avatar Mar 16 '24 12:03 mooreye

Mousepad:

ss-3

237dmitry avatar Mar 16 '24 12:03 237dmitry

image

@mooreye Please check with some more common GUI thing like Writer. Did you check the output of above fc-list? This is some font configuration thing; it has nothing to do with the patched fonts per se.

Edit: Typo

Finii avatar Mar 16 '24 14:03 Finii

gedit via flatpak

image

Finii avatar Mar 16 '24 14:03 Finii

Interestingly gedit uses a different fallback font than writer (on my system).

In writer it is smaller (less tall) and has serifs; with gedit it is slightly bigger and is a sans serif style.

Well, I have no preferences rules, as I never ever use these things.

Finii avatar Mar 16 '24 14:03 Finii

Suggestion for @mooreye

  • Find out which concrete fonts you have that supply these codepoints
  • Select the one you like best
  • Put that font into a preference rule in your fontconfig

If you never changed your fontconfig, this can be used as inspiration, but I am sure there are tons of example on SO or somewhere. https://github.com/ryanoasis/nerd-fonts/blob/-/10-nerd-font-symbols.conf

Finii avatar Mar 16 '24 14:03 Finii

https://yaytext.com/blog/mathematical-unicode-letters/ :laughing:

But they are right:

image

Finii avatar Mar 16 '24 14:03 Finii

Thank you all for trying to help with this.

I'm using Fedora 39.

I have Inconsolata and SourceCodePro fonts installed in ~/.local/share/fonts/.

This is my ~/.config/fontconfig/fonts.conf:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">
        <test name="family" qual="any">
            <string>monospace</string>
        </test>
        <edit binding="strong" mode="prepend" name="family">
            <string>SauceCodePro Nerd Font Mono</string>
        </edit>
    </match>
    <match target="pattern">
        <test name="family" qual="any">
            <string>proportional</string>
        </test>
        <edit binding="strong" mode="prepend" name="family">
            <string>SauceCodePro Nerd Font Propo</string>
        </edit>
    </match>
</fontconfig>

Command fc-match monospace outputs SauceCodeProNerdFontMono-Regular.ttf: "SauceCodePro Nerd Font Mono" "Regular".

I have gedit installed natively via dnf.

With these Gedit settings, the issue happens:

image

When I untick Use the system fixed width font, the issue resolves itself:

image

Command fc-match 'Monospace Regular' outputs Vera.ttf: "Bitstream Vera Sans" "Regular".

And when I change to this font in Gedit, the issue is indeed resolved:

image

However, I want to use my Nerd Font. Is there some modification to fonts.conf that can be made so these glyphs fall back to Bitstream Vera Sans Mono Regular?

This didn't work:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">
        <test name="family" qual="any">
            <string>monospace</string>
        </test>
        <edit binding="strong" mode="prepend" name="family">
            <string>SauceCodePro Nerd Font Mono</string>
        </edit>
        <edit binding="strong" mode="prepend" name="family">
            <string>Bitstream Vera Sans Mono</string>
        </edit>
    </match>
    <match target="pattern">
        <test name="family" qual="any">
            <string>proportional</string>
        </test>
        <edit binding="strong" mode="prepend" name="family">
            <string>SauceCodePro Nerd Font Propo</string>
        </edit>
        <edit binding="strong" mode="prepend" name="family">
            <string>Bitstream Vera Sans Mono</string>
        </edit>
    </match>
</fontconfig>

mooreye avatar Apr 01 '24 20:04 mooreye

Where did you get the unpatched Vera from? Can you show fc-list | grep Vera ;-D

But I guess I should not look at this until Nerd Fonts 3.2.0 is ready :grimacing:

Finii avatar Apr 02 '24 06:04 Finii

fc-list | grep Vera

/usr/share/fonts/bitstream-vera-sans-mono-fonts/VeraMono.ttf: Bitstream Vera Sans Mono:style=Regular,Roman
/usr/share/fonts/bitstream-vera-serif-fonts/VeraSeBd.ttf: Bitstream Vera Serif:style=Bold
/usr/share/fonts/bitstream-vera-sans-fonts/Vera.ttf: Bitstream Vera Sans:style=Regular,Roman
/usr/share/fonts/bitstream-vera-sans-mono-fonts/VeraMoIt.ttf: Bitstream Vera Sans Mono:style=Oblique
/usr/share/fonts/bitstream-vera-sans-fonts/VeraBI.ttf: Bitstream Vera Sans:style=Bold Oblique
/usr/share/fonts/bitstream-vera-sans-fonts/VeraBd.ttf: Bitstream Vera Sans:style=Bold
/usr/share/fonts/bitstream-vera-serif-fonts/VeraSe.ttf: Bitstream Vera Serif:style=Regular,Roman
/usr/share/fonts/bitstream-vera-sans-mono-fonts/VeraMoBI.ttf: Bitstream Vera Sans Mono:style=Bold Oblique
/usr/share/fonts/bitstream-vera-sans-fonts/VeraIt.ttf: Bitstream Vera Sans:style=Oblique
/usr/share/fonts/bitstream-vera-sans-mono-fonts/VeraMoBd.ttf: Bitstream Vera Sans Mono:style=Bold

It's installed from dnf:

rpm -qf /usr/share/fonts/bitstream-vera-sans-mono-fonts/VeraMono.ttf

bitstream-vera-sans-mono-fonts-1.10-48.fc38.noarch

mooreye avatar Apr 02 '24 11:04 mooreye

Tnx. I'll try that after the 3.2.0 release

Finii avatar Apr 02 '24 12:04 Finii

I don't know if this is the right place to report this, but I'm also having issues with bold fonts, but with the horizontal direction. When using ShureTech Regular and Propo, the bold characters overlap with the characters next to them. I noticed that this happens only with Shure, and no other Nerd Fonts that I've tested. I have currently disabled "bright colours rendered in bold" and it seems to take up less space and not overlap anymore. Konsole-fonts-bad-spacing_01

tukykarmakar avatar May 12 '24 13:05 tukykarmakar

@tukykarmakar That looks like ... Windows Terminal? ShureTech does not have a bold font, how is your font setup? That is most likely not the problem mentioned here, where the math-symbol-bold-letters have a problem.

Can you reproduce the problem with a simple echo call?

Finii avatar May 12 '24 15:05 Finii

@tukykarmakar That looks like ... Windows Terminal? ShureTech does not have a bold font, how is your font setup? That is most likely not the problem mentioned here, where the math-symbol-bold-letters have a problem.

That's Konsole, as it shows in the title bar. I downloaded the font from nerdfonts.com/font-downloads by clicking on the green Download button, then installed through the 3 .ttf files. Screenshot below image

Can you reproduce the problem with a simple echo call?

Could you please provide an example command? My knowledge of the terminal is not that deep.

tukykarmakar avatar May 12 '24 16:05 tukykarmakar

Hmm, can not reproduce. Using Konsole Flatpak. No change whether or not I activate Draw intense colors in bold font

image

You probably need echo -e when using bash.

As there just is no bold ShureTechMono Nerd Font, where does your Konsole does get it from? Is there an option to autogenerate a bold font? Any other settings changed?

Hmm, this seems like a Konsole bug, when there is no bold font... sometimes it works, sometimes not.

image

image

It always works if the selected font actually HAS a bold font

image


But that is off topic here.

This Issue is about the unicode-math-symbols-bold-letters.

Please raise a new dedicated issue if there is anyhting more you need to discuss on the Konsole problem. But probably we can not do anything there. If you want a bold font, you should select a font that has a bold variant :grimacing: The bold you see there is probably something Konsole invented from thin air.

Finii avatar May 14 '24 06:05 Finii