From be7cfc85d08c545abfac08098b7b33b4bd71f37e Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 27 Oct 2024 19:04:55 +0100 Subject: Split out four new crates (#5302) --- crates/typst-kit/Cargo.toml | 5 +++-- crates/typst-kit/src/fonts.rs | 10 +++++----- crates/typst-kit/src/package.rs | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'crates/typst-kit') diff --git a/crates/typst-kit/Cargo.toml b/crates/typst-kit/Cargo.toml index 13d0a34b..266eba0b 100644 --- a/crates/typst-kit/Cargo.toml +++ b/crates/typst-kit/Cargo.toml @@ -11,13 +11,14 @@ license = { workspace = true } readme = { workspace = true } [dependencies] -typst = { workspace = true } typst-assets = { workspace = true, optional = true } +typst-library = { workspace = true } +typst-syntax = { workspace = true } typst-timing = { workspace = true } typst-utils = { workspace = true } +dirs = { workspace = true, optional = true } ecow = { workspace = true } env_proxy = { workspace = true, optional = true } -dirs = { workspace = true, optional = true } flate2 = { workspace = true, optional = true } fontdb = { workspace = true, optional = true } native-tls = { workspace = true, optional = true } diff --git a/crates/typst-kit/src/fonts.rs b/crates/typst-kit/src/fonts.rs index 8c8981a1..83e13fd8 100644 --- a/crates/typst-kit/src/fonts.rs +++ b/crates/typst-kit/src/fonts.rs @@ -8,12 +8,12 @@ //! - For math: New Computer Modern Math //! - For code: Deja Vu Sans Mono -use std::path::PathBuf; +use std::fs; +use std::path::{Path, PathBuf}; use std::sync::OnceLock; -use std::{fs, path::Path}; use fontdb::{Database, Source}; -use typst::text::{Font, FontBook, FontInfo}; +use typst_library::text::{Font, FontBook, FontInfo}; use typst_timing::TimingScope; /// Holds details about the location of a font and lazily the font itself. @@ -46,7 +46,7 @@ impl FontSlot { pub fn get(&self) -> Option { self.font .get_or_init(|| { - let _scope = TimingScope::new("load font", None); + let _scope = TimingScope::new("load font"); let data = fs::read( self.path .as_ref() @@ -196,7 +196,7 @@ impl FontSearcher { #[cfg(feature = "embed-fonts")] fn add_embedded(&mut self) { for data in typst_assets::fonts() { - let buffer = typst::foundations::Bytes::from_static(data); + let buffer = typst_library::foundations::Bytes::from_static(data); for (i, font) in Font::iter(buffer).enumerate() { self.book.push(font.info().clone()); self.fonts.push(FontSlot { diff --git a/crates/typst-kit/src/package.rs b/crates/typst-kit/src/package.rs index 83978010..412c7982 100644 --- a/crates/typst-kit/src/package.rs +++ b/crates/typst-kit/src/package.rs @@ -5,8 +5,8 @@ use std::path::{Path, PathBuf}; use ecow::eco_format; use once_cell::sync::OnceCell; -use typst::diag::{bail, PackageError, PackageResult, StrResult}; -use typst::syntax::package::{ +use typst_library::diag::{bail, PackageError, PackageResult, StrResult}; +use typst_syntax::package::{ PackageInfo, PackageSpec, PackageVersion, VersionlessPackageSpec, }; -- cgit v1.2.3