info = new FontInfo();
}
float ptSize = font.getSize2D();
int txFontType;
AffineTransform devAt, textAt=null;
if (font.isTransformed()) {
textAt = font.getTransform();
textAt.scale(ptSize, ptSize);
txFontType = textAt.getType();
info.originX = (float)textAt.getTranslateX();
info.originY = (float)textAt.getTranslateY();
textAt.translate(-info.originX, -info.originY);
if (transformState >= TRANSFORM_TRANSLATESCALE) {
transform.getMatrix(info.devTx = new double[4]);
devAt = new AffineTransform(info.devTx);
textAt.preConcatenate(devAt);
} else {
info.devTx = IDENT_MATRIX;
devAt = IDENT_ATX;
}
textAt.getMatrix(info.glyphTx = new double[4]);
double shearx = textAt.getShearX();
double scaley = textAt.getScaleY();
if (shearx != 0) {
scaley = Math.sqrt(shearx * shearx + scaley * scaley);
}
info.pixelHeight = (int)(Math.abs(scaley)+0.5);
} else {
txFontType = AffineTransform.TYPE_IDENTITY;
info.originX = info.originY = 0;
if (transformState >= TRANSFORM_TRANSLATESCALE) {
transform.getMatrix(info.devTx = new double[4]);
devAt = new AffineTransform(info.devTx);
info.glyphTx = new double[4];
for (int i = 0; i < 4; i++) {
info.glyphTx[i] = info.devTx[i] * ptSize;
}
textAt = new AffineTransform(info.glyphTx);
double shearx = transform.getShearX();
double scaley = transform.getScaleY();
if (shearx != 0) {
scaley = Math.sqrt(shearx * shearx + scaley * scaley);
}
info.pixelHeight = (int)(Math.abs(scaley * ptSize)+0.5);
} else {
/* If the double represents a common integral, we
* may have pre-allocated objects.
* A "sparse" array be seems to be as fast as a switch
* even for 3 or 4 pt sizes, and is more flexible.
* This should perform comparably in single-threaded
* rendering to the old code which synchronized on the
* class and scale better on MP systems.
*/
int pszInt = (int)ptSize;
if (ptSize == pszInt &&
pszInt >= MINALLOCATED && pszInt < TEXTARRSIZE) {
info.glyphTx = textTxArr[pszInt];
textAt = textAtArr[pszInt];
info.pixelHeight = pszInt;
} else {
info.pixelHeight = (int)(ptSize+0.5);
}
if (textAt == null) {
info.glyphTx = new double[] {ptSize, 0, 0, ptSize};
textAt = new AffineTransform(info.glyphTx);
}
info.devTx = IDENT_MATRIX;
devAt = IDENT_ATX;
}