6694480: Two small inefficiencies in getting font strikes for transformed fonts

Reviewed-by: igor, tdv
This commit is contained in:
Phil Race 2008-04-28 09:59:35 -07:00
parent edfa6ff652
commit 88cfc253d1
2 changed files with 15 additions and 2 deletions

View File

@ -1970,7 +1970,6 @@ public class Font implements java.io.Serializable
* in the JDK - and the only likely caller - is in this same class.
*/
private float getItalicAngle(FontRenderContext frc) {
AffineTransform at = (isTransformed()) ? getTransform() : identityTx;
Object aa, fm;
if (frc == null) {
aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
@ -1979,7 +1978,7 @@ public class Font implements java.io.Serializable
aa = frc.getAntiAliasingHint();
fm = frc.getFractionalMetricsHint();
}
return getFont2D().getItalicAngle(this, at, aa, fm);
return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
/**

View File

@ -241,6 +241,13 @@ public abstract class Font2D {
if (font.isTransformed()) {
glyphTx.concatenate(font.getTransform());
}
if (glyphTx.getTranslateX() != 0 || glyphTx.getTranslateY() != 0) {
glyphTx.setTransform(glyphTx.getScaleX(),
glyphTx.getShearY(),
glyphTx.getShearX(),
glyphTx.getScaleY(),
0.0, 0.0);
}
FontStrikeDesc desc = new FontStrikeDesc(devTx, glyphTx,
font.getStyle(), aa, fm);
return getStrike(desc, false);
@ -266,6 +273,13 @@ public abstract class Font2D {
at.scale(ptSize, ptSize);
if (font.isTransformed()) {
at.concatenate(font.getTransform());
if (at.getTranslateX() != 0 || at.getTranslateY() != 0) {
at.setTransform(at.getScaleX(),
at.getShearY(),
at.getShearX(),
at.getScaleY(),
0.0, 0.0);
}
}
int aa = FontStrikeDesc.getAAHintIntVal(this, font, frc);
int fm = FontStrikeDesc.getFMHintIntVal(frc.getFractionalMetricsHint());