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

com.google.fonts/check/name/family_and_style_max_length is overly-strict #2179

Open
thundernixon opened this issue Nov 9, 2018 · 34 comments
Assignees
Labels
Five minute fix No discussion needed and practically a one-liner P0 Urgent
Milestone

Comments

@thundernixon
Copy link
Contributor

thundernixon commented Nov 9, 2018

Observed behaviour

com.google.fonts/check/name/family_and_style_max_length is overly strict, as far as I can tell. This will make unnecessary work for people to figure out abbreviations for font naming. The check says:

Combined length of family and style must not exceed 20 characters.

...and bases this off a GlyphsApp tutorial recommendation.

Here's the issue this was first brought up in: Issue 1488. It references this tutorial, but the tutorial doesn't substantiate its claim.

Expected behaviour

I propose three changes to the check:

  1. I think the test should be changed to 29 characters (or 27 at the very minimum).
  2. The test check the value in nameID="4", rather than do a simple concatenation of family and style names (nameID="1" + nameID="2").
  3. The test should also check the value in nameID=6 to verify that it is a maximum of 29 characters.

In this TypeDrawers thread, Mark Simonson describes how he keeps nameID 4 to 31 or fewer characters, in order to keep it working on MS Word 2011 for Mac. For what it's worth, this is also the value I've heard from other professional type designers, but specific references are difficult to locate.

In this Adobe Font Naming Issues PDF, the PostScript name (nameID 6) must have no spaces and be limited to 29 characters for old postscript printers (see page 8). If someone somehow had a super-long family and style name with no spaces in either, we couldn't count on spaces being removed for ID 6 (e.g. Supercalifragilistic SemiBold would become Supercalifragilistic-SemiBold, and thus my recommendation of 29 characters for both IDs 4 and 6.

The most strict naming limitation I've been able to find a reference for anywhere is this IE9 bug, which describes that IE9 can handle only up to 31 characters in a font-family declaration, meaning that after possible quotes and a semicolon and/or commas, the maximum working length of a name is 27 characters. If the GFonts CSS is automatically generated using ID 4, we could potentially limit ourselves to 27 characters instead of 29.

Is there anything concrete I've missed that really specifies 20 characters being a true limit, and where in what software there are problems beyond that? If so, we can follow that limitation. However, I believe the GlyphsApp tutorial may just be throwing that low number out as an easy guidline to remember, not as a verified limitation.

Why it matters to be accurate

Especially in fonts which have widths and weights (e.g. Encode Sans), a limit of 20 characters is unecessarily difficult to achieve.

One of the font instance currently hosted on Google Fonts has a nameID 4 of Encode Sans Semi Condensed ExtraLight, which is 37 characters. That would need to be abbreviated in nameID 4 to show up in IE9 or in MSWord2011 for Mac. Right now, both cases are very likely failing.

To shorten that to 20 characters, it has to be something very cryptic, like EncodeSans-SmCndXLgt. It's hard to think of what characters to take out, and the problem would only be worse for something with a longer family name. If the check is this strict, people might end up ignoring it.

If we increase the limit to 29 characters, the same font could be something like Encode Sans SemiCond ExLight, which uses 28 characters (counting spaces) and is much more readable.

image


If no one objects to this update, I'd be happy to try updating the Font Bakery check according to my proposal. I just wanted to document my findings and get potential feedback before editing any code.

@davelab6
Copy link
Contributor

davelab6 commented Nov 9, 2018 via email

@thundernixon
Copy link
Contributor Author

@davelab6
Copy link
Contributor

davelab6 commented Nov 12, 2018

27 seems good due to the msie9 bug you discovered, and Jeff's comment on win7 installation.

Minimizing the delta between ttf and cff is good to enable end user conversion between them

@thundernixon
Copy link
Contributor Author

@davelab6 Sorry, where/what was Jeff's comment on win7? Based on answers in the GlyphsApp forum, installation on Windows does seem to be the hardest limitation.

27 could work, though it might still be more strict than we need. Do you expect there to be cases where the nameID 4 is used for in a @font-face font-family CSS declaration?

Looking at an example of CSS from Gfonts, the family name of nameID 1 (e.g. "Encode Sans Semi Condensed") is used in font-family, and the style (e.g. "ExtraBold") is simply gotten with font-weight: 800. So, that particular font should work well even in IE9, though it would most likely fail to be installed on older versions of Windows.

Related: we might want to start adding "Name Table Entries" as custom params to GlyphsApp sources, as described at https://glyphsapp.com/tutorials/naming. (Maybe others are already doing this).

@davelab6 davelab6 changed the title Check 163 is overly-strict Check font family/style name lengths (gf check 163) is overly-strict Nov 21, 2018
@thundernixon
Copy link
Contributor Author

If anyone comes across this issue, I've made a simple Python script that can be triggered from the command line to abbreviate name IDs 4 & 6 to avoid issues with installation.

As an example, it will take the file EncodeSansSemiCondensed-ExtraLight.ttf, which has a full name of Encode Sans SemiCondensed ExtraLight, and:

  • abbreviate nameID 4 to Encode Sans SemiCond ExLght (27 chars)
  • abbreviate nameID 6 to EncodeSansSemiCond-ExLght (25 chars)

Here's the helper script:
https://github.com/thundernixon/Encode-Sans/blob/c5eb4d08985e860abf8f7bceb6ce198604992714/scripts/helpers/shorten-nameID-4-6.py (This version is as of Nov 26, 2018 – you may also want to check if it's been updated with any fixes).

It can be run with a command like:

python SCRIPT/PATH/shorten-nameID-4-6.py FONT/PATH/font.otf

...where you update the script path, as well as the path you're passing in with a TTF/OTF file or a folder of TTF/OTF files. Of course, this is probably most useful when added to a build shell script, in a step following FontMake font generation.

This currently works from a dictionary of style names I chose to shorten in Encode Sans, but if you have other style names, you should add them in the script:


abbreviations = {
    "Condensed": "Cond",
    "Expanded": "Expd",
    "Extra": "Ex",
    "Light": "Lght",
    "Regular": "Reg",
    "Medium": "Med"
}

If you try it and face any issues or make any improvements, let me know!

@davelab6
Copy link
Contributor

davelab6 commented Nov 26, 2018 via email

@thundernixon
Copy link
Contributor Author

@davelab6 Kind of ... their method is the reverse of what I would expect.

Per the simple naming tutorial, you do two things:

  1. Abbreviate the Family Name and the Style Names
  2. Add custom params preferredFamilyName & preferredSubfamilyName, which will be used where possible

Looking at the more in-depth naming tutorial, I see that it is also possible to add a specific custom parameter postscriptFontName to meet the 29-character limit.

For nameID 4, you must use the custom parameter Name Table Entry twice:

  • 4 3; Encode Sans Cond ExLght (Windows English Full Name)
  • 4 1; Encode Sans Cond ExLght(Mac English Full Name)

@thundernixon
Copy link
Contributor Author

@felipe this is probably a pretty quick change. I say we change the limit from 20 to 27 characters, as per discussion above.

27 is still on the very strict side, but if we want to raise it later, we can circle back.

@felipesanches
Copy link
Collaborator

thanks, @thundernixon
I'll make that change later today.

@felipesanches
Copy link
Collaborator

oh! I said I would do it but ended up not doing it. I am sorry! Will try to do it now :-)

@felipesanches felipesanches self-assigned this Apr 5, 2019
felipesanches added a commit to felipesanches/fontbakery that referenced this issue Apr 5, 2019
com.google.fonts/check/name/family_and_style_max_length

After discussing the problem in more detail at issue fonttools#2179 we decided that allowing up to 27 chars would still be on the safe side.

Please also see issue fonttools#2447
felipesanches added a commit that referenced this issue Apr 5, 2019
com.google.fonts/check/name/family_and_style_max_length

After discussing the problem in more detail at issue #2179 we decided that allowing up to 27 chars would still be on the safe side.

Please also see issue #2447
@felipesanches felipesanches modified the milestones: 0.10.8, 0.10.9 Dec 13, 2023
@felipesanches felipesanches modified the milestones: 0.10.9, 0.10.10 Jan 12, 2024
@simoncozens simoncozens added Five minute fix No discussion needed and practically a one-liner and removed Blocked - waiting for some feedback labels Jan 22, 2024
felipesanches added a commit to felipesanches/fontbakery that referenced this issue Jan 24, 2024
Updated max length requirements according to feedback from @vv-monsalve and
improved description of problems to inform the users.

Entries longer than 32 chars now emmit a FAIL.

com.google.fonts/check/name/family_and_style_max_length
on Google Fonts profile

(issue fonttools#2179)
felipesanches added a commit to felipesanches/fontbakery that referenced this issue Jan 24, 2024
Updated max length requirements according to feedback from @vv-monsalve and
improved description of problems to inform the users.

Entries longer than 32 chars now emmit a FAIL.

com.google.fonts/check/name/family_and_style_max_length
on Google Fonts profile

(issue fonttools#2179)
felipesanches added a commit that referenced this issue Jan 24, 2024
Updated max length requirements according to feedback from @vv-monsalve and
improved description of problems to inform the users.

Entries longer than 32 chars now emmit a FAIL.

com.google.fonts/check/name/family_and_style_max_length
on Google Fonts profile

(issue #2179)
@mgbella
Copy link

mgbella commented Apr 22, 2024

Hello @vv-monsalve, @felipesanches, @thundernixon, @simoncozens
I have just encountered a consequence from a 33-character font name in a Thai font: in WIN MSW, Thai displays as a fallback font. Unfortunately, I'm not able to share much info due to NDA. However, in a 16 style family with 8 weights of Roman and Italic, the ExtraBold exceeded the name limit by one (33 char). In WIN MSW, the Latin displayed just fine, but the Thai used a fallback font. All other styles displayed as expected.

Once I changed the Family Name ID 1 (Style Map Family Name in Glyphs) to use ExBold, Thai displayed properly.

Consider updating the rationale to WARN (or even FAIL) since a fallback font is used in non-Latin scripts if the name has >32 characters. Note that I haven't tested other scripts but can do so this week.

@simoncozens
Copy link
Collaborator

Thanks Glenda! I don't think an update is required, as this is consistent with what we now report - a FAIL for names > 32 characters because they cause weird inconsistencies in Word.

@vv-monsalve
Copy link
Collaborator

Thank you, @mgbella, for the added details.

@arrowtype
Copy link
Contributor

arrowtype commented Apr 24, 2024

New question here, while we’re discussing it...

It is my impression that nameID 25 (variable font postscript prefix) is used to create static fonts from variable fonts, for PDF embedding. Does anyone know if this is really the case, and how this works? If it works as I’m imagining, should we check whether nameID 25 + fvar instance > 29, because presumably such PDFs will be printed, and many printers may have old tech?

EDIT: Adobe describes the creation of postscript names from variable fonts, at https://adobe-type-tools.github.io/font-tech-notes/pdfs/5902.AdobePSNameGeneration.pdf. There, they say that the character limit of postscript names is 127 characters, and show how names should be constructed for both named instances and arbitrary axis values. Despite the much longer limit specified now, I would guess that resulting names that exceed 29 characters may still face printing issues.

@arrowtype
Copy link
Contributor

@mgbella quick question: can you say specifically which version of Windows/Word you ran into this issue on? Did you happen to test it after a computer restart? (Not sure if the latter question is relevant, but it fixes a surprising number of font issues on Mac.)

@glenda-tn
Copy link

@arrowtype
I’ve been clearing my cache a lot in this project. Each time I do that, I restart.
I use the subscription-based MS Office 365 in the cloud. I guess that means it’s always the latest version. It’s Version 16.0.17 in WIN 11, Version 23H2.

@chrissimpkins
Copy link
Member

Discussed this issue with Aaron today. He will reach out to Si at Microsoft to discuss.

@jenskutilek
Copy link
Contributor

EDIT: Adobe describes the creation of postscript names from variable fonts, at https://adobe-type-tools.github.io/font-tech-notes/pdfs/5902.AdobePSNameGeneration.pdf. There, they say that the character limit of postscript names is 127 characters, and show how names should be constructed for both named instances and arbitrary axis values. Despite the much longer limit specified now, I would guess that resulting names that exceed 29 characters may still face printing issues.

The printing issues were mentioned in a document about Type 1 fonts from 1993 (> 30 years ago), and even then it called the problematic software "the earliest versions of PostScript interpreters".

In issue #4725, linked above, I describe that I tried to provoke a conflict of font names in a PS file, and it's apparently impossible to trigger unless you write PostScript code by hand.

I think the ID 6 restrictions can be disregarded now.

The installation problem "Windows 7 refuses to consider an OpenType CFF font valid during installation when the font Family Name is longer than 29 characters" refers to an operating system that is 4 ½ years out of support.

The limit of 31 characters on ID1 and ID4 reported by @glenda-tn (which I could reproduce) seems the only relevant limit now...?

@vv-monsalve
Copy link
Collaborator

The limit of 31 characters on ID1 and ID4 reported by @glenda-tn (which I could reproduce) seems the only relevant limit now...?

Yes. We've kept confirming that MSW uses a fallback font is used when this concatenation of names plus spaces in between goes beyond 32 chars

@davelab6
Copy link
Contributor

davelab6 commented Jun 9, 2024

I think the ID 6 restrictions can be disregarded now.

@felipesanches please make it so :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Five minute fix No discussion needed and practically a one-liner P0 Urgent
Projects
None yet
Development

No branches or pull requests