Constructs a new instance of this class on the given device. <p> You must dispose the text layout when it is no longer required. </p>
Draws the receiver's text using the specified GC at the specified point.
Draws the receiver's text using the specified GC at the specified point.
Draws the receiver's text using the specified GC at the specified point. <p> The parameter <code>flags</code> can include one of <code>SWT.DELIMITER_SELECTION</code> or <code>SWT.FULL_SELECTION</code> to specify the selection behavior on all lines except for the last line, and can also include <code>SWT.LAST_LINE_SELECTION</code> to extend the specified selection behavior to the last line. </p> @param gc the GC to draw @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn @param selectionStart the offset where the selections starts, or -1 indicating no selection @param selectionEnd the offset where the selections ends, or -1 indicating no selection @param selectionForeground selection foreground, or NULL to use the system default color @param selectionBackground selection background, or NULL to use the system default color @param flags drawing options
Returns the receiver's horizontal text alignment, which will be one of <code>SWT.LEFT</code>, <code>SWT.CENTER</code> or <code>SWT.RIGHT</code>.
Returns the ascent of the receiver.
Returns the bounds of the receiver. The width returned is either the width of the longest line or the width set using {@link TextLayout#setWidth(int)}. To obtain the text bounds of a line use {@link TextLayout#getLineBounds(int)}.
Returns the bounds for the specified range of characters. The bounds is the smallest rectangle that encompasses all characters in the range. The start and end offsets are inclusive and will be clamped if out of range.
Returns the descent of the receiver.
Returns the default font currently being used by the receiver to draw and measure text.
Returns the receiver's indent. * @return the receiver's indent * @exception SWTException <ul> <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> </ul> * @since 3.2
Returns the receiver's justification. * @return the receiver's justification * @exception SWTException <ul> <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> </ul> * @since 3.2
Returns the embedding level for the specified character offset. The embedding level is usually used to determine the directionality of a character in bidirectional text.
Returns the bounds of the line for the specified line index.
Returns the receiver's line count. This includes lines caused by wrapping.
Returns the index of the line that contains the specified character offset.
Returns the font metrics for the specified line index.
Returns the line offsets. Each value in the array is the offset for the first character in a line except for the last value, which contains the length of the text.
Returns the location for the specified character offset. The <code>trailing</code> argument indicates whether the offset corresponds to the leading or trailing edge of the cluster.
Returns the next offset for the specified offset and movement type. The movement is one of <code>SWT.MOVEMENT_CHAR</code>, <code>SWT.MOVEMENT_CLUSTER</code>, <code>SWT.MOVEMENT_WORD</code>, <code>SWT.MOVEMENT_WORD_END</code> or <code>SWT.MOVEMENT_WORD_START</code>.
Returns the character offset for the specified point. For a typical character, the trailing argument will be filled in to indicate whether the point is closer to the leading edge (0) or the trailing edge (1). When the point is over a cluster composed of multiple characters, the trailing argument will be filled with the position of the character in the cluster that is closest to the point.
Returns the character offset for the specified point. For a typical character, the trailing argument will be filled in to indicate whether the point is closer to the leading edge (0) or the trailing edge (1). When the point is over a cluster composed of multiple characters, the trailing argument will be filled with the position of the character in the cluster that is closest to the point.
Returns the orientation of the receiver.
Returns the previous offset for the specified offset and movement type. The movement is one of <code>SWT.MOVEMENT_CHAR</code>, <code>SWT.MOVEMENT_CLUSTER</code> or <code>SWT.MOVEMENT_WORD</code>, <code>SWT.MOVEMENT_WORD_END</code> or <code>SWT.MOVEMENT_WORD_START</code>.
Gets the ranges of text that are associated with a <code>TextStyle</code>.
Returns the text segments offsets of the receiver.
Returns the line spacing of the receiver.
Gets the style of the receiver at the specified character offset.
Gets all styles of the receiver.
Returns the tab list of the receiver.
Gets the receiver's text, which will be an empty string if it has never been set.
Returns the width of the receiver.
Returns <code>true</code> if the text layout has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the text layout. When a text layout has been disposed, it is an error to invoke any other method using the text layout. </p>
Sets the text alignment for the receiver. The alignment controls how a line of text is positioned horizontally. The argument should be one of <code>SWT.LEFT</code>, <code>SWT.RIGHT</code> or <code>SWT.CENTER</code>. <p> The default alignment is <code>SWT.LEFT</code>. Note that the receiver's width must be set in order to use <code>SWT.RIGHT</code> or <code>SWT.CENTER</code> alignment. </p>
Sets the ascent of the receiver. The ascent is distance in pixels from the baseline to the top of the line and it is applied to all lines. The default value is <code>-1</code> which means that the ascent is calculated from the line fonts.
Sets the descent of the receiver. The descent is distance in pixels from the baseline to the bottom of the line and it is applied to all lines. The default value is <code>-1</code> which means that the descent is calculated from the line fonts.
Sets the default font which will be used by the receiver to draw and measure text. If the argument is null, then a default font appropriate for the platform will be used instead. Note that a text style can override the default font.
Sets the indent of the receiver. This indent it applied of the first line of each paragraph.
Sets the justification of the receiver. Note that the receiver's width must be set in order to use justification.
Sets the orientation of the receiver, which must be one of <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>.
Sets the offsets of the receiver's text segments. Text segments are used to override the default behaviour of the bidirectional algorithm. Bidirectional reordering can happen within a text segment but not between two adjacent segments. <p> Each text segment is determined by two consecutive offsets in the <code>segments</code> arrays. The first element of the array should always be zero and the last one should always be equals to length of the text. </p>
Sets the line spacing of the receiver. The line spacing is the space left between lines.
Sets the style of the receiver for the specified range. Styles previously set for that range will be overwritten. The start and end offsets are inclusive and will be clamped if out of range.
Sets the receiver's tab list. Each value in the tab list specifies the space in pixels from the origin of the text layout to the respective tab stop. The last tab stop width is repeated continuously.
Sets the receiver's text.
Sets the line width of the receiver, which determines how text should be wrapped and aligned. The default value is <code>-1</code> which means wrapping is disabled.
Returns a string containing a concise, human-readable description of the receiver.
the device where this resource was created
Disposes of the operating system resources associated with this resource. Applications must dispose of all resources which they allocate.
Returns the <code>Device</code> where this resource was created.
Returns <code>true</code> if the resource has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the resource. When a resource has been disposed, it is an error to invoke any other method using the resource.
<code>TextLayout</code> is a graphic object that represents styled text. <p> Instances of this class provide support for drawing, cursor navigation, hit testing, text wrapping, alignment, tab expansion line breaking, etc. These are aspects required for rendering internationalized text. </p><p> Application code must explicitly invoke the <code>TextLayout#dispose()</code> method to release the operating system resources managed by each instance when those instances are no longer required. </p>
@see <a href="http://www.eclipse.org/swt/snippets/#textlayout">TextLayout, TextStyle snippets</a> @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: CustomControlExample, StyledText tab</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
@since 3.0