diff --git a/Cargo.lock b/Cargo.lock index 373ed8c..e7ae1a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3769,8 +3769,6 @@ dependencies = [ "rand", "rand_chacha", "rand_distr", - "rustybuzz", - "ttf-parser", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index dff085c..b3f845b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,6 @@ all-features = true [dependencies] plotive-base.workspace = true plotive-text.workspace = true -rustybuzz.workspace = true -ttf-parser.workspace = true # feature dsl plotive-dsl = { workspace = true, optional = true } # feature data-polars @@ -151,10 +149,10 @@ rand_distr = "0.5.1" rand_chacha = "0.9.0" rfd = "0.17.1" rustybuzz = "0.20.1" +strict-num = "0.2.0" tiny-skia = "0.11.4" tiny-skia-path = "0.11.4" tokio = { version = "1.0", features = ["rt", "rt-multi-thread", "time"] } -strict-num = "0.2.0" [workspace.dependencies.ttf-parser] version = "0.25.1" diff --git a/src/drawing.rs b/src/drawing.rs index 2c5b422..3cf6653 100644 --- a/src/drawing.rs +++ b/src/drawing.rs @@ -58,11 +58,11 @@ impl From for Error { } } -impl From for Error { - fn from(err: ttf_parser::FaceParsingError) -> Self { - Error::FontOrText(text::Error::FaceParsingError(err)) - } -} +// impl From for Error { +// fn from(err: ttf_parser::FaceParsingError) -> Self { +// Error::FontOrText(text::Error::FaceParsingError(err)) +// } +// } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/text/src/lib.rs b/text/src/lib.rs index 0b1d835..5fd9a10 100644 --- a/text/src/lib.rs +++ b/text/src/lib.rs @@ -17,7 +17,8 @@ use std::fmt; use plotive_base::geom; -use ttf_parser as ttf; +/// Publicly re-export ttf-parser, so that users of this crate can use it for custom font loading and parsing. +pub use ttf_parser as ttf; mod bidi; pub mod font; diff --git a/text/src/rich/render.rs b/text/src/rich/render.rs index 7c16bac..c8604db 100644 --- a/text/src/rich/render.rs +++ b/text/src/rich/render.rs @@ -17,7 +17,7 @@ pub fn render_rich_text_with( text: &RichText, fontdb: &fontdb::Database, mut render_fn: RenderFn, -) -> Result<(), ttf::FaceParsingError> +) -> Result<(), crate::Error> where C: Clone, RenderFn: FnMut(RichPrimitive<'_, C>), @@ -100,7 +100,7 @@ pub fn render_rich_text( transform: geom::Transform, mask: Option<&tiny_skia::Mask>, pixmap: &mut tiny_skia::PixmapMut<'_>, -) -> Result<(), ttf::FaceParsingError> { +) -> Result<(), crate::Error> { let render_fn = |primitive: RichPrimitive| match primitive { RichPrimitive::Fill(path, color) => { let mut paint = tiny_skia::Paint::default();