|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
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 spaceinsertChar(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
IllegalArgumentException
- if the text has less than one characterinsertChar(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 layout
TextLayout
.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 positionrequireNextWord
- 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 layout
TextLayout
, 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 positionrequireNextWord
- 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 returnedpublic 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 inserted
IndexOutOfBoundsException
- if insertPos
is less
than the start of newParagraph
or greater than
or equal to the end of newParagraph
NullPointerException
- if newParagraph
is
null
deleteChar(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 deleted
IndexOutOfBoundsException
- if deletePos
is
less than the start of newParagraph
or greater
than the end of newParagraph
NullPointerException
- if newParagraph
is
null
insertChar(java.text.AttributedCharacterIterator, int)