ryanoasis / nerd-fonts

Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
https://NerdFonts.com
Other
52.63k stars 3.59k forks source link

Natively bold letter symbols become extremely high in monospace editors #1515

Open mooreye opened 4 months ago

mooreye commented 4 months ago

šŸ—¹ Requirements

šŸŽÆ 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

ā˜… Screenshots (Optional)

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

mooreye commented 4 months ago

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.

237dmitry commented 4 months ago

It seems to happen with every nerd font

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

Finii commented 3 months ago

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.

237dmitry commented 3 months ago

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

Finii commented 3 months ago

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.

237dmitry commented 3 months ago

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

mooreye commented 3 months ago

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

237dmitry commented 3 months ago

Mousepad:

ss-3

Finii commented 3 months ago

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 commented 3 months ago

gedit via flatpak

image

Finii commented 3 months ago

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 commented 3 months ago

Suggestion for @mooreye

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 commented 3 months ago

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

But they are right:

image

mooreye commented 3 months ago

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>
Finii commented 3 months ago

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:

mooreye commented 3 months ago
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
Finii commented 3 months ago

Tnx. I'll try that after the 3.2.0 release

tukykarmakar commented 1 month ago

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

Finii commented 1 month ago

@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?

tukykarmakar commented 1 month ago

@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.

Finii commented 1 month ago

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.