Methods Summary |
---|
protected java.lang.Object | clone()Returns a copy of this object.
return new TextMeasurer((AttributedCharacterIterator)aci.clone(), frc);
|
public void | deleteChar(java.text.AttributedCharacterIterator newParagraph, int deletePos)Replaces the current text with the new text and deletes a character at
the specified position.
AttributedCharacterIterator oldAci = aci;
aci = newParagraph;
if ((oldAci.getEndIndex() - oldAci.getBeginIndex())
- (aci.getEndIndex() - aci.getBeginIndex()) != 1) {
breaker = new TextRunBreaker(aci, this.frc);
tmc = new TextMetricsCalculator(breaker);
} else {
breaker.deleteChar(newParagraph, deletePos);
}
|
public float | getAdvanceBetween(int start, int end)Returns the graphical width of a line beginning at "start" parameter and
including characters up to "end" parameter. "start" and "end" are
absolute indices, not relative to the "start" of the paragraph.
breaker.pushSegments(start - aci.getBeginIndex(), end - aci.getBeginIndex());
breaker.createAllSegments();
float retval = tmc.createMetrics().getAdvance();
breaker.popSegments();
return retval;
|
public java.awt.font.TextLayout | getLayout(int start, int limit)Returns a TextLayout of the specified character range.
breaker.pushSegments(start - aci.getBeginIndex(), limit - aci.getBeginIndex());
breaker.createAllSegments();
TextLayout layout = new TextLayout((TextRunBreaker)breaker.clone());
breaker.popSegments();
return layout;
|
public int | getLineBreakIndex(int start, float maxAdvance)Returns the index of the first character which is not fit on a line
beginning at start and possible measuring up to maxAdvance in graphical
width.
breaker.createAllSegments();
return breaker.getLineBreakIndex(start - aci.getBeginIndex(), maxAdvance)
+ aci.getBeginIndex();
|
public void | insertChar(java.text.AttributedCharacterIterator newParagraph, int insertPos)Replaces the current text with the new text, inserting a break character
at the specified insert position.
AttributedCharacterIterator oldAci = aci;
aci = newParagraph;
if ((oldAci.getEndIndex() - oldAci.getBeginIndex())
- (aci.getEndIndex() - aci.getBeginIndex()) != -1) {
breaker = new TextRunBreaker(aci, this.frc);
tmc = new TextMetricsCalculator(breaker);
} else {
breaker.insertChar(newParagraph, insertPos);
}
|