diff options
| author | Laurenz <laurmaedje@gmail.com> | 2025-01-08 11:57:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-08 10:57:56 +0000 |
| commit | dacd6acd5e73d35c6e7a7a3b144f16ae70d03daa (patch) | |
| tree | ca75ce7d4d5365fbe2424a356cefe9cb223d429f /crates/typst-kit/src | |
| parent | 0a374d238016c0101d11cbc3f4bc621f3895ad36 (diff) | |
More flexible and efficient `Bytes` representation (#5670)
Diffstat (limited to 'crates/typst-kit/src')
| -rw-r--r-- | crates/typst-kit/src/fonts.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/typst-kit/src/fonts.rs b/crates/typst-kit/src/fonts.rs index 83e13fd8..c15d739e 100644 --- a/crates/typst-kit/src/fonts.rs +++ b/crates/typst-kit/src/fonts.rs @@ -13,6 +13,7 @@ use std::path::{Path, PathBuf}; use std::sync::OnceLock; use fontdb::{Database, Source}; +use typst_library::foundations::Bytes; use typst_library::text::{Font, FontBook, FontInfo}; use typst_timing::TimingScope; @@ -52,9 +53,8 @@ impl FontSlot { .as_ref() .expect("`path` is not `None` if `font` is uninitialized"), ) - .ok()? - .into(); - Font::new(data, self.index) + .ok()?; + Font::new(Bytes::new(data), self.index) }) .clone() } @@ -196,7 +196,7 @@ impl FontSearcher { #[cfg(feature = "embed-fonts")] fn add_embedded(&mut self) { for data in typst_assets::fonts() { - let buffer = typst_library::foundations::Bytes::from_static(data); + let buffer = Bytes::new(data); for (i, font) in Font::iter(buffer).enumerate() { self.book.push(font.info().clone()); self.fonts.push(FontSlot { |
