Skip to content

Commit

Permalink
New check: Arabic letter high hamza isn't classified as a mark.
Browse files Browse the repository at this point in the history
Many fonts incorrectly treat ARABIC LETTER HIGH HAMZA (U+0675) as a variant of
ARABIC HAMZA ABOVE (U+0654) and make it a combining mark of the same size.

But U+0675 is a base letter and should be a variant of ARABIC LETTER HAMZA
(U+0621) but raised slightly above baseline.

Not doing so effectively makes the font useless for Jawi and
possibly Kazakh as well.

Added to the Universal Profile
com.google.fonts/check/arabic_high_hamza (experimental)
(issue fonttools#4290)
  • Loading branch information
felipesanches committed Oct 20, 2023
1 parent eeb87c8 commit 6da17ad
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A more detailed list of changes is available in the corresponding milestones for
### New checks
#### Added to the Universal Profile
- **EXPERIMENTAL - [com.google.fonts/check/arabic_spacing_symbols]:** Check that Arabic spacing symbols U+FBB2–FBC1 aren't classified as marks. (issue #4295)
- **EXPERIMENTAL - [com.google.fonts/check/arabic_high_hamza]:** Check that glyph for U+0675 ARABIC LETTER HIGH HAMZA is not a mark. (issue #4290)

### Changes to existing checks
#### On the Universal Profile
Expand Down
45 changes: 45 additions & 0 deletions Lib/fontbakery/profiles/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,51 @@ def com_google_fonts_check_spacing_symbols(ttFont):
yield PASS, "Looks good!"


@check(
id="com.google.fonts/check/arabic_high_hamza",
proposal=[
"https://github.com/googlefonts/fontbakery/issues/4290",
],
rationale="""
Many fonts incorrectly treat ARABIC LETTER HIGH HAMZA (U+0675) as a variant of
ARABIC HAMZA ABOVE (U+0654) and make it a combining mark of the same size.
But U+0675 is a base letter and should be a variant of ARABIC LETTER HAMZA
(U+0621) but raised slightly above baseline.
Not doing so effectively makes the font useless for Jawi and
possibly Kazakh as well.
""",
experimental="Since 2023/Oct/20",
severity=4,
)
def com_google_fonts_check_high_hamza(ttFont):
"""Check that glyph for U+0675 ARABIC LETTER HIGH HAMZA is not a mark."""
import babelfont

ARABIC_LETTER_HIGH_HAMZA = 0x0675

passed = True
font = babelfont.load(ttFont.reader.file.name)

if "GDEF" in ttFont:
class_def = ttFont["GDEF"].table.GlyphClassDef.classDefs
for glyph in font.glyphs:
if set(glyph.codepoints).contains(ARABIC_LETTER_HIGH_HAMZA):
if glyph.name in class_def and class_def[glyph.name] == 3:
passed = False
yield FAIL, Message(
"mark-in-gdef",
f'"{glyph.name}" is defined in GDEF as a mark (class 3).',
)
# TODO: Should we also validate the bounding box of the glyph and compare
# it to U+0621 expecting them to have roughly the same size?
# (within a certain tolerance margin)

if passed:
yield PASS, "Looks good!"


@check(
id="com.google.fonts/check/required_tables",
conditions=["ttFont"],
Expand Down

0 comments on commit 6da17ad

Please sign in to comment.