Skip to content
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

cairo backend: MeasureString line wrap fix #5

Open
wants to merge 1 commit into
base: mono-2-10
Choose a base branch
from

Conversation

eisnerd
Copy link

@eisnerd eisnerd commented Nov 24, 2012

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.

When doing a DrawString using bounds given by a prior call to MeasureString, the last line would not wrap if the second-to-last was the longest. The last wrap would cause MeasureString to give a too-small bounding rectangle.
@alexrp
Copy link

alexrp commented Jun 3, 2014

I'd love to have a test case along with this.

@eisnerd
Copy link
Author

eisnerd commented Jun 3, 2014

Two years ago, when this was submitted, I was involved in porting a proprietary wysiwyg printing app from Windows/.NET to multiple platforms (esp OS X)/mono. This was one of the big discrepancies for that sort of work between the .NET libraries and mono. I may be able to extract an interesting test case from that with permission, but you basically only need to compare wrapping of a few long words in a text box between .NET and mono to see the problem.

Some of the line wrapping bug reports may have had code attached. I'll have a look some time.

@alexrp
Copy link

alexrp commented Jun 3, 2014

Thing is, I don't maintain this code, so in order to merge it with confidence, I really need a test case along with the change.

@directhex
Copy link
Contributor

build

@monojenkins
Copy link

Hello! I'm the build bot for the Mono project. I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done. Contributors can ignore this message.

@directhex
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants