Java Code Examples for java.awt.font.LineMetrics.getNumChars()

The following are Jave code examples for showing how to use getNumChars() of the java.awt.font.LineMetrics class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Push2Display   File: GVTLineMetrics.java   View Source Code Vote up 6 votes
/**
 * Constructs a GVTLineMetrics object based on the specified line metrics.
 *
 * @param lineMetrics The lineMetrics object that this metrics object will
 * be based upon.
 */
public GVTLineMetrics(LineMetrics lineMetrics) {
    this.ascent = lineMetrics.getAscent();
    this.baselineIndex = lineMetrics.getBaselineIndex();
    this.baselineOffsets = lineMetrics.getBaselineOffsets();
    this.descent = lineMetrics.getDescent();
    this.height = lineMetrics.getHeight();
    this.leading = lineMetrics.getLeading();
    this.numChars = lineMetrics.getNumChars();
    this.strikethroughOffset = lineMetrics.getStrikethroughOffset();
    this.strikethroughThickness = lineMetrics.getStrikethroughThickness();
    this.underlineOffset = lineMetrics.getUnderlineOffset();
    this.underlineThickness = lineMetrics.getUnderlineThickness();
    this.overlineOffset = -this.ascent;
    this.overlineThickness = this.underlineThickness;
}
 
Example 2
Project: Push2Display   File: GVTLineMetrics.java   View Source Code Vote up 6 votes
/**
 * Constructs a GVTLineMetrics object based on the specified line metrics
 * with a scale factor applied.
 *
 * @param lineMetrics The lineMetrics object that this metrics object will
 * be based upon.
 * @param scaleFactor The scale factor to apply to all metrics.
 */
public GVTLineMetrics(LineMetrics lineMetrics, float scaleFactor) {
    this.ascent = lineMetrics.getAscent() * scaleFactor;
    this.baselineIndex = lineMetrics.getBaselineIndex();
    this.baselineOffsets = lineMetrics.getBaselineOffsets();
    for (int i=0; i<baselineOffsets.length; i++) {
        this.baselineOffsets[i] *= scaleFactor;
    }
    this.descent = lineMetrics.getDescent() * scaleFactor;
    this.height = lineMetrics.getHeight() * scaleFactor;
    this.leading = lineMetrics.getLeading();
    this.numChars = lineMetrics.getNumChars();
    this.strikethroughOffset = 
        lineMetrics.getStrikethroughOffset() * scaleFactor;
    this.strikethroughThickness = 
        lineMetrics.getStrikethroughThickness() * scaleFactor;
    this.underlineOffset = lineMetrics.getUnderlineOffset() * scaleFactor;
    this.underlineThickness = 
        lineMetrics.getUnderlineThickness() * scaleFactor;
    this.overlineOffset = -this.ascent;
    this.overlineThickness = this.underlineThickness;
}