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
54.82k stars 3.65k forks source link

Dashed arrow is off in Iosevka Nerd Font Mono Regular #1018

Closed uloco closed 1 year ago

uloco commented 1 year ago

🗹 Requirements

🎯 Subject of the issue

Experienced behavior: When using bold text, the arrow is not aligned correctly horizontally (it's too close to the right number here) It is also bigger and looks generally out of place. (This also happens with Medium, Oblique, Thin and Light fonts)

Expected behavior: Bold text should align correctly

Example symbols: ⇣1⇡1

🔧 Your Setup

★ Screenshots (Optional)

Regular (works)

Screenshot 2022-12-02 at 11 48 29

Bold (broken)

Screenshot 2022-12-02 at 11 49 41
Finii commented 1 year ago

The arrow seem to be 21E1 and 21E3:

image

These glyphs are not patched in by Nerd Fonts.

Opening the two fonts, they look both ok, each is 1000 wide:

image

My guess would be that this is (again) a Family name problem; the OS mixes up all Iosevka fonts.

Finii commented 1 year ago

Ah yes, it mixes the Mono and non-Mono fonts (because their Family name is erroreously the same), and the Mono fonts have arrows of only width 500, broken-ish:

image

Finii commented 1 year ago

To clarify... This is a mix of two causes.

Generally the dashed arrow is broken in Mono, and that you see it only in bold is due to the broken Family names :sigh:

uloco commented 1 year ago

It was working at some point but I think it's been quite some time. I just thought it would be fixed at some point eventually because it's so obvious. 😅 Happy to help in any way!

Finii commented 1 year ago

Well, I guess all the arrow stuff of Iosevka is affected, i.e. 2190 - 21FC (and some more like proportional, infinity, ...):

image

Because they do not fit to the ordinary font width (of M and W etc), but we want to create a strictly monospaced font that is useful for applications that can not work with fonts where some glyphs are wider then others. This is a general problem and becomes apparent here. There is no real solution possible, because that are contradicting requirements that can not be solved together.

Probably users of the Nerd Font Mono variant need to add a blank after an arrow symbol, like they need to add after a lot of the Nerd Font Symbols. Or they need to use the Nerd Font (non-Mono) variant (which is impossible at the moment because the Family naming is broken).

uloco commented 1 year ago

Yes I tried to use the one without mono but then my powerlevel10k prompt looks weird, because the slates are not matching properly.

Finii commented 1 year ago

I have no real idea what do do here. At least the family naming problem will be solved in v2.3.0, and thus Nerd Font (non-Mono) could be used (see my comment above).

Postponing to v3.0.0.

uloco commented 1 year ago

Just wanted to let you know, that the issue is resolved when I use the IosevkaTerm Nerd Font or IosevkaTerm Nerd Font Mono variant. The normal Iosevka Nerd Font and Iosevka Nerd Font Mono now have a "broken" appearance regardless of font weight.

EDIT: Tested on latest v2.3.3 intalled via homebrew

Finii commented 1 year ago

Thank you for the information!

uloco commented 1 year ago

@Finii Looks like the IosevkaTerm Nerd Font disappeared in my latest install. What should I do?

uloco commented 1 year ago

Oh, looks like it is now a separate brew package. Will try downloading this then

Finii commented 1 year ago

Yes it was so big, I thought a lot people might just want Term or not-Term and not both.

Finii commented 1 year ago

Ah, the 21e1 which is 'broken' in width has a substitution rule that replaces it with a smaller centered glyph, so this is not a problem when the ligatures do work in your application:

image Rule to substitute u21E1.WWID with u21E1.NWID

image Originally (unpatched) the WWID glyph is 1000 units wide

For the Nerd Font this is reduced to the 'letter width' of 500, because only then a lot of terminals will take this font.

If you want a font that does not change the widths of the original glyphs you can take the (new) variant Nerd Font Propo.

Or, maybe better suited for your use case, use the Iosevka Term, where they inverted the substitution rule, and the direct codepoint's glyph is 500 units wide and it has a rule for a 2 cell wide centered array.:

image

In all images above take careful note of the decimal codepoint number in the title, i.e. 8673 and 1136332

github-actions[bot] commented 1 year ago

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.

leana8959 commented 8 months ago

Hello,

I'm noticing the same issue.

image

I have already turned the --mono option on (--use-single-width-glyphs). It seems like --adjust-line-height doesn't affect this issue.

I build iosevka with this build plan: (I have updated it since posting in the discussion, but the issue persists)

[buildPlans.hiosevka]
family = "hIosekva"
spacing = "normal"
serifs = "sans"

[buildPlans.hiosevka.ligations]
inherits = "haskell"
enables = [
    "brst",  # (* *)
    "logic", # \/ /\
    "lteq-separate", # <=
    "gteq-separate", # >=
]
disables = [
    "lteq", # <=
    "gteq", # >=
]

[buildPlans.hiosevka.variants.design]
capital-z = 'straight-serifless-with-crossbar'
capital-q = 'crossing'
lower-lambda = 'tailed-turn'
seven = 'straight-serifless-crossbar'
number-sign = 'slanted'
ampersand = "upper-open"
dollar = 'open'
percent = 'rings-continuous-slash-also-connected'

This font is then patched with this command:

find \( -name \*.ttf -o -name \*.otf \) | parallel nerd-font-patcher \
    {} \
    --name {/.}-NF \
    --use-single-width-glyphs \
    --careful \
    --complete \
    --quiet \
    --adjust-line-height \
    --no-progressbars \
    --outputdir nerd-font

Thank you for your time !

Finii commented 8 months ago

Just some notes:

Finii commented 8 months ago

About the names, you can check via fontforge --script bin/scripts/name_parser/query_names nerd-font/*.[to]tf 2>/dev/null (assuming you are in the repo root dir and your patched fonts are in the nerd-font subdir).

Result will be a very wide list, where you can especially check the family names:

Examining 12 font files
| Filename                                          |  | PS Name                                                         |  | Fullname                                                        |  | Family                                                 |  | Subfamily                     |  | Typogr. Family                          |  | Typogr. Subfamily                       |  |
|---------------------------------------------------|--|-----------------------------------------------------------------|--|-----------------------------------------------------------------|--|--------------------------------------------------------|--|-------------------------------|--|-----------------------------------------|--|-----------------------------------------|--|
| CascadiaMono-BoldItalic-vtt.ttf                   |31| CascadiaMono-BoldItalic                                         |23| Cascadia Mono Bold Italic                                       |25| Cascadia Mono                                          |13| Bold Italic                   |11|                                         |  |                                         |  |
| CascadiaMono-Bold-vtt.ttf                         |25| CascadiaMono-Bold                                               |17| Cascadia Mono Bold                                              |18| Cascadia Mono                                          |13| Bold                          | 4|                                         |  |                                         |  |
| CascadiaMono-ExtraLightItalic-vtt.ttf             |37| CascadiaMono-ExtraLightItalic                                   |29| Cascadia Mono ExtraLight Italic                                 |31| Cascadia Mono ExtraLight                               |24| Italic                        | 6| Cascadia Mono                           |13| ExtraLight Italic                       |17|
| CascadiaMono-ExtraLight-vtt.ttf                   |31| CascadiaMono-ExtraLight                                         |23| Cascadia Mono ExtraLight                                        |24| Cascadia Mono ExtraLight                               |24| Regular                       | 7| Cascadia Mono                           |13| ExtraLight                              |10|
| CascadiaMono-Italic-vtt.ttf                       |27| CascadiaMono-Italic                                             |19| Cascadia Mono Italic                                            |20| Cascadia Mono                                          |13| Italic                        | 6|                                         |  |                                         |  |
| CascadiaMono-LightItalic-vtt.ttf                  |32| CascadiaMono-LightItalic                                        |24| Cascadia Mono Light Italic                                      |26| Cascadia Mono Light                                    |19| Italic                        | 6| Cascadia Mono                           |13| Light Italic                            |12|
| CascadiaMono-Light-vtt.ttf                        |26| CascadiaMono-Light                                              |18| Cascadia Mono Light                                             |19| Cascadia Mono Light                                    |19| Regular                       | 7| Cascadia Mono                           |13| Light                                   | 5|
| CascadiaMono-Regular-vtt.ttf                      |28| CascadiaMono-Regular                                            |20| Cascadia Mono Regular                                           |21| Cascadia Mono                                          |13| Regular                       | 7|                                         |  |                                         |  |
| CascadiaMono-SemiBoldItalic-vtt.ttf               |35| CascadiaMono-SemiBoldItalic                                     |27| Cascadia Mono SemiBold Italic                                   |29| Cascadia Mono SemiBold                                 |22| Italic                        | 6| Cascadia Mono                           |13| SemiBold Italic                         |15|
| CascadiaMono-SemiBold-vtt.ttf                     |29| CascadiaMono-SemiBold                                           |21| Cascadia Mono SemiBold                                          |22| Cascadia Mono SemiBold                                 |22| Regular                       | 7| Cascadia Mono                           |13| SemiBold                                | 8|
| CascadiaMono-SemiLightItalic-vtt.ttf              |36| CascadiaMono-SemiLightItalic                                    |28| Cascadia Mono SemiLight Italic                                  |30| Cascadia Mono SemiLight                                |23| Italic                        | 6| Cascadia Mono                           |13| SemiLight Italic                        |16|
| CascadiaMono-SemiLight-vtt.ttf                    |30| CascadiaMono-SemiLight                                          |22| Cascadia Mono SemiLight                                         |23| Cascadia Mono SemiLight                                |23| Regular                       | 7| Cascadia Mono                           |13| SemiLight                               | 9|
leana8959 commented 8 months ago

Thank you for your reply !

I'm not sure if --adjust-line-height makes a difference, I made too many attempts, and I've lost track at this point. Maybe I'll try it again when I have more free time.

What do you mean by "not able to rebuild the grouping structure of the fonts"? I'm not a font expert, but all the variants seem to be recognized correctly by iTerm2. I had to turn this on, because I got errors that the family name is too long at some point.

...
hiosevka> ERROR: ====-< Family (ID 1)      too long (47 > 31): HIosekva Nerd Font Mono ExtraLight Extended Obl
hiosevka>    HIosekva Nerd Font Mono ExtraLight Extended Oblique
...

Here's the full output of the command you provided https://gist.github.com/leana8959/100d06bbecc5375f3d5f4e673c995de4

I noticed that there are a few are missing "typographic family", is this what you're referring to as "broken family names" ?

Thanks =)

Finii commented 8 months ago

if --adjust-line-height makes a difference, I made too many attempts

Then it will not have made any difference ;-) That is a very very old option and I believe with modern font renderer there just is no difference. Just would have been interesting if someone said "I absolutely need this option".

What do you mean by "not able to rebuild the grouping structure of the fonts"?

For example that the "Thin" variant belongs to the same family, but is a different weight; that Thin Italic is the same as Thin but is slanted, etc. A font file has a lot of names encoded into it, name stems and parts; and to correctly fill in all these names the patcher needs to analyse the name and create all these strings. Iirc that step is not done when a spoecific name is passed. Passing a specific name is some kind of expert-expert option. Normally nothing is passed of one generic source like "postscript". If the patcher just changes the name of the font but leaves the family as it was the patched font will be sorted into your unpatched Iosevkas and possibly the renderer will mix patched and unpatched fonts, which can lead to very strange behaviour. I think the FontBook will warn you if you check the font that the family name with some style is supplied by two font files. Ah yes, validate it is called in FontBook:

Screenshot 2024-02-20 at 06 59 34

With terminals like iTerm it will most likely make no difference; especially if you do not install all fonts and / or the unpatched ones not in parallel.

I had to turn this on, because I got errors that the family name is too long at some point.

Unless you use MS Word for Mac 5 or something equally ridiculously old software (of Microsoft) you can ignore the error.

The preferred way to prevent that is --makegroups 4 or some other value bigger than 1. That abbreviates "Nerd Font Mono" to "NFM" and voila the name is short enough ;)

This is an example that I just typed from the top of my head (is probably wrong), you can just try out different numbers. I believe I put something into font-patcher --help.

HIosekva Nerd Font Mono ExtraLight Extended Obl (makegroups 1, default) HIosekva NFM ExtraLight Extended Obl (makegroups 4) HIosekva NFM ExtLgt Ext Obl (makegroups 5?)

I noticed that there are a few are missing "typographic family", is this what you're referring to as "broken family names" ?

No, if no typographic family is given the 'normal' family is used (it's all a bit complicated).

Your output looks correct! Maybe I made the code smarter than I remember 😁

Ah, here is some documentation in the code itself. It seems --name something is ok, what I remembered was --makegroups -1...

    # --makegroup has an additional undocumented numeric specifier. '--makegroup' is in fact '--makegroup 1'.
    # Original font name: Hugo Sans Mono ExtraCondensed Light Italic
    #                                                              NF  Fam agg.
    # -1  no renaming at all (keep old names and versions etc)     --- --- ---
    #  0  turned off, use old naming scheme                        [-] [-] [-]
    #  1  HugoSansMono Nerd Font ExtraCondensed Light Italic       [ ] [ ] [ ]
    #  2  HugoSansMono Nerd Font ExtCn Light Italic                [ ] [X] [ ]
    #  3  HugoSansMono Nerd Font XCn Lt It                         [ ] [X] [X]
    #  4  HugoSansMono NF ExtraCondensed Light Italic              [X] [ ] [ ]
    #  5  HugoSansMono NF ExtCn Light Italic                       [X] [X] [ ]
    #  6  HugoSansMono NF XCn Lt It                                [X] [X] [X]

Edit: Correct formatting

leana8959 commented 8 months ago

Unless you use MS Word for Mac 5 or something equally ridiculously old software (of Microsoft) you can ignore the error.

I see, thanks for the clarification ! In the --help of font-patcher, it's written

--makegroups [{-1,0,1,2,3,4,5,6}]
                      Use alternative method to name patched fonts (default=1)

I wasn't sure what "alternative method" meant exactly, which caused my initial confusion. But your explanation was really clear !

I have removed the --name flag, and it still works fine for iTerm 2. Thanks again for the help!

github-actions[bot] commented 2 months ago

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.