Make underline positioning aware of line_height

This commit is contained in:
Héctor Ramón Jiménez 2024-07-28 15:40:22 +02:00
parent ca31dcadd5
commit 9ce55eb511
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -285,14 +285,15 @@ where
}
if span.underline || is_hovered_link {
let size = span
.size
.or(self.size)
.unwrap_or(renderer.default_size());
let line_height = span
.line_height
.unwrap_or(self.line_height)
.to_absolute(
span.size
.or(self.size)
.unwrap_or(renderer.default_size()),
);
.to_absolute(size);
for bounds in regions {
renderer.fill_quad(
@ -302,7 +303,10 @@ where
+ translation
+ Vector::new(
0.0,
line_height.0 * 0.8 + 1.0,
size.0
+ (line_height.0 - size.0)
/ 2.0
- size.0 * 0.08,
),
Size::new(bounds.width, 1.0),
),