Add check for chws/vchw feature presence
@@ -178,6 +178,7 @@ FONT_FILE_CHECKS = [
'com.google.fonts/check/cjk_vertical_metrics',
'com.google.fonts/check/cjk_vertical_metrics_regressions',
'com.google.fonts/check/cjk_not_enough_glyphs',
+ 'com.google.fonts/check/cjk_chws_feature',
'com.google.fonts/check/varfont_instance_coordinates',
'com.google.fonts/check/varfont_instance_names',
'com.google.fonts/check/varfont_duplicate_instance_names',
@@ -4844,6 +4845,28 @@ def com_google_fonts_check_cjk_not_enough_glyphs(ttFont):
yield PASS, "Font has the correct quantity of CJK glyphs"
+@check(
+ id = 'com.google.fonts/check/cjk_chws_feature',
+ conditions = ['is_cjk_font'],
+ rationale = """
+ The W3C recommends the addition of chws and vchw features to CJK fonts to enhance the spacing of glyphs in environments which do not fully support JLREQ layout rules.
+
+ The chws_tool utility (https://github.com/googlefonts/chws_tool) can be used to add these features automatically.
+ """,
+ proposal = 'https://github.com/googlefonts/fontbakery/issues/3363'
+)
+def com_google_fonts_check_cjk_chws_feature(ttFont):
+ """Does the font contain chws and vchw features?"""
+ from fontbakery.profiles.layout import feature_tags
+ tags = feature_tags(ttFont)
+ if "chws" not in tags or "vchw" not in tags:
+ yield WARN,\
+ Message('cjk-no-chws',
+ "chws/vchw feature not found in font. Use chws_tool (https://github.com/googlefonts/chws_tool) to add them.")
+ else:
+ yield PASS, "Font contains chws and vchw features"
+
+
@check(
id = 'com.google.fonts/check/varfont_instance_coordinates',
conditions = ['is_variable_font'],
