Skip to content

Commit

Permalink
Update savvy
Browse files Browse the repository at this point in the history
  • Loading branch information
yutannihilation committed Mar 2, 2024
1 parent 4f8fadf commit 266161e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
35 changes: 16 additions & 19 deletions src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ crate-type = ["staticlib"]
lto = true

[dependencies]
savvy = "0.2.14"
savvy = "0.2.15"
fontdb = "0.16"
lyon = "1.0"
once_cell = "1"
ttf-parser = "0.20"

[dev-dependencies]
savvy = { version = "0.2.15", features = ["fake-libR"] }
25 changes: 20 additions & 5 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,16 @@ mod tests {
.unwrap();
let result = builder.into_path();

// the height of the test.ttf is 125 (ascent 100 + descent 25)
assert_eq!(result.x, vec![0., 100. / 125., 0., 0.]);
assert_eq!(result.y, vec![0., 100. / 125., 100. / 125., 0.]);
assert!(result
.x
.iter()
.zip(vec![0., 100. / 125., 0., 0.])
.all(|(actual, expect)| (expect - actual).abs() < f64::EPSILON.sqrt()));
assert!(result
.y
.iter()
.zip(vec![0., 100. / 125., 100. / 125., 0.])
.all(|(actual, expect)| (expect - actual).abs() < 0.0001));
}

#[test]
Expand Down Expand Up @@ -245,7 +252,15 @@ mod tests {
let result = builder.into_fill();

// TODO: Is this correct...?
assert_eq!(result.x, vec![0., 0., 100. / 125.]);
assert_eq!(result.y, vec![0., 100. / 125., 100. / 125.]);
assert!(result
.x
.iter()
.zip(vec![0., 0., 100. / 125.])
.all(|(actual, expect)| (expect - actual).abs() < f64::EPSILON.sqrt()));
assert!(result
.y
.iter()
.zip(vec![0., 100. / 125., 100. / 125.])
.all(|(actual, expect)| (expect - actual).abs() < f64::EPSILON.sqrt()));
}
}
Binary file modified src/rust/vendor.tar.xz
Binary file not shown.

0 comments on commit 266161e

Please sign in to comment.