Ensure LineHeight is always > 0.0 for tiny skia.
This commit is contained in:
parent
ef429fbea6
commit
20681b4777
1 changed files with 10 additions and 4 deletions
|
|
@ -54,7 +54,8 @@ impl Pipeline {
|
|||
pixels: &mut tiny_skia::PixmapMut<'_>,
|
||||
clip_mask: Option<&tiny_skia::Mask>,
|
||||
) {
|
||||
let line_height = f32::from(line_height.to_absolute(Pixels(size)));
|
||||
let line_height = f32::from(line_height.to_absolute(Pixels(size)))
|
||||
.max(f32::MIN_POSITIVE);
|
||||
|
||||
let font_system = self.font_system.get_mut();
|
||||
let key = Key {
|
||||
|
|
@ -134,7 +135,8 @@ impl Pipeline {
|
|||
) -> Size {
|
||||
let mut measurement_cache = self.cache.borrow_mut();
|
||||
|
||||
let line_height = f32::from(line_height.to_absolute(Pixels(size)));
|
||||
let line_height = f32::from(line_height.to_absolute(Pixels(size)))
|
||||
.max(f32::MIN_POSITIVE);
|
||||
|
||||
let (_, entry) = measurement_cache.allocate(
|
||||
&mut self.font_system.borrow_mut(),
|
||||
|
|
@ -164,7 +166,8 @@ impl Pipeline {
|
|||
) -> Option<Hit> {
|
||||
let mut measurement_cache = self.cache.borrow_mut();
|
||||
|
||||
let line_height = f32::from(line_height.to_absolute(Pixels(size)));
|
||||
let line_height = f32::from(line_height.to_absolute(Pixels(size)))
|
||||
.max(f32::MIN_POSITIVE);
|
||||
|
||||
let (_, entry) = measurement_cache.allocate(
|
||||
&mut self.font_system.borrow_mut(),
|
||||
|
|
@ -405,7 +408,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.size * 1.2).max(f32::MIN_POSITIVE),
|
||||
);
|
||||
let mut buffer = cosmic_text::Buffer::new(font_system, metrics);
|
||||
|
||||
buffer.set_size(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue