Inter: --compact-style-names not working for me & not to Google Fonts spec

Created on 6 Oct 2019  Â·  3Comments  Â·  Source: rsms/inter

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 (https://github.com/google/fonts/pull/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: f06fa4f9
bug

Most helpful comment

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

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 bc8b267b01d4652334e6f4a5452e77fbf79b329d

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

All 3 comments

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!

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

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 bc8b267b01d4652334e6f4a5452e77fbf79b329d

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ivan-kleshnin picture ivan-kleshnin  Â·  6Comments

chrisdrackett picture chrisdrackett  Â·  6Comments

PolMrt picture PolMrt  Â·  5Comments

ghost picture ghost  Â·  5Comments

vladmoroz picture vladmoroz  Â·  3Comments