Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[glyphs] Add test for anchor propagation on digraph #790

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions glyphs-reader/src/propagate_anchors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ mod tests {
#[test]
fn propagate_ligature_anchors() {
// derived from the observed behaviour of glyphs 3.2.2 (3259)
// this is based on the IJ glyph in Oswald (ExtraLight)
let mut glyphs = GlyphSetBuilder::new()
.add_glyph("I", |glyph| {
glyph
Expand Down Expand Up @@ -682,6 +683,44 @@ mod tests {
)
}

#[test]
fn digraphs_arent_ligatures() {
// derived from the observed behaviour of glyphs 3.2.2 (3259)
// this is based on the IJ glyph in Oswald (ExtraLight)
let mut glyphs = GlyphSetBuilder::new()
.add_glyph("I", |glyph| {
glyph
.add_anchor("bottom", (103, 0))
.add_anchor("ogonek", (103, 0))
.add_anchor("top", (103, 810))
.add_anchor("topleft", (20, 810));
})
.add_glyph("J", |glyph| {
glyph
.add_anchor("bottom", (133, 0))
.add_anchor("top", (163, 810));
})
.add_glyph("IJ", |glyph| {
glyph
.add_component("I", (0, 0))
.add_component("J", (206, 0));
})
.build();
propagate_all_anchors_impl(&mut glyphs);
let ij = glyphs.get("IJ").unwrap();
// these were derived by running the built in glyphs.app propagate anchors
// method from the macro panel
assert_eq!(
ij.layers[0].anchors,
[
("bottom", (339., 0.)),
("ogonek", (103., 0.)),
("top", (369., 810.)),
("topleft", (20., 810.)),
]
)
}

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