Skip to content

Commit

Permalink
Merge pull request #890 from googlefonts/fix-prop-anchors-test
Browse files Browse the repository at this point in the history
propagate_anchors: fix mis-named test case, add specific one for *origin anchors
  • Loading branch information
anthrotype authored Aug 5, 2024
2 parents 4cdee64 + ecc727d commit d1ff5e3
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions glyphs-reader/src/propagate_anchors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,16 +797,9 @@ mod tests {
}

#[test]
fn origin_anchor() {
fn component_anchor() {
// derived from the observed behaviour of glyphs 3.2.2 (3259)
let mut glyphs = GlyphSetBuilder::new()
.add_glyph("a", |glyph| {
glyph
.add_anchor("*origin", (-20, 0))
.add_anchor("bottom", (242, 7))
.add_anchor("ogonek", (402, 9))
.add_anchor("top", (246, 548));
})
.add_glyph("acutecomb", |glyph| {
glyph
.add_anchor("_top", (150, 580))
Expand Down Expand Up @@ -847,6 +840,41 @@ mod tests {
);
}

#[test]
fn origin_anchor() {
// derived from the observed behaviour of glyphs 3.2.2 (3259)
let mut glyphs = GlyphSetBuilder::new()
.add_glyph("a", |glyph| {
glyph
.add_anchor("*origin", (-20, 0))
.add_anchor("bottom", (242, 7))
.add_anchor("ogonek", (402, 9))
.add_anchor("top", (246, 548));
})
.add_glyph("acutecomb", |glyph| {
glyph
.add_anchor("_top", (150, 580))
.add_anchor("top", (170, 792));
})
.add_glyph("aacute", |glyph| {
glyph
.add_component("a", (0, 0))
.add_component("acutecomb", (116, -32));
})
.build();
propagate_all_anchors_impl(&mut glyphs);

let new_glyph = glyphs.get("aacute").unwrap();
assert_eq!(
new_glyph.layers[0].anchors,
[
("bottom", (262.0, 7.0)),
("ogonek", (422.0, 9.0)),
("top", (286.0, 760.0)),
]
);
}

#[test]
fn invert_names_on_rotation() {
// derived from the observed behaviour of glyphs 3.2.2 (3259)
Expand Down

0 comments on commit d1ff5e3

Please sign in to comment.