The most reasonable way to render multi-line text, and the most reasonable way to depend on skia
686 views
Skip to first unread message
Evan Zalys
unread,
Jun 3, 2013, 4:58:48 AM6/3/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-d...@googlegroups.com
Say I'm interested in rendering some text that takes up several lines within the confines fixed horizontal-width box. What's the general strategy to do this? Shall I take one word, then measure it (paint.measureText), see if it's within bounds, add another word, and keep on with this until I exceed the horizontal width of the container I wish to fit, and then start over on the next line with the overflowing word (maybe perhaps applying some hyphenation strategy upon overflow?) Is there a better way to do this?
Secondly, I'm interested in what you folks think the most reasonable way to depend on skia as a library is. It doesn't seem to have an install target that dumps a bunch of .a files in /usr/lib or what have you, and I understand the API isn't a stable thing, but I'd still like to incorporate it in my project and I'm not sure what the recommended organizational strategy is here.
Thanks!
Evan
a.c...@weelya.com
unread,
Jun 3, 2013, 6:15:18 AM6/3/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-d...@googlegroups.com
Note that Skia has something like this, see views/SkTextBox.cpp . It's
somewhat limited, however. Skia has been trying to avoid the
complexity of text shaping until it can be done correctly.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-d...@googlegroups.com
For a small amout of text, SkPaint::breakText is what you need. For large amount of text, try guess algorithm(first guess a number and then fix it with measureText) or try to use binary divide algorithm.