public
finalclassTextMeasurer
implements
Cloneable
Overview
Inheritance
Members
Usage
Source
Books
Since1.3
Version1.31, 04/20/01
Author(s)John Raley
The 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
AttributedCharacterIterator
representing a single paragraph of text. The value returned by the
getBeginIndex
method of AttributedCharacterIterator
defines the absolute index of the first character. The value
returned by the
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
insertChar
and
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).
TextMeasurerclass provides the primitive operations needed for line break: measuring up to a given advance, determining the advance of a range of characters, and generating aTextLayoutfor a range of characters. It also provides methods for incremental editing of paragraphs.A
TextMeasurerobject is constructed with an AttributedCharacterIterator representing a single paragraph of text. The value returned by the getBeginIndex method ofAttributedCharacterIteratordefines the absolute index of the first character. The value returned by the getEndIndex method ofAttributedCharacterIteratordefines the index past the last character. These values define the range of indexes to use in calls to theTextMeasurer. 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 insertChar and deleteChar reset theTextMeasurerto use the beginning index and end index of theAttributedCharacterIteratorpassed 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).