public class PointFontMetrics extends Object
Modifier | Constructor and Description |
---|---|
protected |
PointFontMetrics() |
|
PointFontMetrics(PointFontDescriptor fd,
PointFont f) |
|
PointFontMetrics(PointGraphics pg,
PointFont f)
Deprecated.
use PointGraphics.getPointFontMetrics() instead.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Returns if this object is considered equal to the other object.
|
void |
free()
Free the resources used by the PointFontMetrics.
|
double |
getAscent()
Return the maximum ascent (height above the baseline) of the Font in points.
|
double |
getCharWidth(char c)
Return the width of a specific character in points.
|
double |
getDescent()
Return the maximum descent (height below the baseline) of the Font in points.
|
PointFont |
getFont()
Return the PointFont the metrics represents.
|
double[] |
getFormattedTextPositions(char[] chars,
int start,
int count,
FormattedTextSpecs fts,
double[] positions) |
double |
getHeight()
Return the height from the lowest descent to the highest ascent for the Font.
|
FontMetrics |
getIntFontMetrics()
This PointFontMetrics MAY be based on an standard integer based FontMetrics
or it may be based on a PointFontDescriptor.
|
double |
getLeading()
Return the extra space between font baselines which is normally used.
|
double |
getOvershoot()
Return the maximum distance that any character in this font will be extended to the right
beyond the bounds given by getCharWidth() or getTextWidth().
|
PointRect |
getTextSize(StringList sl,
int start,
int count,
PointRect dest)
Return the smallest rectangle that the specified text will fit into.
|
PointRect |
getTextSize(StringList sl,
PointRect dest)
Return the smallest rectangle that the specified text will fit into.
|
double |
getTextWidth(char[] ch,
int start,
int length)
Return the width of the specified text.
|
double |
getTextWidth(String s)
Return the width of the specified text.
|
boolean |
isSame(PointFontMetrics f)
Return if this Font is the same as another.
|
protected void |
setFor(PointFontDescriptor fd,
PointFont f)
Setup the PointFontMetrics to use the specified PointFontDescriptor.
|
protected PointFontMetrics()
public PointFontMetrics(PointFontDescriptor fd, PointFont f)
public PointFontMetrics(PointGraphics pg, PointFont f)
pg
- the PointGraphics using the Font.f
- the Font.public PointFont getFont()
protected void setFor(PointFontDescriptor fd, PointFont f)
fd
- the non-null PointFontDescriptor.f
- the PointFont.public FontMetrics getIntFontMetrics()
public double getAscent()
public double getDescent()
public double getLeading()
public double getHeight()
public double getCharWidth(char c)
public double getOvershoot()
How this is determined varies depending on the underlying system.
public double getTextWidth(char[] ch, int start, int length)
ch
- the characters of the textstart
- the start of the characters in the array.length
- the number of characters.public double getTextWidth(String s)
s
- the textpublic double[] getFormattedTextPositions(char[] chars, int start, int count, FormattedTextSpecs fts, double[] positions)
public boolean isSame(PointFontMetrics f)
f
- another FontMetrics.public boolean equals(Object obj)
Object
public void free()
public PointRect getTextSize(StringList sl, PointRect dest)
sl
- the text to fit.dest
- a destination PointRect or null for a new one to be created and returned.public PointRect getTextSize(StringList sl, int start, int count, PointRect dest)
sl
- the text to fit.start
- the first index in the StringList of the text to use.count
- the number of lines in the StringList to use.dest
- a destination PointRect or null for a new one to be created and returned.