pop-os / cosmic-text

Pure Rust multi-line text handling
https://pop-os.github.io/cosmic-text/cosmic_text/
Apache License 2.0
1.51k stars 88 forks source link

Broken rendering with some fonts (vertical stretching of the last pixels) #268

Open ghost opened 3 weeks ago

ghost commented 3 weeks ago

Description

With some fonts the rendering looks as if the first pixels and the last pixels (vertically) are stretched, which results in broken rendering. I could reproduce this issue with the "Algerian" font and the "Stencil" font in the rich-text example.

Steps to reproduce

Take the "rich-text" example and e.g. replace the line which sets the attributes for comic-sans with let comic_attrs = attrs.family(Family::Name("Algerian")).stretch(cosmic_text::Stretch::ExtraCondensed); or let comic_attrs = attrs.family(Family::Name("Stencil"));

How does it look like

This looks especially spectacular with the "Algerian" font. Algerian: image but is also visible with "Stencil" Stencil: image

dfrg commented 3 weeks ago

Ouch! This is almost certainly a swash problem. Thanks for reporting. I’ll look into it.

dfrg commented 3 weeks ago

This should be fixed with swash 0.1.17.

jackpot51 commented 3 weeks ago

Thanks @dfrg!

jackpot51 commented 2 weeks ago

@petersupansectra please test this after using cargo update to get the new swash crate