diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-02-14 16:07:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-14 15:07:38 +0000 |
| commit | 79e37ccbac080212dc42e996d760664c75d1a56f (patch) | |
| tree | 70c926c62535dd0df6f93d5a5a3e84326ed8aa9c /crates/typst-render | |
| parent | 601118652de5b3151e96eba3c0c8c285f3fab8fd (diff) | |
Don't round SVG size (#3415)
Diffstat (limited to 'crates/typst-render')
| -rw-r--r-- | crates/typst-render/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/typst-render/src/lib.rs b/crates/typst-render/src/lib.rs index afdfeeef..8c519795 100644 --- a/crates/typst-render/src/lib.rs +++ b/crates/typst-render/src/lib.rs @@ -352,7 +352,7 @@ fn render_bitmap_glyph( // and maybe also for Noto Color Emoji. And: Is the size calculation // correct? let h = text.size; - let w = (image.width() as f64 / image.height() as f64) * h; + let w = (image.width() / image.height()) * h; let dx = (raster.x as f32) / (image.width() as f32) * size; let dy = (raster.y as f32) / (image.height() as f32) * size; render_image( @@ -742,7 +742,7 @@ fn scaled_texture(image: &Image, w: u32, h: u32) -> Option<Arc<sk::Pixmap>> { let mut pixmap = sk::Pixmap::new(w, h)?; match image.kind() { ImageKind::Raster(raster) => { - let downscale = w < image.width(); + let downscale = w < raster.width(); let filter = if downscale { FilterType::Lanczos3 } else { FilterType::CatmullRom }; let buf = raster.dynamic().resize(w, h, filter); |
