-
Notifications
You must be signed in to change notification settings - Fork 94
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
TextLayout::update_width buggy by design #298
Comments
I agree that I would prefer to remove That said, I think it's possible. I just think we have our hands full with text work right now without this issue complicating things. My rough thinking is that when we reinstate this function, we will have explicit copy-on-write semantics in the platform wrappers, (ie we'll never call clone on the underlying platform layout object), and use Correspondingly, on the xi-rope side, more work is needed to expose in-place mutation capabilities, again based on So I still think the method is a great idea (and potentially a really significant performance improvement, especially for live resize of large documents), but we should defer it until after we have the major bones of the text implementation in place and are able to undertake the work to enable the performance optimization end-to-end. I don't think its absence will block other important architectural work; in particular I think it doesn't affect the API provided to the clients of either LayoutRope or the new Druid-level TextLayout object, just the internal implementation. |
The way
TextLayout::update_width
works means that it can result in invalid layout objects when a layout has been cloned.When this method is called, it calls a mutating method on the platform layout object, and updates state (such as line metrics) on the piet object; however the platform layout object is shared between all clones of a layout object, whereas other state is not.
We need to think more about how we want to address this; it may make sense to just remove
update_width
for the time being.The text was updated successfully, but these errors were encountered: