Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the split characters in Silverlight's TextWrapping?

The TextWrapping feature in Silverlight is described here. However, I'm trying to find out the details of their line-breaking algorithm.

Obviously a space will cause the text to break (or split), encouraging the text to wrap to the next line. And through trial and error I've found that these characters also cause a split:

  • \t (tab)
  • -
  • !
  • ?

But I doubt this is the full list. Has anyone found the full list of split characters (including Unicode)? Or do you have any clever suggestions for figuring this out that I haven't thought of yet? Trial and error can be slow.

like image 713
Steve Wortham Avatar asked Feb 21 '10 16:02

Steve Wortham


2 Answers

TextWrapping = Wrap will attempt to conform to the the standard Unicode Standard Annex #14 that Johannes has already linked.

However if using this approach the text still doesn't fit the width (due to very limited width or long words) then it'll break the word across two lines, it doesn't hyphnate or do anything clever. As soon a placing a letter would overrun the width and if it can't find something in the line that'll let it use the standard algorithm it'll continue the word on the next line.

like image 113
AnthonyWJones Avatar answered Nov 15 '22 06:11

AnthonyWJones


I'd guess every character that qualifies as space or punctuation, excluding the explicitly non-breaking characters.

However, there is a specified algorithm for line breaking: Unicode Standard Annex #14: Unicode Line Breaking Algorithm.

like image 21
Joey Avatar answered Nov 15 '22 05:11

Joey