Commit a patch for SkTextBox.cpp, for adding a line break after "\r\n" or "\n"

87 views
Skip to first unread message

Jare

unread,
Aug 29, 2012, 1:49:02 AM8/29/12
to skia-d...@googlegroups.com
This patch support both "\r\n" and "\n" automatically.

New SkTextBox has passed integrated test.
The optimized "strnstr" for finding just a '\n' in the patch, has passed unit test, and the test result is the same as the "strnstr" from FreeBSD.
Let SkTextBox support CRLF and LF.cpp.patch

Ben Wagner

unread,
Aug 29, 2012, 10:13:18 AM8/29/12
to skia-d...@googlegroups.com
Note that it is much easier to review patches if they are submitted to  https://codereview.appspot.com/ .

Note that Skia doesn't really do text shaping at the moment and this won't really be a priority until it can be done wholesale -- that is provide an API which calls out to Uniscribe, DirectWrite, CoreText, HarfBuzz/FriBidi, etc to allow the user to do full shaping. The SkPaint::breakText method is something of an internal stop-gap utility (mostly only useful for internal tests) for the time being.

All that being said, I believe that the check for line ending characters should be in SkPaint::breakText instead of trying to add it on outside.


--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/skia-discuss/-/UKepEmh0UtkJ.
To post to this group, send email to skia-d...@googlegroups.com.
To unsubscribe from this group, send email to skia-discuss...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/skia-discuss?hl=en.

Ben Wagner

unread,
Aug 29, 2012, 1:23:51 PM8/29/12
to skia-d...@googlegroups.com
After having some local discussion about the purpose of SkPaint::breakText, I now believe that your original approach is probably the right one after all. If you could upload your original change to codereview.appspot.com we can give it a proper review.

Jare

unread,
Aug 29, 2012, 2:57:31 PM8/29/12
to skia-d...@googlegroups.com
Thanks for your enthusiastic replies.  I agree that Skia doesn't need to go too far. I just need to provide a simplest support for print multiline text in my app, so the SkTextBox may be a direct choice for me.  I will try to upload a more formal change to codereview.

在 2012年8月30日星期四UTC+8上午1时23分52秒,bungeman写道:

Ben Wagner

unread,
Aug 29, 2012, 3:04:12 PM8/29/12
to skia-d...@googlegroups.com
One more note, in case you were interested in looking. SkTextBox.cpp used to do what you're looking for it at revision 4730, but it was using non-public apis to do so. If you look there you can see what this used to do.


To view this discussion on the web visit https://groups.google.com/d/msg/skia-discuss/-/wqLn1r473YwJ.

Jare

unread,
Sep 1, 2012, 3:09:53 AM9/1/12
to skia-d...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages