From 78ad365db232e53cbdf12105e40c1dbe87a3238c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 28 Jun 2023 00:35:37 +0200 Subject: Reuse entries in `text::Cache` in `iced_wgpu` --- core/src/text.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/src/text.rs') 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 -- cgit