summaryrefslogtreecommitdiff
path: root/crates/typst-svg/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-02-14 16:07:38 +0100
committerGitHub <noreply@github.com>2024-02-14 15:07:38 +0000
commit79e37ccbac080212dc42e996d760664c75d1a56f (patch)
tree70c926c62535dd0df6f93d5a5a3e84326ed8aa9c /crates/typst-svg/src
parent601118652de5b3151e96eba3c0c8c285f3fab8fd (diff)
Don't round SVG size (#3415)
Diffstat (limited to 'crates/typst-svg/src')
-rw-r--r--crates/typst-svg/src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/typst-svg/src/lib.rs b/crates/typst-svg/src/lib.rs
index 2c69e6d9..4d542296 100644
--- a/crates/typst-svg/src/lib.rs
+++ b/crates/typst-svg/src/lib.rs
@@ -409,8 +409,8 @@ impl SVGRenderer {
let glyph_hash = hash128(&(&text.font, id));
let id = self.glyphs.insert_with(glyph_hash, || {
- let width = image.width() as f64;
- let height = image.height() as f64;
+ let width = image.width();
+ let height = image.height();
let url = convert_image_to_base64_url(&image);
let ts = Transform::translate(
Abs::pt(bitmap_x_offset),
@@ -426,7 +426,7 @@ impl SVGRenderer {
// The image is stored with the height of `image.height()`, but we want
// to render it with a height of `target_height`. So we need to scale
// it.
- let scale_factor = target_height / image.height() as f64;
+ let scale_factor = target_height / image.height();
self.xml.write_attribute("x", &(x_offset / scale_factor));
self.xml.write_attribute_fmt(
"transform",