diff --git a/tiny_skia/src/text.rs b/tiny_skia/src/text.rs index 08fde4bf25..306b400a55 100644 --- a/tiny_skia/src/text.rs +++ b/tiny_skia/src/text.rs @@ -405,7 +405,10 @@ 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); + let metrics = cosmic_text::Metrics::new( + key.size, + key.line_height.max(f32::MIN_POSITIVE), + ); let mut buffer = cosmic_text::Buffer::new(font_system, metrics); buffer.set_size( diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index fb13545da7..9c42be0e82 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -414,7 +414,10 @@ impl Cache { } if let hash_map::Entry::Vacant(entry) = self.entries.entry(hash) { - let metrics = glyphon::Metrics::new(key.size, key.line_height); + let metrics = glyphon::Metrics::new( + key.size, + key.line_height.max(f32::MIN_POSITIVE), + ); let mut buffer = glyphon::Buffer::new(font_system, metrics); buffer.set_size(