From 7f0fcda3764e261612021e5ec66d536bb5ee98ef Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 8 Nov 2023 23:42:34 +0100 Subject: Move some things out of `util` --- crates/typst-library/src/lib.rs | 4 ++-- crates/typst-library/src/prelude.rs | 2 +- crates/typst-library/src/visualize/image.rs | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'crates/typst-library') diff --git a/crates/typst-library/src/lib.rs b/crates/typst-library/src/lib.rs index da31409a..554e7bcb 100644 --- a/crates/typst-library/src/lib.rs +++ b/crates/typst-library/src/lib.rs @@ -14,8 +14,8 @@ pub mod symbols; pub mod text; pub mod visualize; -use typst::eval::{Array, LangItems, Library, Module, Scope}; -use typst::geom::{Align, Color, Dir, Smart}; +use typst::eval::{Array, LangItems, Library, Module, Scope, Smart}; +use typst::geom::{Align, Color, Dir}; use typst::model::{NativeElement, Styles}; use self::layout::LayoutRoot; diff --git a/crates/typst-library/src/prelude.rs b/crates/typst-library/src/prelude.rs index e3163e0f..00700540 100644 --- a/crates/typst-library/src/prelude.rs +++ b/crates/typst-library/src/prelude.rs @@ -18,7 +18,7 @@ pub use typst::doc::*; #[doc(no_inline)] pub use typst::eval::{ array, cast, dict, format_str, func, scope, ty, Args, Array, Bytes, Cast, Dict, - FromValue, Func, IntoValue, Repr, Scope, Str, Symbol, Type, Value, Vm, + FromValue, Func, IntoValue, Repr, Scope, Smart, Str, Symbol, Type, Value, Vm, }; #[doc(no_inline)] pub use typst::geom::*; diff --git a/crates/typst-library/src/visualize/image.rs b/crates/typst-library/src/visualize/image.rs index 6e166bc0..7f0b8289 100644 --- a/crates/typst-library/src/visualize/image.rs +++ b/crates/typst-library/src/visualize/image.rs @@ -1,7 +1,5 @@ use std::ffi::OsStr; -use std::path::Path; -use typst::geom::{self, Smart}; use typst::image::{Image, ImageFormat, RasterFormat, VectorFormat}; use typst::util::option_eq; @@ -135,7 +133,7 @@ impl Layout for ImageElem { let format = match self.format(styles) { Smart::Custom(v) => v, Smart::Auto => { - let ext = Path::new(self.path().as_str()) + let ext = std::path::Path::new(self.path().as_str()) .extension() .and_then(OsStr::to_str) .unwrap_or_default() @@ -213,7 +211,7 @@ impl Layout for ImageElem { // Create a clipping group if only part of the image should be visible. if fit == ImageFit::Cover && !target.fits(fitted) { - frame.clip(geom::Path::rect(frame.size())); + frame.clip(Path::rect(frame.size())); } // Apply metadata. -- cgit v1.2.3