Merge pull request #2059 from joshuamegnauth54/ensure_nonzero_text_lineheight

[issue #2002] Ensure that absolute `LineHeight` is always > 0.0
This commit is contained in:
Héctor Ramón 2023-09-07 03:49:44 +02:00 committed by GitHub
commit 6fc88c3c80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -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(

View file

@ -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(