[fvar.py] FAIL if there is no regular instance in regular_x_coord checks
@@ -26,7 +26,11 @@ def com_google_fonts_check_varfont_regular_wght_coord(ttFont, regular_wght_coord
"""The variable font 'wght' (Weight) axis coordinate must be 400 on the
'Regular' instance."""
- if regular_wght_coord == 400:
+ if regular_wght_coord is None:
+ yield FAIL, \
+ Message("no-regular-instance",
+ '"Regular" instance not present.')
+ elif regular_wght_coord == 400:
yield PASS, "Regular:wght is 400."
else:
yield FAIL,\
@@ -53,7 +57,11 @@ def com_google_fonts_check_varfont_regular_wght_coord(ttFont, regular_wght_coord
def com_google_fonts_check_varfont_regular_wdth_coord(ttFont, regular_wdth_coord):
"""The variable font 'wdth' (Width) axis coordinate must be 100 on the 'Regular' instance."""
- if regular_wdth_coord == 100:
+ if regular_wdth_coord is None:
+ yield FAIL, \
+ Message("no-regular-instance",
+ '"Regular" instance not present.')
+ elif regular_wdth_coord == 100:
yield PASS, "Regular:wdth is 100."
else:
yield FAIL,\
@@ -80,7 +88,11 @@ def com_google_fonts_check_varfont_regular_wdth_coord(ttFont, regular_wdth_coord
def com_google_fonts_check_varfont_regular_slnt_coord(ttFont, regular_slnt_coord):
"""The variable font 'slnt' (Slant) axis coordinate must be zero on the 'Regular' instance."""
- if regular_slnt_coord == 0:
+ if regular_slnt_coord is None:
+ yield FAIL, \
+ Message("no-regular-instance",
+ '"Regular" instance not present.')
+ elif regular_slnt_coord == 0:
yield PASS, "Regular:slnt is zero."
else:
yield FAIL,\
@@ -107,7 +119,11 @@ def com_google_fonts_check_varfont_regular_slnt_coord(ttFont, regular_slnt_coord
def com_google_fonts_check_varfont_regular_ital_coord(ttFont, regular_ital_coord):
"""The variable font 'ital' (Italic) axis coordinate must be zero on the 'Regular' instance."""
- if regular_ital_coord == 0:
+ if regular_ital_coord is None:
+ yield FAIL, \
+ Message("no-regular-instance",
+ '"Regular" instance not present.')
+ elif regular_ital_coord == 0:
yield PASS, "Regular:ital is zero."
else:
yield FAIL,\
@@ -135,7 +151,11 @@ def com_google_fonts_check_varfont_regular_ital_coord(ttFont, regular_ital_coord
def com_google_fonts_check_varfont_regular_opsz_coord(ttFont, regular_opsz_coord):
"""The variable font 'opsz' (Optical Size) axis coordinate should be between 10 and 16 on the 'Regular' instance."""
- if regular_opsz_coord >= 10 and regular_opsz_coord <= 16:
+ if regular_opsz_coord is None:
+ yield FAIL, \
+ Message("no-regular-instance",
+ '"Regular" instance not present.')
+ elif regular_opsz_coord >= 10 and regular_opsz_coord <= 16:
yield PASS, f"Regular:opsz coordinate ({regular_opsz_coord}) looks good."
else:
yield WARN,\
