Skip to content

Commit

Permalink
Merge pull request #2059 from joshuamegnauth54/ensure_nonzero_text_li…
Browse files Browse the repository at this point in the history
…neheight

[issue #2002] Ensure that absolute `LineHeight` is always > 0.0
  • Loading branch information
hecrj authored Sep 7, 2023
2 parents d1822ad + cee0ed6 commit 6fc88c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tiny_skia/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion wgpu/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6fc88c3

Please sign in to comment.