-
Notifications
You must be signed in to change notification settings - Fork 13
Tighten bounds calculations and update Mask::offset
documentation
#15
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
Conversation
In a later (breaking) release, the behavior could be changed so offset affects the path's position as well.
1c5e5eb
to
696f941
Compare
offset
actually apply to both the path and boundsMask::offset
documentation
I don't think this is a breaking change in Swash, but there seems to be at least one other package that re-exports zeno, and changing |
I tried to use this branch, but it seems the vertical cut offs don't seem to be fixed. Here's what I see in
Here's the image I get with parley's Do I need to activate this branch somehow to get the fix? Thanks |
You'll need to switch Swash to this branch. You can point it at mine: swash = { git = "https://github.com/valadaptive/swash", branch = "tight-bounds" } which is the same as the one in dfrg/swash#88, except patched to use this branch of zeno. |
Great! That fixed it. Brilliant work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
The added bonus of Parley's With this padding removal here applied (combind with swash#88),
|
Isn't removing the padding from the output a breaking change for consumers of Swash? If they were previously accounting for that then they might need to undo their adjustment? Or will that "just work"? |
That's what swash#88 is for. If both Swash and Zeno get a patch release, then both will be picked up by There's no compilation issues or indeed any required action by consumers. So all of this can go quite smoothly with patch releases. |
Thanks, the reasoning makes sense so let’s go ahead and land this. Subpixel formats might require some additional padding which might explain why I hacked this in unconditionally. I’ll double check that before releasing. |
While integrating Parley with egui, I noticed a lot of extra padding around the glyphs' bounding boxes, and traced it back here. It seems the placement computation was deliberately padding the bounds horizontally. I can take an educated guess as to what might've caused this:
render_offset
option intozeno::Mask
. It doesn't use theoffset
option because, despite what the documentation says, it did not actually affect the rendered position of the path, just the bounding box.render_offset
doesn't adjust the bounds, glyphs were being cut off as they were shifted horizontally.I've changed theoffset
option inMask
to affect both the bounds' offset and the rendered path's position. This is a breaking change--I could also just change the code up in Swash to pass the same value for bothoffset
andrender_offset
. Either way, this'll require a change in Swash, but I think it's clearer to haveoffset
do what it says on the tin. It's your call.(EDIT: Went with the more conservative option for now; see comment)
With that working properly, there is no reason for the bounds to be padded anymore. Here's a comparison:
As an added bonus, this fixes the glyphs being vertically cut off in the Parley
swash_render
example, since vertical bounds were not being similarly padded here: