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

Bugfix/visualstudio2022 #1442

Merged
merged 4 commits into from
Mar 17, 2024
Merged

Bugfix/visualstudio2022 #1442

merged 4 commits into from
Mar 17, 2024

Conversation

Finii
Copy link
Collaborator

@Finii Finii commented Nov 27, 2023

Description

If --makegroups is >= 4 the name suffix Nerd Font (Nerd Font Mono, Nerd Font Propo) is shortened to NF (NFM, NFP). But not everywhere. To show the nice long name in applications that can handle long names, the long name is always (!) written to ID16.

VisualStudio 2022 does not like that and assumes the font is broken.
For that reason this extra rule (write the long name to ID16 even though all other places use the abbreviation) has been removed with v3.1.0. But that breaks all configurations that address the font by family name, because the long name is gone now.

This PR implements a work around such that two (!) family names are written to ID16, the short and the long one.
In this way both VisualStudio 2022 and configured family name applications can be happy.

Hopefully.

Requirements / Checklist

What does this Pull Request (PR) do?

How should this be manually tested?

Any background context you can provide?

What are the relevant tickets (if any)?

Fixes: #1482

Screenshots (if appropriate or helpful)

Finii added a commit that referenced this pull request Nov 27, 2023
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but one active some replacement default font is used instead.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this pull request Nov 27, 2023
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator Author

Finii commented Nov 27, 2023

History, watch out for ID16 (compare to ID1):

v3.0.2 (broken)

======== CaskaydiaCoveNerdFont-LightItalic.ttf ========
SFNT Fullname      ID 4     CaskaydiaCove NF Light Italic
SFNT Family        ID 1     CaskaydiaCove NF Light
SFNT SubFamily     ID 2     Italic
SFNT Pref Family   ID 16    CaskaydiaCove Nerd Font
SFNT Pref Styles   ID 17    Light Italic
SFNT PS Name       ID 6     CaskaydiaCoveNF-LightItalic
SFNT Compatible    ID 18    
SFNT CID findfont  ID 20    
SFNT WWS Family    ID 21    
SFNT WWS SubFamily ID 22    
PS fontname                 CaskaydiaCoveNF-LightItalic
PS fullname                 CaskaydiaCove NF Light Italic
PS familyname               CaskaydiaCove NF Light
fondname                    None

v3.1.0 (ok)

======== CaskaydiaCoveNerdFont-LightItalic.ttf ========
SFNT Fullname      ID 4     CaskaydiaCove NF Light Italic
SFNT Family        ID 1     CaskaydiaCove NF Light
SFNT SubFamily     ID 2     Italic
SFNT Pref Family   ID 16    CaskaydiaCove NF
SFNT Pref Styles   ID 17    Light Italic
SFNT PS Name       ID 6     CaskaydiaCoveNF-LightItalic
SFNT Compatible    ID 18    
SFNT CID findfont  ID 20    
SFNT WWS Family    ID 21    
SFNT WWS SubFamily ID 22    
PS fontname                 CaskaydiaCoveNF-LightItalic
PS fullname                 CaskaydiaCove NF Light Italic
PS familyname               CaskaydiaCove NF Light
fondname                    None

v3.1.1 (broken)

This reverts v3.1.0, i.e. is in fact v3.0.2 again

======== CaskaydiaCoveNerdFont-LightItalic.ttf ========
SFNT Fullname      ID 4     CaskaydiaCove NF Light Italic
SFNT Family        ID 1     CaskaydiaCove NF Light
SFNT SubFamily     ID 2     Italic
SFNT Pref Family   ID 16    CaskaydiaCove Nerd Font
SFNT Pref Styles   ID 17    Light Italic
SFNT PS Name       ID 6     CaskaydiaCoveNF-LightItalic
SFNT Compatible    ID 18    
SFNT CID findfont  ID 20    
SFNT WWS Family    ID 21    
SFNT WWS SubFamily ID 22    
PS fontname                 CaskaydiaCoveNF-LightItalic
PS fullname                 CaskaydiaCove NF Light Italic
PS familyname               CaskaydiaCove NF Light
fondname                    None

v3.1.1-6 (ok)

======== CaskaydiaCoveNerdFont-LightItalic.ttf ========
SFNT Fullname      ID 4     CaskaydiaCove NF Light Italic
SFNT Family        ID 1     CaskaydiaCove NF Light
SFNT SubFamily     ID 2     Italic
SFNT Pref Family   ID 16    ('CaskaydiaCove Nerd Font', 'CaskaydiaCove NF')
SFNT Pref Styles   ID 17    ('Light Italic', 'Light Italic')
SFNT PS Name       ID 6     CaskaydiaCoveNF-LightItalic
SFNT Compatible    ID 18    
SFNT CID findfont  ID 20    
SFNT WWS Family    ID 21    
SFNT WWS SubFamily ID 22    
PS fontname                 CaskaydiaCoveNF-LightItalic
PS fullname                 CaskaydiaCove NF Light Italic
PS familyname               CaskaydiaCove NF Light
fondname                    None

Finii added a commit that referenced this pull request Nov 27, 2023
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator Author

Finii commented Nov 27, 2023

To set up a test set, with the PR applied:

$ NERDFONTS="--makegroups 4" ./gotta-patch-em-all-font-patcher\!.sh -j /CascadiaCode

Just the Nerd Font variants to try:
Caskaydia_3.1.1-6.tar.xz.zip (1.7M)

@Finii
Copy link
Collaborator Author

Finii commented Nov 27, 2023

This talk from Thomas Phinney / Adobe has some details:
https://localfonts.eu/wp-content/uploads/2017/11/Font-names.pdf

image

If there is no relation between 1 and 16 VisualStudio 2022 breaks, that seems to be odd and not according to expectations. And it was not the case for VisualStudio 2019. I really believe this is a Microsoft .... glitch.

And the usual suspects for documentation
https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids
https://learn.microsoft.com/en-us/typography/opentype/spec/recom#name-strings

Finii added a commit that referenced this pull request Dec 4, 2023
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii mentioned this pull request Jan 1, 2024
2 tasks
Finii added a commit that referenced this pull request Jan 15, 2024
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator Author

Finii commented Jan 15, 2024

Rebase on master to retrigger codeclimate 😬

@Finii
Copy link
Collaborator Author

Finii commented Jan 15, 2024

Ah yes, now I remember (the hurt)

image

Finii added a commit that referenced this pull request Mar 17, 2024
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator Author

Finii commented Mar 17, 2024

Rebase on master, force push

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Albeight documented in the comment not all non English-US entries are
removed but just al TO_DEL ones.

[how]
Put the conditional in the right position.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this pull request Mar 17, 2024
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The code is rather convoluted and one can not follow what is done.

[how]
Add function that abstracts some steps away.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii marked this pull request as ready for review March 17, 2024 19:27
@Finii Finii merged commit f9e1116 into master Mar 17, 2024
5 checks passed
@Finii Finii deleted the bugfix/visualstudio2022 branch March 17, 2024 19:36
Finii added a commit that referenced this pull request Mar 17, 2024
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii mentioned this pull request Jul 8, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CaskaydiaMono-3.1.1 and CaskaydiaCove-3.1.1 do not work in Notepad++
1 participant