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

patched font variants (bold, semibold etc) show up as duplicate in fontbook osx #56

Closed
alexanderjeurissen opened this issue Feb 7, 2016 · 47 comments
Labels
Milestone

Comments

@alexanderjeurissen
Copy link

Installing multiple font variants (bold, semibold, light, etc) on OSX using fontbook results in warnings and the font variants are all in separate "font families" ..

I tried installing multiple patched fonts (both Hack and Source Code Pro) so that should rule out that a single patched font is causing the issue.

screen shot 2016-02-07 at 01 29 46

As can be seen in the screenshot, multiple font families are created for the font variants while I expect a single font family named Sauce Code Pro containing all the variants. Also all the fonts are named: "NerdFontCompleteMono"

I hope we can sort this out because I really want to use the awesome glyphs in my setup

@adambiggs
Copy link

I reported this in #25 which appeared to be fixed, but I didn't actually have a chance to test it because I stopped using the install script in favour of manually installing just the font I use... Would love to see this resolved though!

@ryanoasis
Copy link
Owner

Yes this should be fixed.. thanks for the details here.

I don't have a mac to test on but perhaps I can setup a test branch where others can try it out 😄

@thewatts
Copy link

screen shot 2016-02-18 at 1 06 18 am

Looks like it's still an issue (shown after installing master)

@thewatts
Copy link

Which, I must say - this project is LEGIT. Really thankful for it!

@ryanoasis
Copy link
Owner

@thewatts, @adambiggs

Yes this should be fixed.. thanks for the details here

Err I apologize for not making my point clear. 😊 What I meant here was that this should get fixed not that it already was fixed. i.e. Yes this is still a problem AFAIK 👍

I will be leaving this ticket open until someone can confirm an attempted fix 😄


@thewatts

Which, I must say - this project is LEGIT. Really thankful for it!

Thanks! That means a lot

@ryanoasis
Copy link
Owner

I will be pushing up a test branch that should address this issue. Maybe even as early as tomorrow if I get time.

I will link to it on this ticket when I do.

Thanks

@ryanoasis ryanoasis modified the milestone: v0.7.0 Feb 22, 2016
@eugenesvk
Copy link

@ryanoasis I think this is an issue with FontForge not giving scripts access to font style names (fontforge/fontforge#1061) and relying on autogessing style. Hence you get very strange styles in your fonts such as NerdFontComplete instead of Regular.
The resulting PS Font Name ($fontname set to fontname + Suffix in your patcher) is identical for all different styles (e.g. SauceCodeProNerdFontComplete for both Regular and Medium instead of SauceCodeProNerdComplete-Regular and SauceCodeProNerdComplete-Medium) and Mac throws this error.

After I've used your script to generate the required fonts the only perfect solution to the naming mess I've found was to use FontLab

  1. set a proper Family name (e.g. Sauce Code ProNerdC for the 'Complete' version) — this would be the same for all the generated fonts with a given variation of extra glyph sets
  2. Auto-generate everything with 3 buttons (Build Style Name, Build Names, and Build OpenType Names) to get clean names
  3. Propagate these changes by clicking 'Import Names' in Additional OpenType Names
  4. Generate a clean set of files like SauceCodeProNerdC-MediumItalic.ttf

Then, you'd get the following clean names (based on Source Code Medium Italic)
Family Name: Sauce Code ProNerdC
Style Name: Medium Italic
PS Font Name (the one that was conflicting on a Mac): SauceCodeProNerdC-MediumItalic (it gets automatically shortened to e.g. "It" if it's >~32 symbols)
Full Name: Sauce Code ProNerdC Medium Italic
(OT-Specific names) Mac Name: Sauce Code ProNerdC Medium Italic (though I'm not sure where these OT-specific names are relevant)

No more naming conflicts, no more "NerdFontComplete" in drop-down menus in apps!
Now, this could also be accomplished in FontForge GUI, but would be much more cumbersome. When FontForge allows access by scripts to style names as well, this could all be automated in a script.

I think it might be even possible as is if you can try to guess a style name from a file name or font properties and try to trick FontForge into reading a specially constructed full name (with a hyphen separating name from style) to write the correct style name, but I don't know how FontForge autoguess is working

@eugenesvk
Copy link

Actually, was wrong about FontForge not allowing scripting access to all the names — that github ticket threw me off. The sfnt_names from FF scripting commands is a string that has all the SFNT fields (see Name IDs) and appendSFNTName command allows to change any of them with either a name ID listed in the link.
So it's possible to do everything inside a FontForge script without the help of any other application (and, more importantly, without having to do any manual adjustments).

@ryanoasis
Copy link
Owner

@eugenesvk Yep! I was aware of the sfnt_names and actually I think I have the changes that should solve the issue right now. Just haven't released or pushed to any branch.

Thank you for the detailed info I think it is helpful 👍

I think at some point adding configuration files to denote the subfont/style name might be needed. Because some fonts have it after the dash in the filename as a convention but some don't. Also some fonts have the incorrect Styles (SubFamily) when viewed in FontForge (e.g. SourceCodePro-ExtraLight.ttf) as shown below:

selection_23_02_16_11 15 11_794x579_001

WIP Changes preview:
https://gist.github.com/ryanoasis/af51f008838aaa46fb61

particularly of note: sourceFont.appendSFNTName('English (US)', 'SubFamily', subFamily)

@eugenesvk
Copy link

Yeah, Source Code is unfortunately a mess in this regard (I also had to change all the font names for these fonts to be correctly reflected in e.g. ST3 — didn't understand why the same name would work on Mac, but fail to work on a Windows, then realized the font names are inconsistent).
I think the reason why Source Code SubFamily here is Regular instead of ExtraLight is that there is a stupid old convention of limiting styles to 4 (regular, bold, italic, bold italic). So ExtraLight doesn't fit and has to be included in a separate family "Source Code ExtraLight" with Regular/Bold/Italic/BI substyles of its own.
However, the OpenType names of this font are correct (because OT got rid of that 4-style limitation), so in your scripts you'd want to read OpenType names ('Preferred Styles' and 'Preferred Family') instead of just 'SubFamily' and 'Family'. And only if OpenType names aren't present, use the regular ones.

Thanks for the gist — I'm also trying to adjust exactly this so that I don't have to do any manual changes, so it's helpful to see what you've done.

And just to reiterate — to me the default FontLab options I've described above are ideal, so I'd suggest you follow them in your scripts as well (overwriting the default Source Code mess, for example), but of course it's up to you.

@eugenesvk
Copy link

I'd also suggest in the output to write OpenType names in addition to the regular ones, as they have a priority (e.g. Mac would display OpenType names over regular ones on conflict, think same is true for Windows, but haven't checked)

A quick reference table from my script (names in comments are from FontLab)

sourceFont.appendSFNTName('English (US)', 'Family', "family")                # 'Family Name', 'Menu Name'
sourceFont.appendSFNTName('English (US)', 'SubFamily', "SubFamStyle")        # 'Style Name'
sourceFont.appendSFNTName('English (US)', 'Fullname', "fullname")            # 'Full Name'
sourceFont.appendSFNTName('English (US)', 'PostScriptName', "PS Name")       # 'PS Font Name'
sourceFont.appendSFNTName('English (US)', 'Preferred Family', "PrefFam")     # (OT-specific) 'OT Family Name'
sourceFont.appendSFNTName('English (US)', 'Preferred Styles', "PrefSubFam")  # (OT-specific) 'OT Style Name'
sourceFont.appendSFNTName('English (US)', 'Compatible Full', "CompatFull")   # 'FOND name', (OT-specific) 'Mac Name'

And just FYI similar reference re. default naming functions (FF) is FontForge app names

familyname   # (FF) 'Family Name', overwrites 'Family' if not set via appendsfnt
fullname     # (FF) 'Name For Humans', overwrites 'Full Name' if not set via appendsfnt
fontname     # (FF) 'Fontname', overwrites 'PS Font Name' if not set via appendsfnt"

P.S. Just realized during testing that FontForge introduces another layer of useless quadruplication — the fullname, familyname, and fontname variables are actually NOT the same as any of the SFNT variables. These are unique names present in the PS Names menu within 'Font Info' — and these names aren't even visible in other apps (checked FontLab, FontCreator, though can see (FF) 'Family Name' in Mac Glyphs)

@ryanoasis
Copy link
Owner

old convention of limiting styles

Did not know this thanks!

read OpenType names [...] And only if OpenType names aren't present, use the regular ones.

Nice. I think I even overlooked that in the screenshot I posted 😊 . Yes I think this makes sense and I this seems like the logic to go with here.

FontLab options

Sorry I did read your suggestion but have not really gone through it in detail. Just FYI the gist I posted was work done before any of your messages so the new information you have provided will help me greatly in making this patcher 'do the right thing'. 👍

shortening font names always

Also as you mentioned in #58, this one is the only one I am still not sure on. I will reply there

@eugenesvk
Copy link

old convention of limiting styles

That's what I got from that Adobe document

"16 Preferred Family; For historical reasons, font families have contained a maximum of four styles, but font designers may group more than four fonts to a single family. The Preferred Family allows font designers to include the preferred family grouping which contains more than four fonts. This ID is only present if it is different from ID 1."

.

have not really gone through it in detail

I'm basically arguing for three key principles:

  1. Putting full style (weight, width, and angle) in style name (e.g. Condensed Bold Italic) instead of only doing this for OpenType-specific names and following the useless tradition in regular names. This also means that no style information is contained in the 'Family Name' (no more Source Code Pro ExtraLight as a different family from Source Code Pro)
  2. Making OpenType-specific names and regular names identical
  3. Filling in all available naming fields so that you can control the consistency of names along that unnecessary complexity of legacy duplicates

Re. #58 — while thinking about shorter names, don't forget about the larger point of reducing ~36 combinations to 2 :)

@ryanoasis
Copy link
Owner

Good stuff thanks again.

Yeah I think I am in agreement with you on all 3 of the main points as you described them.

#58 - yeah that is definitely something to consider. Also claiming a bunch of font variations is a bit deceiving if most of them aren't very useful 😝

@jrolfs
Copy link
Collaborator

jrolfs commented Mar 5, 2016

Just noticed this thread after I created #61, hopefully it's a start towards solving this?

@ryanoasis
Copy link
Owner

@jrolfs Yes and I replied on #61, seems like your work at least will help solve. I might have a bit of conflict with https://gist.github.com/ryanoasis/af51f008838aaa46fb61 but I think I soon need to setup a test branch for us to check how the fonts come out.

ryanoasis added a commit that referenced this issue Mar 19, 2016
* this is at least a partial untested/unverified start to the fix
* this will probably also include at least some part of Pull Request #61
@adamclaxon
Copy link

I have run into a variant of this issue as well. The script seems to assume the font name is the same as the family name. While the font's I have generated are now organized correctly in Font Book, all variants are generated with the same font name, and Font Book interprets them as Duplicates. The proper method I have found (at least on OS X) is for the style to be included in the font name ("OperatorMonoItalic", for instance).

ryanoasis added a commit that referenced this issue Mar 28, 2016
* restores part of logic from PR #61 from @jrolfs but slightly modified to work after them merge
@ryanoasis
Copy link
Owner

@adamclaxon

Thanks I think we are getting close to getting this fixed now. You are correct it seems that the font name needs the style to identify it properly as a separate font variant.

If you want (and it would be a great help!) you can try patching with the 0.7.0 branch because it seems to be solving most of the issues so far at least.

FluxAugur pushed a commit to FluxAugur/nerd-fonts that referenced this issue May 25, 2016
Preserve Icon Settings Across Locales.

Fixes ryanoasis#56.
@Undistraction
Copy link

Similar / related issue:

Fontname: Example-ReguarItalic
Fontfamily: Example
Name For Humans: ExampleRegularItalic
Weight: Regular

When I generate an .otf file and open it in Fontbook, the font is shown within Example as 'Regular' rather than RegularItalic, meaning it conflicts with the genuine Regular (non-italic) face.

@shelldandy
Copy link

I'm having similar issues still in the sense that I have several weights of fonts with italics versions however all of the italics get assigned the Bold weight for some reason

@shelldandy
Copy link

@ryanoasis its a bit weird since i mean the font gets actually rendered and you can select it but it will look like other weight.

So even if it says its the light font it will show as bold 🤔

@shelldandy
Copy link

also forgot to add, yeah the bug happens only after patching

@ryanoasis
Copy link
Owner

@Mike3run Oh! So it's not an issue with some showing up or not showing up as selectable but how the style is rendered?

I wonder if the same thing would happen for you with for instance with Hasklug (Hasklig). It seems to render the correct style/weight for me on Linux:

selection_037

@shelldandy
Copy link

Is a mixture of both, on the official fontbook app they do show with names but in a more specialized app like the one on my screenshot above or below they do not show possibly since they are being repeated:

@shelldandy
Copy link

So you can see on the right I have all the fonts + italic versions but when imported on the italic ones only the light shows up.

On my laptop the same installed fonts make only the bold one show up as italic

@ryanoasis
Copy link
Owner

Thanks, this might take some more digging 😟

@zxaos
Copy link

zxaos commented Mar 7, 2018

If your system is affected by this, note that having the fonts that Font Book flags as duplicates (i.e.more than a single Italic variant) active will crash iterm2 if you try to set any font from the family in use. Disabling all italic variants but one will resolve the issue.

@shelldandy
Copy link

But then you wouldn't have bold support :(((((((((((
Although yeah I actually did what you say a year ago and it works

@zxaos
Copy link

zxaos commented Mar 7, 2018

I'm not happy without bold italic support, but I'd rather have the icons at all than it.

... But as this issue is happening on 1.2.0 still, it might need to be reopened? ( @ryanoasis ? )

@ryanoasis
Copy link
Owner

Going to reopen because:

  1. Obviously still an issue
  2. The commit to close was an "Attempt to fix" and no verification was done to ensure
  3. This issue was fallen off of the radar.. I last commented almost a year ago. Apologies to @Undistraction and @Mike3run

Thanks @zxaos for getting this back to visibility for me.

I don't know if this will be apart of the next release or not. Goal of 1 per month has been severely lagging. Need to revisit methodology perhaps

@ryanoasis ryanoasis reopened this Mar 8, 2018
@ryanoasis
Copy link
Owner

Maybe we can make some traction on this again this month. I won't be able to test any potential fixes but I could upload zips if others (who are on macos) can test them out?

@zxaos
Copy link

zxaos commented Apr 4, 2018

@ryanoasis Can do! Thanks for looking into it, happy to help with testing out fixes

@jackcogdill
Copy link

+1 this issue is still happening.

@MarioRicalde
Copy link

Here's the manual solution to the problem: #257 (comment)

@ryanoasis I think it's just a matter of having better Fontname generators that output shorter names.

@ryanoasis
Copy link
Owner

I know this has fallen off the radar. Trying to come up with better system to keep up with the issues

@Finii
Copy link
Collaborator

Finii commented Jan 30, 2023

This is implemented/solved since v2.2.0 via --makegroups command line option.
With v3.0.0 all prepatched fonts will switch their naming to this.
Thanks for the excellent writeup, that I just now found 🙄

@Finii Finii closed this as completed Jan 30, 2023
@zxaos
Copy link

zxaos commented Feb 10, 2023

--makegroups improves but does not totally solve this problem, at least for me.

For example Operator Mono normally comes in 8 styles that FontBook recognizes as a single font:

  • Bold
  • Bold Italic
  • Book
  • Book Italic
  • Light
  • Light Italic
  • Medium
  • Medium Italic

Patching it with --makegroups does indeed prevent macos Fontbook from bailing on the duplicated italic names... but it also causes the Book and Book Italic styles to be split into an entirely different font (OperatorMonoSSm Book Nerd Font, vs OperatorMonoSSm Nerd Font).

Could this be reopened since it's still not fixed?

@Finii
Copy link
Collaborator

Finii commented Feb 11, 2023

Thanks for the feedback.
Can you provide a screenshot of fontbook? Unfortunately I have no MacOS avail.

I assume you self patched, but which fonts? The ones currently in this repo, i.e. at master/HEAD?

@Finii
Copy link
Collaborator

Finii commented Feb 11, 2023

Ah, Operator Mono ...
Trying to reproduce...

image

Now examining the names

image

Zoom into the family names:

 Family                                                  | | Subfamily                      | | Typogr. Family                           | | Typogr. Subfamily
 ------------------------------------------------------- |-| ------------------------------ |-| ---------------------------------------- |-| ----------------------------------------
 OperatorMono Book Nerd Font                             | | Italic                         | |                                          | |
 OperatorMono Book Nerd Font                             | | Regular                        | |                                          | |
 OperatorMonoExtra Nerd Font Light                       | | Italic                         | | OperatorMonoExtra Nerd Font              | | Light Italic
 OperatorMonoExtra Nerd Font Light                       | | Regular                        | | OperatorMonoExtra Nerd Font              | | Light
 OperatorMono Nerd Font                                  | | Bold Italic                    | |                                          | |
 OperatorMono Nerd Font                                  | | Bold                           | |                                          | |
 OperatorMono Nerd Font Light                            | | Italic                         | | OperatorMono Nerd Font                   | | Light Italic
 OperatorMono Nerd Font Light                            | | Regular                        | | OperatorMono Nerd Font                   | | Light
 OperatorMono Nerd Font Medium                           | | Italic                         | | OperatorMono Nerd Font                   | | Medium Italic
 OperatorMono Nerd Font Medium                           | | Regular                        | | OperatorMono Nerd Font                   | | Medium

Ok, I'll examine.
Thanks for reporting!

@Finii Finii reopened this Feb 11, 2023
@Finii
Copy link
Collaborator

Finii commented Feb 11, 2023

Ah yes, there is a special rule for that, need to remember why...

image

Here Book is just used as weight. We handle it not as weight.
Also: ExtraLight is not detected as weight extralight but as name extension extra and weight light 🤔

Edit: Add observation on extralight

@Finii
Copy link
Collaborator

Finii commented May 1, 2023

Should be fixed with 3.0.0

@Finii Finii closed this as completed May 1, 2023
Copy link
Contributor

github-actions bot commented Nov 6, 2023

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 Nov 6, 2023
LNKLEO pushed a commit to LNKLEO/Nerd that referenced this issue Nov 24, 2023
* this is at least a partial untested/unverified start to the fix
* this will probably also include at least some part of Pull Request ryanoasis#61
LNKLEO pushed a commit to LNKLEO/Nerd that referenced this issue Nov 24, 2023
…ryanoasis#61)

* restores part of logic from PR ryanoasis#61 from @jrolfs but slightly modified to work after them merge
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests