public class MTextDocument.Portion extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
endsWith(char c)
Tests whether this text portion ends with the specified character.
|
double |
getAscent(Graphics g,
FontMetrics fm0)
Gets the ascent of this portion.
|
double |
getDescent(Graphics g,
FontMetrics fm0)
Gets the descent of this portion.
|
double |
getEndDx()
Gets the x shift at the end.
|
int |
getEndPos()
Gets the position of the last character + 1.
|
String |
getPlainText()
Gets the selected text as a plain text string.
|
MTextDocument.Portion |
getPortion(int start,
int end)
Gets a portion of the text relative to this portion.
|
int |
getStartPos()
Gets the position of the first character.
|
int |
length()
Gets the number of characters.
|
double |
portionWidth(Graphics g,
MFont dmfont,
FontMetrics fm0)
Gets the width of this portion.
|
double |
portionXAdvance(Graphics g,
MFont dmf,
FontMetrics fm0)
Gets the x coordinate change from the beginning to the end of
this portion.
|
double |
portionXAdvance(Graphics g,
MFont dmfont,
FontMetrics fm0,
boolean lastxadv)
Gets the width of this portion.
|
String |
toString()
Gets the string representation of the portion.
|
public final int getStartPos()
public final int getEndPos()
public final int length()
public final double portionWidth(Graphics g, MFont dmfont, FontMetrics fm0)
g
- the graphics context or nullfm0
- default font metricspublic final double portionXAdvance(Graphics g, MFont dmf, FontMetrics fm0)
g
- the graphics context or nullfm0
- default font metricspublic final double portionXAdvance(Graphics g, MFont dmfont, FontMetrics fm0, boolean lastxadv)
g
- the graphics context or nullfm0
- default font metricslastxadv
- whether to calculate the x advance for the
next section beginning at the last characterpublic final double getEndDx()
public final double getAscent(Graphics g, FontMetrics fm0)
g
- the graphics context or nullfm0
- default font metricspublic final double getDescent(Graphics g, FontMetrics fm0)
g
- the graphics context or nullfm0
- default font metricspublic final MTextDocument.Portion getPortion(int start, int end)
start
- relative start positionend
- relative end positionpublic final String getPlainText()
public final String toString()
public boolean endsWith(char c)
c
- the character