Position underlines at a distance proportional to the line descent

Antonio Scandurra and Nathan Sobo created

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

Change summary

crates/gpui/src/text_layout.rs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

Detailed changes

crates/gpui/src/text_layout.rs 🔗

@@ -272,7 +272,13 @@ impl Line {
                             }
                         }
                         if let Some(run_underline) = run_underline {
-                            underline.get_or_insert((glyph_origin, *run_underline));
+                            underline.get_or_insert((
+                                vec2f(
+                                    glyph_origin.x(),
+                                    origin.y() + baseline_offset.y() + 0.618 * self.layout.descent,
+                                ),
+                                *run_underline,
+                            ));
                         }
 
                         run_end += *run_len as usize;