Skip to content

Commit

Permalink
Use kurbo for transform and point types
Browse files Browse the repository at this point in the history
  • Loading branch information
rsheeter committed Jan 22, 2023
1 parent 549f20f commit 5662be2
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 296 deletions.
3 changes: 3 additions & 0 deletions fontir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ serde_yaml = "0.9.14"
bincode = "1.3.3"
filetime = "0.2.18"
thiserror = "1.0.37"

kurbo = { version = "0.9.0", features = ["serde"] }
ordered-float = { version = "3.4.0", features = ["serde"] }

indexmap = "1.9.2"

blake3 = "1.3.3"
Expand Down
20 changes: 2 additions & 18 deletions fontir/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
};
use fontdrasil::types::GlyphName;
use indexmap::IndexSet;
use kurbo::Affine;
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
Expand Down Expand Up @@ -146,24 +147,7 @@ pub struct Component {
/// The name of the referenced glyph.
pub base: String,
/// Affine transformation to apply to the referenced glyph.
pub transform: Affine2x3,
}

/// A 2×3 affine transformation matrix.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct Affine2x3 {
/// x-component of transformed x-basis vector.
pub xx: f64,
/// y-component of transformed x-basis vector.
pub yx: f64,
/// x-component of transformed y-basis vector.
pub xy: f64,
/// y-component of transformed y-basis vector.
pub yy: f64,
/// x-component of translation vector.
pub dx: f64,
/// y-component of translation vector.
pub dy: f64,
pub transform: Affine,
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion glyphs-reader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
kurbo = "0.5.1"
plist_derive = { path = "plist_derive" }
ordered-float = "3.4.0"
kurbo = { version="0.9.0", features=["serde"] }

thiserror = "1.0.37"

Expand Down
Loading

0 comments on commit 5662be2

Please sign in to comment.