From 987ff45ff20f3cee1322e2f2909ac4c2c26f8321 Mon Sep 17 00:00:00 2001 From: mahkoh Date: Wed, 14 May 2025 23:00:30 +0200 Subject: [PATCH] Round glyph advance to integer sizes (#384) This is in line with [1]. [1]: https://skia.googlesource.com/skia/+/refs/heads/chrome/m136/src/ports/SkTypeface_fontations.cpp#539 --- src/shape.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shape.rs b/src/shape.rs index 98eb730..e64d42e 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -1559,12 +1559,13 @@ impl ShapeLine { _ => font_size, }; - let x_advance = glyph_font_size * glyph.x_advance + let mut x_advance = glyph_font_size * glyph.x_advance + if word.blank { justification_expansion } else { 0.0 }; + x_advance = x_advance.round(); if self.rtl { x -= x_advance; }