Skip to content

Commit

Permalink
Make underline positioning aware of line_height
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Jul 28, 2024
1 parent ca31dca commit 9ce55eb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions widget/src/text/rich.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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),
),
Expand Down

0 comments on commit 9ce55eb

Please sign in to comment.