dfrg / swash

Font introspection, complex text shaping and glyph rendering.
Apache License 2.0
584 stars 34 forks source link

➡️ Need to take offset into account when calculating draw area #31

Closed Jasper-Bekkers closed 1 year ago

Jasper-Bekkers commented 1 year ago

There was a small artifact noticeable when offset wasn't taken into account when calculating the bounds of the rectangle, leading to 1px clipping artifacts.

This would break in cosmic-text where the offset would be used to offset the glyph with a tiny fractional amount, causing incorrect rounding in this routine as a result.

https://github.com/pop-os/cosmic-text/blob/2342bf0eaebe6d41661b1fb49ed30d4021a9807d/src/swash.rs#L33-L35

Current main branch;

image

With this fix applied;

image

Notice some instances of the 💩 , 🐭and more subtly the top of the 🤖 emoji.

Jasper-Bekkers commented 1 year ago

@dfrg This is a relatively small change leading to much nicer visual representation (and I think it's correct?) Could you double check?

dfrg commented 1 year ago

This looks reasonable to me. Thanks!

Also, please feel free to @ me in future PRs. I don’t check this project much and I’m bombarded with GH notifications so I tend to miss things.

Jasper-Bekkers commented 1 year ago

@dfrg Thanks! Could you push a new (patch) release?

dfrg commented 1 year ago

Certainly! I’ll try to get to it later this evening.

dfrg commented 1 year ago

Published 0.1.6!