*
* @param str specified String
* @param frc specified FontRenderContext
*/
private void setDefaultLineMetrics(String str, FontRenderContext frc){
LineMetrics lm = fPhysicalFonts[0].getLineMetrics(str, frc, null);
float maxCharWidth = (float)fPhysicalFonts[0].getMaxCharBounds(frc).getWidth();
if (numFonts == 1) {
this.nlm = (LineMetricsImpl)lm;
return;
}
float[] baselineOffsets = lm.getBaselineOffsets();
int numChars = str.length();
// XXX: default value - common for all Fonts
int baseLineIndex = lm.getBaselineIndex();
float maxUnderlineThickness = lm.getUnderlineThickness();
float maxUnderlineOffset = lm.getUnderlineOffset();
float maxStrikethroughThickness = lm.getStrikethroughThickness();
float minStrikethroughOffset = lm.getStrikethroughOffset();
float maxLeading = lm.getLeading(); // External leading
float maxHeight = lm.getHeight(); // Height of the font ( == (ascent + descent + leading))
float maxAscent = lm.getAscent(); // Ascent of the font
float maxDescent = lm.getDescent(); // Descent of the font
for (int i = 1; i < numFonts; i++){
lm = fPhysicalFonts[i].getLineMetrics(str, frc, null);
if (maxUnderlineThickness < lm.getUnderlineThickness()){
maxUnderlineThickness = lm.getUnderlineThickness();
}
if (maxUnderlineOffset < lm.getUnderlineOffset()){
maxUnderlineOffset = lm.getUnderlineOffset();
}
if (maxStrikethroughThickness < lm.getStrikethroughThickness()){
maxStrikethroughThickness = lm.getStrikethroughThickness();
}
if (minStrikethroughOffset > lm.getStrikethroughOffset()){
minStrikethroughOffset = lm.getStrikethroughOffset();
}
if (maxLeading < lm.getLeading()){
maxLeading = lm.getLeading();
}
if (maxAscent < lm.getAscent()){
maxAscent = lm.getAscent();
}
if (maxDescent < lm.getDescent()){
maxDescent = lm.getDescent();
}
float width = (float)fPhysicalFonts[i].getMaxCharBounds(frc).getWidth();
if(maxCharWidth < width){
maxCharWidth = width;
}
for (int j =0; j < baselineOffsets.length; j++){
float[] offsets = lm.getBaselineOffsets();
if (baselineOffsets[j] > offsets[j]){
baselineOffsets[j] = offsets[j];
}
}