Fix calculation of visible glyph bounds

Antonio Scandurra and Nathan Sobo created

Co-Authored-By: Nathan Sobo <nathan@zed.dev>

Change summary

gpui/src/text_layout.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Detailed changes

gpui/src/text_layout.rs 🔗

@@ -272,7 +272,7 @@ impl Line {
         let mut color_end = 0;
         let mut color = Color::black();
 
-        let mut glyph_origin = baseline_origin;
+        let mut glyph_origin = vec2f(0., 0.);
         let mut prev_position = 0.;
         for run in &self.layout.runs {
             for (glyph_ix, glyph) in run.glyphs.iter().enumerate() {
@@ -304,7 +304,7 @@ impl Line {
                         font_id: run.font_id,
                         font_size: self.layout.font_size,
                         id: glyph.id,
-                        origin: origin + glyph_origin,
+                        origin: glyph_bounds.origin() + baseline_origin,
                         color,
                     });
                 }