Skip to content

Commit

Permalink
New check: base_has_width
Browse files Browse the repository at this point in the history
Check base characters have non-zero advance width.

Added to the Universal profile
(issue #4906)
  • Loading branch information
felipesanches committed Dec 28, 2024
1 parent 83db7cc commit d679eb5
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ A more detailed list of changes is available in the corresponding milestones for
- to implement a backwards compatibility mechanism

### New checks
#### Added to the Universal profile
- **[base_has_width]:** Check base characters have non-zero advance width. (issue #4906)

#### Added to the OpenType profile
- **[STAT/ital_axis]**: Replaces the old checks (**opentype/italic_axis_in_stat**, **opentype/italic_axis_in_stat_is_boolean** and **opentype/italic_axis_last**) from the same profile (issue #4865)

Expand Down
11 changes: 1 addition & 10 deletions Lib/fontbakery/checks/tabular_kerning.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fontbakery.prelude import check, Message, FAIL, SKIP
from fontbakery.utils import mark_glyphs


@check(
Expand Down Expand Up @@ -159,16 +160,6 @@ def digraph_kerning(ttFont, glyph_list, expected_kerning):
and get_kerning(glyph_list) == expected_kerning
)

def mark_glyphs(ttFont):
marks = []
if "GDEF" in ttFont and ttFont["GDEF"].table.GlyphClassDef:
class_def = ttFont["GDEF"].table.GlyphClassDef.classDefs
glyphOrder = ttFont.getGlyphOrder()
for name in glyphOrder:
if name in class_def and class_def[name] == 3:
marks.append(name)
return marks

# Font has no numerals at all
if not all([glyph_name_for_character(ttFont, c) for c in "0123456789"]):
yield SKIP, "Font has no numerals at all"
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/adobefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"alt_caron",
"arabic_high_hamza",
"arabic_spacing_symbols",
"base_has_width",
"case_mapping",
"cjk_chws_feature", # was temporarily removed
"cjk_not_enough_glyphs",
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/fontbureau.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"pending_review": [
"opentype/weight_class_fvar",
"opentype/slant_direction",
"base_has_width",
"cjk_not_enough_glyphs",
"cmap/format_12",
"color_cpal_brightness",
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/fontwerk.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
],
"pending_review": [
"epar",
"base_has_width",
"googlefonts/axes_match",
"overlapping_path_segments",
"typographic_family_name",
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/microsoft.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"opentype/slant_direction",
"opentype/weight_class_fvar",
#
"base_has_width",
"cjk_not_enough_glyphs",
"cmap/format_12",
"color_cpal_brightness",
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/typenetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
],
"pending_review": [
"epar",
"base_has_width",
],
"sections": {
"Type Network": [
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"alt_caron",
"arabic_high_hamza",
"arabic_spacing_symbols",
"base_has_width",
"caps_vertically_centered",
"case_mapping",
"cjk_chws_feature",
Expand Down
11 changes: 11 additions & 0 deletions Lib/fontbakery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,3 +849,14 @@ def close_but_not_on(value_expected, value_true, tolerance):
if abs(value_expected - value_true) <= tolerance:
return True
return False


def mark_glyphs(ttFont):
marks = []
if "GDEF" in ttFont and ttFont["GDEF"].table.GlyphClassDef:
class_def = ttFont["GDEF"].table.GlyphClassDef.classDefs
glyphOrder = ttFont.getGlyphOrder()
for name in glyphOrder:
if name in class_def and class_def[name] == 3:
marks.append(name)
return marks

0 comments on commit d679eb5

Please sign in to comment.