Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue #2002] Ensure that absolute LineHeight is always > 0.0 #2059

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.line_height,
(key.line_height * 1.2).max(f32::MIN_POSITIVE),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost! This should look the same as the wgpu code:

Suggested change
key.line_height,
(key.line_height * 1.2).max(f32::MIN_POSITIVE),
key.size,
key.line_height.max(f32::MIN_POSITIVE),

You can test the tiny-skia backend by setting the ICED_BACKEND=tiny-skia env variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I just committed the requested changes.

Also, I've been recompiling iced with default-features=false to test Tiny Skia. 😅 That env var is very helpful.

);
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