Skip to content
12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ homepage = "https://github.com/image-rs/imageproc"
exclude = [".github/*", "examples/*", "tests/*"]

[features]
default = ["rayon", "image/default"]
default = ["rayon", "image/default", "text", "image_hash"]
display-window = ["sdl2"]
rayon = ["dep:rayon", "image/rayon"]

# Option: enable image_hash
image_hash = ["dep:rustdct"]

# Option: enable drawing::text
text = ["dep:ab_glyph"]

[dependencies]
ab_glyph = { version = "0.2.23", default-features = false, features = ["std"] }
ab_glyph = { version = "0.2.23", default-features = false, features = ["std"], optional = true}
approx = { version = "0.5", default-features = false }
image = { version = "0.25.0", default-features = false }
itertools = { version = "0.14.0", default-features = false, features = [
Expand All @@ -36,7 +42,7 @@ sdl2 = { version = "0.38.0", optional = true, default-features = false, features
"bundled",
] }
katexit = { version = "0.1.4", optional = true, default-features = false }
rustdct = "0.7.1"
rustdct = { version = "0.7.1", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.3.0", default-features = false, features = ["wasm_js"] }
Expand Down
3 changes: 3 additions & 0 deletions src/drawing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ pub use self::rect::{
draw_filled_rect, draw_filled_rect_mut, draw_hollow_rect, draw_hollow_rect_mut,
};

#[cfg(feature = "text")]
mod text;

#[cfg(feature = "text")]
pub use self::text::{draw_text, draw_text_mut, text_size};

mod fill;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub mod gradients;
pub mod haar;
pub mod hog;
pub mod hough;
#[cfg(feature = "image_hash")]
pub mod image_hash;
pub mod integral_image;
pub mod kernel;
Expand Down
1 change: 1 addition & 0 deletions tests/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ fn test_bilateral_filter() {
}

#[test]
#[cfg(feature = "text")]
fn test_draw_text() {
let font_bytes = include_bytes!("data/fonts/DejaVuSans.ttf");
let font = ab_glyph::FontRef::try_from_slice(font_bytes).unwrap();
Expand Down
Loading