From f8b0684d211267244097e41f7332a95b8713cfb5 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Sat, 17 Feb 2024 20:23:01 -0600 Subject: [PATCH] fix(svg): Fix the width I chose the width by seeing what fit the content for `rainbow.svg` in Firefox on PopOS with the current font family. No idea how universal this will be. --- crates/anstyle-svg/src/lib.rs | 3 ++- crates/anstyle-svg/tests/rainbow.svg | 2 +- crates/anstyle-svg/tests/rg_linus.svg | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/anstyle-svg/src/lib.rs b/crates/anstyle-svg/src/lib.rs index 2faa7213..44bc84c2 100644 --- a/crates/anstyle-svg/src/lib.rs +++ b/crates/anstyle-svg/src/lib.rs @@ -78,12 +78,13 @@ impl Term { .map(|l| l.iter().map(|(_, t)| t.width()).sum()) .max() .unwrap_or(20); + let width_px = max_width as f64 * 8.4; use std::fmt::Write as _; let mut buffer = String::new(); writeln!( &mut buffer, - r#""# + r#""# ) .unwrap(); writeln!(&mut buffer, r#"