diff options
author | 2023-05-04 13:00:16 +0200 | |
---|---|---|
committer | 2023-05-04 18:39:31 +0200 | |
commit | 9499a8f9e6f9971dedfae563cb133232aa3cebc2 (patch) | |
tree | 54074dd8b1fc17d63ad92d84b6d2b4415ad29df6 /tiny_skia/src/backend.rs | |
parent | 8e8808f0e187ed6671441f5016f07bfcba426452 (diff) | |
download | iced-9499a8f9e6f9971dedfae563cb133232aa3cebc2.tar.gz iced-9499a8f9e6f9971dedfae563cb133232aa3cebc2.tar.bz2 iced-9499a8f9e6f9971dedfae563cb133232aa3cebc2.zip |
Support configurable `LineHeight` in text widgets
Diffstat (limited to 'tiny_skia/src/backend.rs')
-rw-r--r-- | tiny_skia/src/backend.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs index 3ef7e717..99230a2f 100644 --- a/tiny_skia/src/backend.rs +++ b/tiny_skia/src/backend.rs @@ -216,6 +216,7 @@ impl Backend { bounds, color, size, + line_height, font, horizontal_alignment, vertical_alignment, @@ -233,13 +234,15 @@ impl Backend { self.text_pipeline.draw( content, - (*bounds + translation) * scale_factor, + *bounds + translation, *color, - *size * scale_factor, + *size, + *line_height, *font, *horizontal_alignment, *vertical_alignment, *shaping, + scale_factor, pixels, clip_mask, ); @@ -626,18 +629,26 @@ impl backend::Text for Backend { &self, contents: &str, size: f32, + line_height: text::LineHeight, font: Font, bounds: Size, shaping: text::Shaping, ) -> (f32, f32) { - self.text_pipeline - .measure(contents, size, font, bounds, shaping) + self.text_pipeline.measure( + contents, + size, + line_height, + font, + bounds, + shaping, + ) } fn hit_test( &self, contents: &str, size: f32, + line_height: text::LineHeight, font: Font, bounds: Size, shaping: text::Shaping, @@ -647,6 +658,7 @@ impl backend::Text for Backend { self.text_pipeline.hit_test( contents, size, + line_height, font, bounds, shaping, |