Hi,

This patch fixes another font layout problem, where we were following Sun's API but their implementation didn't.

I've added a note in the Classpath javadoc to explicitly note the difference.

Cheers,
Francis


2007-03-06  Francis Kung  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
        (getGlyphOutline): Apply glyph position translation.
        (getOutline): Do not apply glyph position translation.

Index: gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,v
retrieving revision 1.15
diff -u -r1.15 FreetypeGlyphVector.java
--- gnu/java/awt/peer/gtk/FreetypeGlyphVector.java	12 Feb 2007 21:39:20 -0000	1.15
+++ gnu/java/awt/peer/gtk/FreetypeGlyphVector.java	6 Mar 2007 19:32:47 -0000
@@ -370,13 +370,20 @@
 
   /**
    * Returns the outline of a single glyph.
+   * 
+   * Despite what the Sun API says, this method returns the glyph relative to
+   * the origin of the *entire string*, not each individual glyph.
    */
   public Shape getGlyphOutline(int glyphIndex)
   {
     GeneralPath gp = getGlyphOutlineNative( glyphCodes[ glyphIndex ] );
-    if (glyphTransforms[glyphIndex] != null)
-      gp.transform( glyphTransforms[glyphIndex]);
     
+    AffineTransform tx = AffineTransform.getTranslateInstance(glyphPositions[glyphIndex*2],
+                                                              glyphPositions[glyphIndex*2+1]);
+    if (glyphTransforms[glyphIndex] != null)
+      tx.concatenate( glyphTransforms[glyphIndex]);
+
+    gp.transform(tx);
     return gp;
   }
 
@@ -456,14 +463,8 @@
   public Shape getOutline()
   {
     GeneralPath path = new GeneralPath();
-    AffineTransform tx = new AffineTransform();
     for( int i = 0; i < getNumGlyphs(); i++ )
-      {
-        Shape outline = getGlyphOutline(i);
-        tx.setToTranslation(glyphPositions[i*2], glyphPositions[i*2 +1]);
-        outline = tx.createTransformedShape(outline);
-        path.append(outline, false);
-      }
+      path.append(getGlyphOutline(i), false);
     return path;
   }
 

Reply via email to