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-svg | |
| parent | 0a374d238016c0101d11cbc3f4bc621f3895ad36 (diff) | |
More flexible and efficient `Bytes` representation (#5670)
Diffstat (limited to 'crates/typst-svg')
| -rw-r--r-- | crates/typst-svg/src/text.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/typst-svg/src/text.rs b/crates/typst-svg/src/text.rs index 80de3208..fa471b2a 100644 --- a/crates/typst-svg/src/text.rs +++ b/crates/typst-svg/src/text.rs @@ -3,6 +3,7 @@ use std::io::Read; use base64::Engine; use ecow::EcoString; use ttf_parser::GlyphId; +use typst_library::foundations::Bytes; use typst_library::layout::{Abs, Point, Ratio, Size, Transform}; use typst_library::text::{Font, TextItem}; use typst_library::visualize::{FillRule, Image, Paint, RasterFormat, RelativeTo}; @@ -243,7 +244,9 @@ fn convert_bitmap_glyph_to_image(font: &Font, id: GlyphId) -> Option<(Image, f64 if raster.format != ttf_parser::RasterImageFormat::PNG { return None; } - let image = Image::new(raster.data.into(), RasterFormat::Png.into(), None).ok()?; + let image = + Image::new(Bytes::new(raster.data.to_vec()), RasterFormat::Png.into(), None) + .ok()?; Some((image, raster.x as f64, raster.y as f64)) } |
