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

Possible incorrect application of --subfamily-name #1

Open
PeterDekkers opened this issue May 21, 2024 · 1 comment
Open

Possible incorrect application of --subfamily-name #1

PeterDekkers opened this issue May 21, 2024 · 1 comment

Comments

@PeterDekkers
Copy link

PeterDekkers commented May 21, 2024

Hello!

I noticed that your script applies the --subfamily-name argument to the SUBFAMILY (ID 2) entry in the name table. This is (sadly) not always correct.

The following is an excerpt from https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids about SUBFAMILY (ID 2):

In some cases, this may lead to specifying a Subfamily name of “Regular” for a font that might not otherwise be considered a regular font. For example, the Arial Black font has a Font Family name of “Arial Black” and a Subfamily name of “Regular”. Note that, in such cases, name IDs 16 and 17 should also be included, using a shared value for name ID 16 that reflects the full typographic family, and values for name ID 17 that appropriately reflect the actual design variant of each font.

So, e.g. for "Arial Black", you would pass the following arguments:

fixfont.py font.woff2 -f "Arial" -s "Black" -o output.woff2

However, then SUBFAMILY (ID 2) would be set to Black, incorrectly.

In the context of Framer, I feel that the best way to retrieve a name for a font would be to look at PREFERRED_FAMILY (ID 16) and PREFERRED_SUBFAMILY (ID 17). If those are not set, then FAMILY (ID 1) and SUBFAMILY (ID 2) values can be used.

IDs 1 & 2 are subject to a number of restrictions and peculiarities that IDs 16 & 17 are not subject to. But, values for IDs 16 & 17 will not always be present.

Additionally, deriving the names from the source filename is bound to be prone to error. I would recommend reading values from the name table, if you can.

I hope this is helpful!

@PeterDekkers
Copy link
Author

P.S.: This said, if the purpose of your script is only to make the fonts work for Framer, then maybe your approach is okay. I merely wanted to point out how fiddly font naming can be—the Microsoft OpenType Spec isn't the most straight-forward document to read and implement.

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

No branches or pull requests

1 participant