Skip to content

Commit

Permalink
builder_test: ajust test for non-liga (e.g. digraphs) where last comp…
Browse files Browse the repository at this point in the history
…onent wins

#368 (comment)

test borrowed from #1007 (which this PR will supersede)
  • Loading branch information
anthrotype committed Jul 30, 2024
1 parent 285540d commit 8ee8e45
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/builder/builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ def test_propagate_anchors_on(ufo_module):
("dad", [("sad", 0, 0), ("dotabove", 50, 50)], []),
("dadDotbelow", [("dad", 0, 0), ("dotbelow", 50, -50)], []),
("yod", [], [("bottom", 50, -50)]),
("yodyod", [("yod", 0, 0), ("yod", 100, 0)], []),
("yod_yod", [("yod", 0, 0), ("yod", 100, 0)], []), # ligature
("yodyod", [("yod", 0, 0), ("yod", 100, 0)], []), # not a ligature
)
for name, component_data, anchor_data in glyphs:
add_glyph(font, name)
Expand All @@ -160,7 +161,20 @@ def test_propagate_anchors_on(ufo_module):
assert anchor.name == "top"
assert anchor.y == 200

# 'yodyod' isn't explicitly classified as a 'ligature' hence it will NOT
# inherit two 'bottom_1' and 'bottom_2' anchors from each 'yod' component,
# but only one 'bottom' anchor from the last component.
# https://github.com/googlefonts/glyphsLib/issues/368#issuecomment-2103376997
glyph = ufo["yodyod"]
assert len(glyph.anchors) == 1
for anchor in glyph.anchors:
assert anchor.name == "bottom"
assert anchor.y == -50
assert anchor.x == 150

# 'yod_yod' is a ligature hence will inherit two 'bottom_{1,2}' anchors
# from each 'yod' component
glyph = ufo["yod_yod"]
assert len(glyph.anchors) == 2
for anchor in glyph.anchors:
assert anchor.y == -50
Expand Down

0 comments on commit 8ee8e45

Please sign in to comment.