VectorCraft: An open-source, vector art tool written by scratch in pure Rust
M7: Shrink Text to Fit scales inline art's baseline shift
havenabdc26d8d1c6
diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rsindex 60c2e96d7..ba73c2109 100644--- a/crates/text/src/layout.rs+++ b/crates/text/src/layout.rs@@ -206,14 +206,17 @@ fn shrink_to_fit(db: &FontDb, t: &TextObject, opts: &LayoutOptions, min: f64) ->Some(best.unwrap_or_else(|| at(lo)))}-/// `t` with every run's size, explicit leading and baseline shift scaled by `f` (auto leading-/// follows the size; paragraph spacing stays).+/// `t` with every run's size, explicit leading and baseline shift scaled by `f`, inline art's own+/// shift included (auto leading and the art's size follow the size; paragraph spacing stays).fn scaled(t: &TextObject, f: f64) -> TextObject {let mut s = t.clone();for r in &mut s.runs {r.style.size *= f;r.style.leading = r.style.leading.map(|l| l * f);r.style.baseline_shift *= f;+ if let Some(a) = &mut r.inline {+ a.baseline_shift *= f;+ }}s}