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

--compact-style-names not working for me & not to Google Fonts spec #206

Closed
thundernixon opened this issue Oct 6, 2019 · 3 comments
Closed
Labels
bug Something that is now the way it's supposed to be

Comments

@thundernixon
Copy link
Contributor

Bug part 1: I can't get the --compact-style-names flag to work

I am generating the designspace and UFO masters with:

make designspace

...then building the varfont with:

misc/fontbuild compile-var --compact-style-names -o build/fonts/var/Inter.var.ttf src/Inter.designspace

However, the instance names don't seem to have any change from their typical versions.

Bug part 2: The instance names do need a space between "Weight" and "Italic" names

The --compact-style-names build flag was introduced to make names compatible with Google Fonts standards (google/fonts#1908). However, if the help text is accurate, the naming convention from --compact-style-names isn't quite accurate.

    argparser.add_argument('--compact-style-names', action='store_true',
      help="Produce font files with style names that doesn't contain spaces. "\
           "E.g. \"SemiBoldItalic\" instead of \"Semi Bold Italic\"")
def collapseFontStyleName(font):
  # collapse whitespace in style name. i.e. "Semi Bold Italic" -> "SemiBoldItalic"
  font.info.styleName = re.sub(r'\s', '', font.info.styleName)
  # update info to have style changes "trickle down" to other metadata
  setFontInfo(font, font.info.openTypeOS2WeightClass)

Here's the output of FontBakery specifying the expected style names:

🔥 FAIL: Check variable font instances have correct names

  • com.google.fonts/check/varfont_instance_names
  • Instance name "Extra Light" is incorrect. It should be "ExtraLight" [code: bad-name]
  • Instance name "Extra Light Italic" is incorrect. It should be "ExtraLight Italic" [code: bad-name]
  • Instance name "Semi Bold" is incorrect. It should be "SemiBold" [code: bad-name]
  • Instance name "Semi Bold Italic" is incorrect. It should be "SemiBold Italic" [code: bad-name]
  • Instance name "Extra Bold" is incorrect. It should be "ExtraBold" [code: bad-name]
  • Instance name "Extra Bold Italic" is incorrect. It should be "ExtraBold Italic" [code: bad-name]

This will cause problems with some of the Google Fonts systems that look up fonts by their style names. This must be fixed! [code: bad-instance-names]

Admittedly, I should have caught this detail in the Pull Request thread.

Possibly, the most straightforward way to handle this is to just find instances of Extra Light,Semi Bold, and Extra Bold in the designspace, then edit these to remove spaces. The other possibility is that it could be fixed in the ttf, with FontTools.

To Reproduce
Steps to reproduce the behavior:

  1. run ./init.sh to set up the project
  2. run make designspace to set up the build
  3. run misc/fontbuild compile-var --compact-style-names -o build/fonts/var/Inter.var.ttf src/Inter.designspace to build the variable font with compact-style-names flag

Expected behavior

Instance names should be like ExtraBold Italic, not like Extra Bold Italic nor ExtraBoldItalic.

Environment

  • OS: macOS 10.14.5
  • App that renders the font [if applicable; e.g. Chrome, Adobe Illustrator]
  • Version of font: f06fa4f
@rsms
Copy link
Owner

rsms commented Oct 21, 2019

Thanks! This, "the flipped q” and some other issues are all related to me upgrading fontmake which caused some code of the fontbuild program not to be invoked. Working on a fix now!

@rsms rsms added the bug Something that is now the way it's supposed to be label Oct 21, 2019
@rsms
Copy link
Owner

rsms commented Oct 22, 2019

Okay, issues #198 and #202 have been resolved in 0ba7c2b.

Prior to that commit I also introduced a new make target dedicated to Google fonts with the creative name “googlefonts”:

make -j googlefonts

This puts fonts into build/googlefonts with compact style names.
We can use this makefile target to add any additional things we might want for Google fonts.

Introduced in bc8b267

The output file structure looks like this: (easy to change if we want to)
Screen Shot 2019-10-22 at 12 43 14

@rsms rsms closed this as completed Oct 22, 2019
@thundernixon
Copy link
Contributor Author

Awesome! This seems great. I’ll take another run through of things for the google/fonts PR this week. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is now the way it's supposed to be
Projects
None yet
Development

No branches or pull requests

2 participants