From bbb9ed07ffe8a2a0ea0a232f6cfc52f82f7f7afe Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 10 Mar 2021 10:20:01 +0100 Subject: =?UTF-8?q?Better=20line=20spacing=20calculations=20=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Only add line spacing between lines. Previously, line spacing was added below every line, making `#box[word]` higher than just `word`. - Compute box height of text as `ascender - descender` so that the full word is contained in the box. --- tests/typeset.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/typeset.rs') diff --git a/tests/typeset.rs b/tests/typeset.rs index c56655f5..232dfa5c 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -393,7 +393,7 @@ fn draw_text(env: &Env, canvas: &mut Canvas, pos: Point, shaped: &Shaped) { let units_per_em = face.units_per_em().unwrap_or(1000); let x = (pos.x + offset).to_pt() as f32; - let y = (pos.y + shaped.font_size).to_pt() as f32; + let y = pos.y.to_pt() as f32; let scale = (shaped.font_size / units_per_em as f64).to_pt() as f32; let mut builder = WrappedPathBuilder(PathBuilder::new()); -- cgit v1.2.3