6761856: OpenJDK: vertical text metrics may be significanly different from those returned by Sun JDK
authorigor
Wed, 29 Oct 2008 01:52:22 +0300
changeset 1733 95c41a86eac9
parent 1732 cbd1ef3625fc
child 1734 861400729115
6761856: OpenJDK: vertical text metrics may be significanly different from those returned by Sun JDK Reviewed-by: bae, prr
jdk/src/share/native/sun/font/freetypeScaler.c
jdk/test/java/awt/font/TextLayout/TextLayoutBounds.java
--- a/jdk/src/share/native/sun/font/freetypeScaler.c	Tue Oct 28 14:47:14 2008 -0700
+++ b/jdk/src/share/native/sun/font/freetypeScaler.c	Wed Oct 29 01:52:22 2008 +0300
@@ -1281,7 +1281,7 @@
                                    sunFontIDs.rect2DFloatClass,
                                    sunFontIDs.rect2DFloatCtr4,
                                    F26Dot6ToFloat(bbox.xMin),
-                                   F26Dot6ToFloat(bbox.yMax),
+                                   F26Dot6ToFloat(-bbox.yMax),
                                    F26Dot6ToFloat(bbox.xMax-bbox.xMin),
                                    F26Dot6ToFloat(bbox.yMax-bbox.yMin));
     }
--- a/jdk/test/java/awt/font/TextLayout/TextLayoutBounds.java	Tue Oct 28 14:47:14 2008 -0700
+++ b/jdk/test/java/awt/font/TextLayout/TextLayoutBounds.java	Wed Oct 29 01:52:22 2008 +0300
@@ -22,7 +22,7 @@
  */
 /* @test
  * @summary verify TextLayout.getBounds() return visual bounds
- * @bug 6323611
+ * @bug 6323611 6761856
  */
 
 import java.awt.*;
@@ -39,10 +39,15 @@
        Rectangle2D tlBounds = tl.getBounds();
        GlyphVector gv = f.createGlyphVector(frc, s);
        Rectangle2D gvvBounds = gv.getVisualBounds();
+       Rectangle2D oBounds = tl.getOutline(null).getBounds2D();
        System.out.println("tlbounds="+tlBounds);
        System.out.println("gvbounds="+gvvBounds);
+       System.out.println("outlineBounds="+oBounds);
        if (!gvvBounds.equals(tlBounds)) {
-          throw new RuntimeException("Bounds differ");
+          throw new RuntimeException("Bounds differ [gvv != tl]");
+       }
+       if (!tlBounds.equals(oBounds)) {
+          throw new RuntimeException("Bounds differ [tl != outline]");
        }
     }
 }