Constructors Summary |
---|
public LineMetricsImpl(int len, float[] metrics, float[] _baselineData)Creates LineMetricsImpl object from specified parameters. If baseline data parameter
is null than {0, (-ascent+descent)/2, -ascent} values are used for baseline offsets.
numChars = len;
ascent = metrics[0]; // Ascent of the font
descent = metrics[1]; // Descent of the font
leading = metrics[2]; // External leading
height = metrics[0] + metrics[1] + metrics[2]; // Height of the font ( == (ascent + descent + leading))
|
public LineMetricsImpl(int _numChars, int _baseLineIndex, float[] _baselineOffsets, float _underlineThickness, float _underlineOffset, float _strikethroughThickness, float _strikethroughOffset, float _leading, float _height, float _ascent, float _descent, float _maxCharWidth)Creates LineMetricsImpl object from specified parameters. If baseline data parameter
is null than {0, (-ascent+descent)/2, -ascent} values are used for baseline offsets.
numChars = _numChars;
baseLineIndex = _baseLineIndex;
underlineThickness = _underlineThickness;
underlineOffset = _underlineOffset;
strikethroughThickness = _strikethroughThickness;
strikethroughOffset = _strikethroughOffset;
leading = _leading;
height = _height;
ascent = _ascent;
descent = _descent;
baselineOffsets = _baselineOffsets;
lUnderlineThickness = (int) underlineThickness;
lUnderlineOffset = (int) underlineOffset;
lStrikethroughThickness = (int) strikethroughThickness;
lStrikethroughOffset = (int) strikethroughOffset;
lLeading = (int) leading;
lHeight = (int) height;
lAscent = (int) ascent;
lDescent = (int) descent;
maxCharWidth = _maxCharWidth;
|
public LineMetricsImpl()
|
Methods Summary |
---|
public java.lang.Object | clone()
try{
return super.clone();
}catch (CloneNotSupportedException e){
return null;
}
|
public float | getAscent()Returns the ascent.
return ascent;
|
public int | getBaselineIndex()Returns index of the baseline, one of predefined constants.
// Baseline index is the deafult baseline index value
// taken from the TrueType table "BASE".
return baseLineIndex;
|
public float[] | getBaselineOffsets()Returns offset of the baseline.
// XXX: at the moment there only horizontal metrics are taken into
// account. If there is no baseline information in TrueType font
// file default values used: {0, -ascent, (-ascent+descent)/2}
return baselineOffsets;
|
public float | getDescent()Returns the descent.
return descent;
|
public float | getHeight()Returns the height of the font.
//return height; // equals to (ascent + descent + leading);
return ascent + descent + leading;
|
public float | getLeading()Returns the leading.
return leading;
|
public int | getLogicalAscent()Returns the logical ascent.
return lAscent;
|
public int | getLogicalDescent()Returns the logical descent.
return lDescent;
|
public int | getLogicalHeight()Returns the logical height of the font.
return lHeight; // equals to (ascent + descent + leading);
|
public int | getLogicalLeading()Returns the logical leading.
return lLeading;
|
public int | getLogicalMaxCharWidth()Returns the logical size of the widest char.
return lMaxCharWidth;
|
public int | getLogicalStrikethroughOffset()Returns logical offset of the Strikethrough line.
return lStrikethroughOffset;
|
public int | getLogicalStrikethroughThickness()Returns logical thickness of the Strikethrough line.
return lStrikethroughThickness;
|
public int | getLogicalUnderlineOffset()Returns logical offset of the Underline.
return lUnderlineOffset;
|
public int | getLogicalUnderlineThickness()Returns logical thickness of the Underline.
return lUnderlineThickness;
|
public float | getMaxCharWidth()Returns the size of the widest char.
return maxCharWidth;
|
public int | getNumChars()Returns a number of chars in specified text
return numChars;
|
public float | getStrikethroughOffset()Returns offset of the Strikethrough line.
return strikethroughOffset;
|
public float | getStrikethroughThickness()Returns thickness of the Strikethrough line.
return strikethroughThickness;
|
public float | getUnderlineOffset()Returns offset of the Underline.
return underlineOffset;
|
public float | getUnderlineThickness()Returns thickness of the Underline.
return underlineThickness;
|
public void | scale(float scaleX, float scaleY)All metrics are scaled according to scaleX and scaleY values.
This function helps to recompute metrics according to the scale factors
of desired AffineTransform.
float absScaleX = Math.abs(scaleX);
float absScaleY = Math.abs(scaleY);
underlineThickness *= absScaleY;
underlineOffset *= scaleY;
strikethroughThickness *= absScaleY;
strikethroughOffset *= scaleY;
leading *= absScaleY;
height *= absScaleY;
ascent *= absScaleY;
descent *= absScaleY;
if(baselineOffsets == null) {
getBaselineOffsets();
}
for (int i=0; i< baselineOffsets.length; i++){
baselineOffsets[i] *= scaleY;
}
lUnderlineThickness *= absScaleY;
lUnderlineOffset *= scaleY;
lStrikethroughThickness *= absScaleY;
lStrikethroughOffset *= scaleY;
lLeading *= absScaleY;
lHeight *= absScaleY;
lAscent *= absScaleY;
lDescent *= absScaleY;
maxCharWidth *= absScaleX;
|
public void | setNumChars(int num)Set num chars to the desired value.
numChars = num;
|