Community
Participate
Working Groups
Label label = new Label( parent, SWT.NONE ); label.setText( "some spaces in between" ); will show as "some spaces in between" in the browser. As the Label widget uses an HTML fragment to show its content, the browser correctly eliminates subsequent whitespaces. Possible solutions: - escape whitespaces with   or   - escape every second subsequent whitespace with (this way keep the wrapping behavior) This not only applies to the Label widget but all other widgets that display text in some way.
There is an additional entity called   that also is a html whitespace character. I created an whitespace example html file (test1.html) to compare the width of all whitespace entities. In my oppinion both   and   have to much width.   is a bit too small but it is a good solution. See spacewidthexample.png for rendering in Firefox. The difference between  -wrapping and -wrapping is a wrapping of whitespaces as block (thinsp) and wrapping whitespace as small pieces (nbsp). Please take a look at both nbspwrapping.png and thinspwrapping.png (created from test2.html). If the nbsp method is preferred a decision have to be made whether the last or second last whitespace is a wrapped whitespace (particularly with odd number of whitespaces). If the last one is a nbsp the word after the nbsp will never wrap without leading whitespace.
Created attachment 102607 [details] Example scenario for html whitespace width
Created attachment 102608 [details] Example scenario for html whitespace wrapping (resize browser window)
Created attachment 102609 [details] Space width example rendered with Firefox
Created attachment 102610 [details] Rendered wrapping of thinsp in Firefox
Created attachment 102611 [details] Rendered wrapping of nbsp in Firefox
Created attachment 102913 [details] Patch for whitespace bug solved with
Created attachment 146941 [details] Proposed patch
Created attachment 147083 [details] Proposed patch
Applied patch to CVS HEAD