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

DONT MERGE: add failing test to repro #1043 #1087

Closed
wants to merge 1 commit into from
Closed
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
32 changes: 32 additions & 0 deletions fontbe/src/features/marks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,4 +1337,36 @@ mod tests {

assert_eq!(values, [239, 271, 305]);
}

#[test]
fn mark_anchors_rounding() {
// These values are taken from Teachers-Italic.glyphs. The composite glyph
// 'ordfeminine' inherits a 'top' base anchor from a scaled 'a' component, so the
// propagated anchor ends up with float coordinates; these are expected to be
// rounded before deltas get computed in order to match the output of fontmake:
// https://github.com/googlefonts/fontc/issues/1043#issuecomment-2444388789
let out = MarksInput::new([&[0.0], &[0.75], &[1.0]])
.add_glyph("a", None, |anchors| {
anchors.add("top", [(377.0, 451.0), (386.0, 450.0), (389.0, 450.0)]);
})
.add_glyph("ordfeminine", None, |anchors| {
anchors.add("top", [(282.75, 691.25), (289.5, 689.5), (291.75, 689.5)]);
})
.add_glyph("acutecomb", None, |anchors| {
anchors.add("_top", [(218.0, 704.0), (265.0, 707.0), (282.0, 708.0)]);
})
.get_normalized_output();

assert_eq_ignoring_ws!(
out,
r#"
# mark: DFLT/dflt ## 2 MarkToBase rules
# lookupflag LookupFlag(0)
a @(x: 377 {386,389}, y: 451 {450,450})
@(x: 218 {265,282}, y: 704 {707,708}) acutecomb
ordfeminine @(x: 283 {290,292}, y: 691 {690,690})
@(x: 218 {265,282}, y: 704 {707,708}) acutecomb
"#
);
}
}
Loading