diff options
author | 2023-06-28 01:40:53 +0200 | |
---|---|---|
committer | 2023-06-28 01:40:53 +0200 | |
commit | 8d65e40a1174ecb8225ce9973575bced36e7aeb5 (patch) | |
tree | b530ef68f1424dc7a6ef52af0ecf5291750632fd /core/src/text.rs | |
parent | af62ec1c877d0d6d29277fb7dcfd4c681fd499af (diff) | |
parent | 00859c25f576b399871de74f0b9399d074deea35 (diff) | |
download | iced-8d65e40a1174ecb8225ce9973575bced36e7aeb5.tar.gz iced-8d65e40a1174ecb8225ce9973575bced36e7aeb5.tar.bz2 iced-8d65e40a1174ecb8225ce9973575bced36e7aeb5.zip |
Merge pull request #1934 from iced-rs/reuse-text-cache-entries
Reuse entries in `text::Cache`
Diffstat (limited to 'core/src/text.rs')
-rw-r--r-- | core/src/text.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/text.rs b/core/src/text.rs index c154cc27..fc8aa20e 100644 --- a/core/src/text.rs +++ b/core/src/text.rs @@ -163,7 +163,7 @@ pub trait Renderer: crate::Renderer { font: Self::Font, bounds: Size, shaping: Shaping, - ) -> (f32, f32); + ) -> Size; /// Measures the width of the text as if it were laid out in a single line. fn measure_width( @@ -173,7 +173,7 @@ pub trait Renderer: crate::Renderer { font: Self::Font, shaping: Shaping, ) -> f32 { - let (width, _) = self.measure( + let bounds = self.measure( content, size, LineHeight::Absolute(Pixels(size)), @@ -182,7 +182,7 @@ pub trait Renderer: crate::Renderer { shaping, ); - width + bounds.width } /// Tests whether the provided point is within the boundaries of text |