Skip to content

Commit 95c030e

Browse files
committed
fix baseline calculation for multiline text
- note the `y` and `baseline` values in a given TextMetrics.lines[] object are independent of one another—they're both relative to the origin of the eventual ctx.fillText() call
1 parent 3684aca commit 95c030e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/typography.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl Typesetter{
9898
let range = string_idx_range(&self.text, line.start_index,
9999
if self.width==GALLEY{ line.end_index }else{ line.end_excluding_whitespaces }
100100
);
101-
(rect.with_offset((alignment, offset)), range, baseline as f32)
101+
(rect.with_offset((alignment, offset)), range, baseline as f32 + offset)
102102
}).collect();
103103

104104
// take their union to find the bounds for the whole text run

0 commit comments

Comments
 (0)