TextMeasurer class provides the primitive operations needed for line break: measuring up to a given advance, determining the advance of a range of characters, and generating a TextLayout for a range of characters. It also provides methods for incremental editing of paragraphs. A TextMeasurer object is constructed with an {@link java.text.AttributedCharacterIterator AttributedCharacterIterator} representing a single paragraph of text. The value returned by the {@link AttributedCharacterIterator#getBeginIndex() getBeginIndex} method of AttributedCharacterIterator defines the absolute index of the first character. The value returned by the {@link AttributedCharacterIterator#getEndIndex() getEndIndex}method of AttributedCharacterIterator defines the index past the last character. These values define the range of indexes to use in calls to the TextMeasurer. For example, calls to get the advance of a range of text or the line break of a range of text must use indexes between the beginning and end index values. Calls to {@link #insertChar(java.text.AttributedCharacterIterator,int) insertChar} and {@link #deleteChar(java.text.AttributedCharacterIterator,int) deleteChar} reset the TextMeasurer to use the beginning index and end index of the AttributedCharacterIterator passed in those calls.
Most clients will use the more convenient LineBreakMeasurer, which implements the standard line break policy (placing as many words as will fit on each line).
@author John Raley
@version 1.31, 04/20/01
@see LineBreakMeasurer
@since 1.3
| |
| |