BasicMetricspublic class BasicMetrics extends Object Date: May 14, 2005
Time: 7:44:13 PM
This class incapsulates text metrics specific for the text layout or
for the separate text segment. Text segment is a text run with the constant direction
and attributes like font, decorations, etc. BasicMetrics is also used to store
calculated text metrics like advance, ascent or descent. this class is very similar to
LineMetrics, but provides some additional info, constructors and is more transparent. |
Fields Summary |
---|
int | baseLineIndex | float | ascent | float | descent | float | leading | float | advance | float | italicAngle | float | superScriptOffset | float | underlineOffset | float | underlineThickness | float | strikethroughOffset | float | strikethroughThickness |
Constructors Summary |
---|
BasicMetrics(LineMetrics lm, Font font)Constructs BasicMetrics from LineMetrics and font
ascent = lm.getAscent();
descent = lm.getDescent();
leading = lm.getLeading();
underlineOffset = lm.getUnderlineOffset();
underlineThickness = lm.getUnderlineThickness();
strikethroughOffset = lm.getStrikethroughOffset();
strikethroughThickness = lm.getStrikethroughThickness();
baseLineIndex = lm.getBaselineIndex();
italicAngle = font.getItalicAngle();
superScriptOffset = (float) font.getTransform().getTranslateY();
| BasicMetrics(GraphicAttribute ga)Constructs BasicMetrics from GraphicAttribute.
It gets ascent and descent from the graphic attribute and
computes reasonable defaults for other metrics.
ascent = ga.getAscent();
descent = ga.getDescent();
leading = 2;
baseLineIndex = ga.getAlignment();
italicAngle = 0;
superScriptOffset = 0;
underlineOffset = Math.max(descent/2, 1);
// Just suggested, should be cap_stem_width or something like that
underlineThickness = Math.max(ascent/13, 1);
strikethroughOffset = -ascent/2; // Something like middle of the line
strikethroughThickness = underlineThickness;
| BasicMetrics(TextMetricsCalculator tmc)Copies metrics from the TextMetricsCalculator object.
ascent = tmc.ascent;
descent = tmc.descent;
leading = tmc.leading;
advance = tmc.advance;
baseLineIndex = tmc.baselineIndex;
|
Methods Summary |
---|
public float | getAdvance()
return advance;
| public float | getAscent()
return ascent;
| public int | getBaseLineIndex()
return baseLineIndex;
| public float | getDescent()
return descent;
| public float | getLeading()
return leading;
|
|