fonttools / fontbakery

🧁 A font quality assurance tool for everyone
https://fontbakery.readthedocs.io
Apache License 2.0
550 stars 102 forks source link

check/varfont_weight_instances: Does not explain why the check is needed #2680

Open eliheuer opened 5 years ago

eliheuer commented 5 years ago

Observed behavior

The current rationale reads as follows:

The named instances on the weight axis of a variable font
must have coordinates that are multiples of 100 on the design space.

Expected behavior

We need a simple explanation of WHY this is required added to the rationale. Preferably with a link to a spec containing a further explanation.

m4rc1e commented 5 years ago

Can you think of why we might want this?

I'm asking you this because I think there's another issue here.

eliheuer commented 5 years ago

Ah, yes. It's conflicting with this condition in /Lib/fontbakery/profiles/googlefonts_conditions.py:

@condition
def expected_os2_weight(style):
  """The weight name and the expected OS/2 usWeightClass value inferred from
  the style part of the font name
  The Google Font's API which serves the fonts can only serve
  the following weights values with the corresponding subfamily styles:
  250, Thin
  275, ExtraLight
  300, Light
  400, Regular
  500, Medium
  600, SemiBold
  700, Bold
  800, ExtraBold
  900, Black
  Thin is not set to 100 because of legacy Windows GDI issues:
  https://www.adobe.com/devnet/opentype/afdko/topic_font_wt_win.html
  """

So, is this still relevant now that it is almost 2020? Or is this a bad check and we need to add an exemption for Thin and ExtraLight? Lib/fontbakery/profiles/googlefonts.py

def com_google_fonts_check_varfont_weight_instances(ttFont):
  """Variable font weight coordinates must be multiples of 100."""

  failed = False
  for instance in ttFont["fvar"].instances:
    if 'wght' in instance.coordinates and instance.coordinates['wght'] % 100 != 0:
      failed = True
      yield FAIL,\
            Message("bad-coordinate",
                    f"Found a variable font instance with"
                    f" 'wght'={instance.coordinates['wght']}."
                    f" This should instead be a multiple of 100.")

  if not failed:
    yield PASS, "OK"

Also, the link from the condition is dead and should be updated: https://www.adobe.com/devnet/opentype/afdko/topic_font_wt_win.html

eliheuer commented 5 years ago

I found some good older discussion on this from 2017: https://github.com/googlefonts/fontbakery/issues/1355 And a related issue: https://github.com/googlefonts/fontbakery/issues/1876

felipesanches commented 5 years ago

Also, the link from the condition is dead and should be updated: https://www.adobe.com/devnet/opentype/afdko/topic_font_wt_win.html

I think I'll setup a policy that any URL mentioned in the documentation must be "cached" in the Internet Archive to avoid this kind of bit-rotting...

It is done by posting the URL at https://archive.org/web/ in the "Save Page Now" form:

Captura de Tela 2019-10-30 às 03 43 36

In this specific case, we were lucky that the Internet Archive was already taking care of saving copied of those pages. So, the resulting URL would then be: https://web.archive.org/web/20180120062603/http://www.adobe.com/devnet/opentype/afdko/topic_font_wt_win.html