Skip to content

[base_has_width] complains about glyphs that are GDEF marks or are PUA and fails to complain about real problems #5007

@bobh0303

Description

@bobh0303

Observed behaviour

Check FAILs and reports glyphs that are either:

  1. classified as marks in GDEF but are not known to be NSM due to out-of-date unicodedata
  • Example: with SIL's Scheherazade, uni0897 is in the GDEF mark table but is reported for not having width.
  1. glyphs for codepoints in the Private Use Area
  • Example: with SIL's Charis, uniF176 is a PUA character that, as intended, has zero width but is not a mark.

Check PASSes:

  1. on some glyphs even thought it shouldn't
  • Example: Scheherazade's current release encodes uniFFFC as an empty glyph with no width and should have been flagged by this check.

Finally, there is no pytest for this check

Expected behaviour

Glyphs classified in GDEF as marks or encoded as PUA should not report as FAIL

Glyphs that are actually fails should be reported

There should be a pytest for this check

Resources and steps needed to reproduce

If you wish to reproduce with the above mentioned fonts, they can be downloaded from https://software.sil.org/scheherazade/download/ and https://software.sil.org/charis/download/

I'm running fontbakery from source, currently at commit 780e2b2
OS: Ubuntu 24.04.2 LTS

Root causes

For problems 1 and 3, the root cause is a mistake in the check:

if advance == 0 and not gid not in mark_glyphs(font.ttFont):
if is_space(codepoint):
continue
problems.append(f"{gid} (U+{codepoint:04X})")

The and not gid not in mark_glyphs(font.ttFont) (double negative) is essentially restricting the test to looking at gyphs that are classified in GDEF as marks. Just take out one of the nots.

For problem 2, If we agree that PUA need not be tested, we can add such to the is_space() function.

Finally, I've written a tests/test_checks_base_has_width.py (based on the methodology in tests/test_checks_opentype_gdef.py) that I can include in a PR with the above changes if that would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions