diff options
author | 2023-09-04 23:47:44 -0400 | |
---|---|---|
committer | 2023-09-04 23:47:44 -0400 | |
commit | bdf18554feadb631fdae5b427ac7a92a5546ade1 (patch) | |
tree | facb92220b25ed1d8c2b92461d8243a9bccdaa55 /tiny_skia | |
parent | 20681b4777a1954e6b7f659d5bc1817f7924f40d (diff) | |
download | iced-bdf18554feadb631fdae5b427ac7a92a5546ade1.tar.gz iced-bdf18554feadb631fdae5b427ac7a92a5546ade1.tar.bz2 iced-bdf18554feadb631fdae5b427ac7a92a5546ade1.zip |
Check LineHeight > 0.0 before allocating text
Diffstat (limited to 'tiny_skia')
-rw-r--r-- | tiny_skia/src/text.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tiny_skia/src/text.rs b/tiny_skia/src/text.rs index 9b949218..24b17662 100644 --- a/tiny_skia/src/text.rs +++ b/tiny_skia/src/text.rs @@ -54,8 +54,7 @@ impl Pipeline { pixels: &mut tiny_skia::PixmapMut<'_>, clip_mask: Option<&tiny_skia::Mask>, ) { - let line_height = f32::from(line_height.to_absolute(Pixels(size))) - .max(f32::MIN_POSITIVE); + let line_height = f32::from(line_height.to_absolute(Pixels(size))); let font_system = self.font_system.get_mut(); let key = Key { @@ -135,8 +134,7 @@ impl Pipeline { ) -> Size { let mut measurement_cache = self.cache.borrow_mut(); - let line_height = f32::from(line_height.to_absolute(Pixels(size))) - .max(f32::MIN_POSITIVE); + let line_height = f32::from(line_height.to_absolute(Pixels(size))); let (_, entry) = measurement_cache.allocate( &mut self.font_system.borrow_mut(), @@ -166,8 +164,7 @@ impl Pipeline { ) -> Option<Hit> { let mut measurement_cache = self.cache.borrow_mut(); - let line_height = f32::from(line_height.to_absolute(Pixels(size))) - .max(f32::MIN_POSITIVE); + let line_height = f32::from(line_height.to_absolute(Pixels(size))); let (_, entry) = measurement_cache.allocate( &mut self.font_system.borrow_mut(), @@ -409,8 +406,8 @@ impl Cache { if let hash_map::Entry::Vacant(entry) = self.entries.entry(hash) { let metrics = cosmic_text::Metrics::new( - key.size, - (key.size * 1.2).max(f32::MIN_POSITIVE), + key.line_height, + (key.line_height * 1.2).max(f32::MIN_POSITIVE), ); let mut buffer = cosmic_text::Buffer::new(font_system, metrics); |