Whole document tree
java.awt.font
|
Constructor Summary | |
LineBreakMeasurer(AttributedCharacterIterator text,
BreakIterator breakIter,
FontRenderContext frc)
Constructs a LineBreakMeasurer for the specified text. |
|
LineBreakMeasurer(AttributedCharacterIterator text,
FontRenderContext frc)
Constructs a LineBreakMeasurer for the specified text. |
Method Summary | |
void |
deleteChar(AttributedCharacterIterator newParagraph,
int deletePos)
Updates this LineBreakMeasurer after a single
character is deleted from the text, and sets the current
position to the beginning of the paragraph. |
int |
getPosition()
Returns the current position of this LineBreakMeasurer . |
void |
insertChar(AttributedCharacterIterator newParagraph,
int insertPos)
Updates this LineBreakMeasurer after a single
character is inserted into the text, and sets the current
position to the beginning of the paragraph. |
TextLayout |
nextLayout(float wrappingWidth)
Returns the next layout, and updates the current position. |
TextLayout |
nextLayout(float wrappingWidth,
int offsetLimit,
boolean requireNextWord)
Returns the next layout, and updates the current position. |
int |
nextOffset(float wrappingWidth)
Returns the position at the end of the next layout. |
int |
nextOffset(float wrappingWidth,
int offsetLimit,
boolean requireNextWord)
Returns the position at the end of the next layout. |
void |
setPosition(int newPosition)
Sets the current position of this LineBreakMeasurer . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LineBreakMeasurer(AttributedCharacterIterator text, FontRenderContext frc)
LineBreakMeasurer
for the specified text.text
- the text for which this LineBreakMeasurer
produces TextLayout
objects. The text must contain at
least one character. If the text available through
iter
changes, further calls to this
LineBreakMeasurer
instance are undefined (except,
in some cases, when insertChar
or
deleteChar
are invoked afterward - see below).frc
- contains information about a graphics device which is needed
to measure the text correctly.
Text measurements can vary slightly depending on the
device resolution, and attributes such as antialiasing. This
parameter does not specify a translation between the
LineBreakMeasurer
and user space.insertChar(java.text.AttributedCharacterIterator, int)
,
deleteChar(java.text.AttributedCharacterIterator, int)
public LineBreakMeasurer(AttributedCharacterIterator text, BreakIterator breakIter, FontRenderContext frc)
LineBreakMeasurer
for the specified text.text
- the text for which this LineBreakMeasurer
produces TextLayout
objects. The text must contain at
least one character. If the text available through
iter
changes, further calls to this
LineBreakMeasurer
instance are undefined (except,
in some cases, when insertChar
or
deleteChar
are invoked afterward - see below).breakIter
- the BreakIterator
which defines line
breaksfrc
- contains information about a graphics device which is needed
to measure the text correctly.
Text measurements can vary slightly depending on the
device resolution, and attributes such as antialiasing. This
parameter does not specify a translation between the
LineBreakMeasurer
and user space.insertChar(java.text.AttributedCharacterIterator, int)
,
deleteChar(java.text.AttributedCharacterIterator, int)
Method Detail |
public int nextOffset(float wrappingWidth)
LineBreakMeasurer
.wrappingWidth
- the maximum visible advance permitted for
the text in the next layoutTextLayout
.public int nextOffset(float wrappingWidth, int offsetLimit, boolean requireNextWord)
LineBreakMeasurer
.wrappingWidth
- the maximum visible advance permitted for
the text in the next layoutoffsetLimit
- the first character that can not be included
in the next layout, even if the text after the limit would fit
within the wrapping width. offsetLimit
must be
greater than the current position.requireNextWord
- if true
, the current position
that is returned if the entire next word does not fit within
wrappingWidth
. If false
, the offset
returned is at least one greater than the current position.TextLayout
.public TextLayout nextLayout(float wrappingWidth)
wrappingWidth
- the maximum visible advance permitted for
the text in the next layoutTextLayout
, beginning at the current
position, which represents the next line fitting within
wrappingWidth
.public TextLayout nextLayout(float wrappingWidth, int offsetLimit, boolean requireNextWord)
wrappingWidth
- the maximum visible advance permitted
for the text in the next layoutoffsetLimit
- the first character that can not be
included in the next layout, even if the text after the limit
would fit within the wrapping width. offsetLimit
must be greater than the current position.requireNextWord
- if true
, and if the entire word
at the current position does not fit within the wrapping width,
null
is returned. If false
, a valid
layout is returned that includes at least the character at the
current position.TextLayout
, beginning at the current
position, that represents the next line fitting within
wrappingWidth
. If the current position is at the end of
the text used by this LineBreakMeasurer
,
null
is returned.public int getPosition()
LineBreakMeasurer
.LineBreakMeasurer
.setPosition(int)
public void setPosition(int newPosition)
LineBreakMeasurer
.newPosition
- the current position of this
LineBreakMeasurer
. The position should be within the
text used to construct this LineBreakMeasurer
(or in
the text most recently passed to insertChar
or deleteChar
.getPosition()
public void insertChar(AttributedCharacterIterator newParagraph, int insertPos)
LineBreakMeasurer
after a single
character is inserted into the text, and sets the current
position to the beginning of the paragraph.newParagraph
- the text after the insertioninsertPos
- the position in the text at which the character
is inserteddeleteChar(java.text.AttributedCharacterIterator, int)
public void deleteChar(AttributedCharacterIterator newParagraph, int deletePos)
LineBreakMeasurer
after a single
character is deleted from the text, and sets the current
position to the beginning of the paragraph.newParagraph
- the text after the deletiondeletePos
- the position in the text at which the character
is deletedinsertChar(java.text.AttributedCharacterIterator, int)
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.