When the font transform has a rotation and offset, Openjdk 7 doesn't
position text the same in drawString and TextLayout.
There are still small discrepancies but this fixes the main problem.
Doug
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
diff -r 8266cb7549d3 src/share/classes/sun/font/AttributeValues.java
--- a/src/share/classes/sun/font/AttributeValues.java Fri Feb 29 20:04:01 2008 -0800
+++ b/src/share/classes/sun/font/AttributeValues.java Thu Apr 17 10:30:21 2008 -0700
@@ -887,10 +887,10 @@ public final class AttributeValues imple
try {
AffineTransform rtxi = rtx.createInverse();
+ double dx = tx.getTranslateX();
+ double dy = tx.getTranslateY();
tx.preConcatenate(rtxi);
if (andTranslation) {
- double dx = tx.getTranslateX();
- double dy = tx.getTranslateY();
if (dx != 0 || dy != 0) {
tx.setTransform(tx.getScaleX(), tx.getShearY(),
tx.getShearX(), tx.getScaleY(), 0, 0);
diff -r 8266cb7549d3 src/share/native/sun/font/freetypeScaler.c
--- a/src/share/native/sun/font/freetypeScaler.c Fri Feb 29 20:04:01 2008 -0800
+++ b/src/share/native/sun/font/freetypeScaler.c Thu Apr 17 10:30:21 2008 -0700
@@ -368,7 +368,7 @@ Java_sun_font_FreetypeFontScaler_createS
//text can not be smaller than 1 point
ptsz = 1.0;
}
- context->ptsz = (((int) ptsz) << 6);
+ context->ptsz = (int)(ptsz * 64);
context->transform.xx = FloatToFTFixed((float)dmat[0]/ptsz);
context->transform.yx = -FloatToFTFixed((float)dmat[1]/ptsz);
context->transform.xy = -FloatToFTFixed((float)dmat[2]/ptsz);
@@ -779,8 +779,9 @@ Java_sun_font_FreetypeFontScaler_getGlyp
}
if (context->fmType == TEXT_FM_ON) {
- glyphInfo->advanceX = FT26Dot6ToFloat(ftglyph->advance.x);
- glyphInfo->advanceY = FT26Dot6ToFloat(-ftglyph->advance.y);
+ double advh = FTFixedToFloat(ftglyph->linearHoriAdvance);
+ glyphInfo->advanceX = (float) (advh * FTFixedToFloat(context->transform.xx));
+ glyphInfo->advanceY = (float) (advh * FTFixedToFloat(context->transform.xy));
} else {
glyphInfo->advanceX =
(float) ROUND(FT26Dot6ToFloat(ftglyph->advance.x));