cairo backend: MeasureString line wrap fix #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I can produce and attach sample code if needed, but the gist is that CursorX should be updated before WrapX is noted. Otherwise, MaxX may later be updated from WrapX, causing the bounding rectangle given by MeasureString to be too narrow by the width of the last character of the longest wrapped line. If the bounding rectangle is then used in a DrawString, the wrap results can be different between the first MeasureString and the subsequent DrawString, which should not happen if the calculated bounding rectangle is passed on without modification.
There are a number of bugs on the xamarin and novell bugzillas relating to line wrapping with the cairo backend which, though none exactly matching this problem, have been put off with, "this will work with the pango backend." I needed this to work today with the cairo backend on OSX for a text-heavy application, however.