6694480: Two small inefficiencies in getting font strikes for transformed fonts
Reviewed-by: igor, tdv
--- a/jdk/src/share/classes/java/awt/Font.java Fri Apr 25 10:40:11 2008 -0700
+++ b/jdk/src/share/classes/java/awt/Font.java Mon Apr 28 09:59:35 2008 -0700
@@ -1970,7 +1970,6 @@
* 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 @@
aa = frc.getAntiAliasingHint();
fm = frc.getFractionalMetricsHint();
}
- return getFont2D().getItalicAngle(this, at, aa, fm);
+ return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
/**
--- a/jdk/src/share/classes/sun/font/Font2D.java Fri Apr 25 10:40:11 2008 -0700
+++ b/jdk/src/share/classes/sun/font/Font2D.java Mon Apr 28 09:59:35 2008 -0700
@@ -241,6 +241,13 @@
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 @@
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());