Hi,

This patch adds font substitution functionality to our GTK peers.

The Sun JDK seems to ship with a bundled font that covers many non-English characters, but since we use Freetype, we need to use fontsets and combine different fonts in order to obtain the same coverage (but we now support more fonts than the JDK, as long as the user has it installed on their system!).

I've run through a number of tests and have not noticed any regressions in performance or functionality, but please let me know if there are any problems.

Cheers,
Francis


2007-04-02  Francis Kung  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/CairoGraphics2D.java
        (cairoDrawGlyphVector): Added parameter.
        (drawGlyphVector): Retrieve and pass fontset parameter.
        * gnu/java/awt/peer/gtk/ComponentGraphics.java
        (cairoDrawGlyphVector): Added parameter.
        (lock): Removed unnecessary cast.
        (unlock): Removed unnecessary cast and explicitly set to ONE variable.
        * gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
        (fontSet): New field.
        (dispose): New native method.
        (finalize): New method.
        (getGlyphFonts): New method.
        (getGlyphOutline): Pass fontSet parameter to native method.
        (getGlyphOutlineNative): Added parameter.
        (getGlyphs): Pass extra parameters to native method.
        (getGlyphsNative): Added parameters.
        (getKerning): Added fontSet parameter.
        (getMetricsNative): Added fontSet parameter.
        (performDefaultLayout): Only check kerning if glyphs use the same font.
        (setupGlyphMetrics): Pass extra parameters to native methods.
        * include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
        * include/gnu_java_awt_peer_gtk_FreetypGlyphVector.h: Regenerated.
        * native/jni/gtk-peer/gdkfont.h: Enable pango engine.
        (peerfont): Add variable for fontset.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
        (Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector): 
Accept
        array of font pointers to use when drawing glyphs.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
        (getFontSet): New function.
        (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose): New function.
        (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative):
        Added and use new fontSet parameter.
        (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs): Use pango
        to retrieve glyphs and estimate font, if the current font does not 
contain
        a requested glyph.
        (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning): Added and 
use
        new fontSet parameter.
        (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative): Added
        and use new fontSet parameter.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
        (Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose): Free fontset.
        (Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont): Load fontset.
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c,v
retrieving revision 1.4
diff -u -r1.4 gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c	11 Jun 2006 11:31:03 -0000	1.4
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c	2 Apr 2007 19:36:03 -0000
@@ -35,6 +35,7 @@
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+#define PANGO_ENABLE_ENGINE
 #include <jni.h>
 #include <gtk/gtk.h>
 #include <string.h>
@@ -43,6 +44,7 @@
 #include <pango/pangofc-font.h>
 #include <freetype/ftglyph.h>
 #include <freetype/ftoutln.h>
+#include "jcl.h"
 #include "native_state.h"
 #include "gdkfont.h"
 #include "gnu_java_awt_peer_gtk_FreetypeGlyphVector.h"
@@ -81,42 +83,92 @@
   return (PangoFcFont *)pfont->font;
 }
 
-JNIEXPORT jintArray JNICALL 
+static PangoFontset *
+getFontSet(JNIEnv *env, jobject obj)
+{
+  jfieldID fid;
+  jobject data;
+  jclass cls;
+  struct peerfont *pfont;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  fid = (*env)->GetFieldID (env, cls, "peer", 
+				 "Lgnu/java/awt/peer/gtk/GdkFontPeer;");
+  g_assert (fid != 0);
+
+  data = (*env)->GetObjectField (env, obj, fid);
+  g_assert (data != NULL);
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, data);
+  g_assert (pfont != NULL);
+  g_assert (pfont->font != NULL);
+
+  return (PangoFontset *)pfont->set;
+}
+
+JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs
-  (JNIEnv *env, jobject obj, jintArray codepoints)
+  (JNIEnv *env, jobject obj, jintArray codepoints, jintArray glyphs,
+   jlongArray fonts)
 {
-  FT_Face ft_face;
-  jintArray retArray;
-  PangoFcFont *font;
-  jint *values, *cpvals;
+  PangoFcFont *default_font, *current_font;
+  PangoFontset *pfs;
+  jint *cpvals;
   jint length;
   int i;
 
-  font = getFont(env, obj);
-
-  ft_face = pango_fc_font_lock_face( font );
-  g_assert (ft_face != NULL);
+  /* Set up default font and fontset */
+  default_font = getFont(env, obj);
+  current_font = default_font;
+  pfs = getFontSet(env, obj);
 
+  /* Retrieve string information */
   length = (*env)->GetArrayLength (env, codepoints);
   cpvals = (*env)->GetIntArrayElements (env, codepoints, NULL);
+  
+  jint *glyphArray = (*env)->GetIntArrayElements (env, glyphs, NULL);
+  jlong *fontArray = (*env)->GetLongArrayElements (env, fonts, NULL);
 
-  retArray = (*env)->NewIntArray (env, length);
-  values = (*env)->GetIntArrayElements (env, retArray, NULL);
+  /* A design goal of Pango is to be threadsafe, but it's admitted that it is
+   * not actually threadsafe at the moment.  Using gdk locking here to be safe,
+   * but I don't know if if actually helps at all... */ 
+  gdk_threads_enter();
 
   for( i = 0; i < length; i++ )
-    values[i] = FT_Get_Char_Index( ft_face, cpvals[i] );
+  {
+  	/* Ensure the current font has the requested character; if it doesn't,
+  	 * try the default font before pulling a new font out of the fontset.
+  	 * Once chosen, a font will be used until a character not in the font is
+  	 * encountered. */ 
+  	if (!pango_fc_font_has_char(current_font, cpvals[i]))
+  	  {
+  	    if (pango_fc_font_has_char(default_font, cpvals[i]))
+  	      {
+  	        current_font = default_font;
+  	      }
+  	    else
+  	      {
+  	        current_font = (PangoFcFont*)pango_fontset_get_font(pfs, cpvals[i]);
+  	      }
+  	  }
+  	
+  	/* Get glyph, and store both glyph and pointer to font */
+    glyphArray[i] = (int)pango_fc_font_get_glyph(current_font,
+                                                 (gunichar)cpvals[i]);
+    g_object_ref(current_font);
+    fontArray[i] = PTR_TO_JLONG(current_font);
+  }
+  
+  gdk_threads_leave();
 
-  (*env)->ReleaseIntArrayElements (env, retArray, values, 0);
+  (*env)->ReleaseIntArrayElements (env, glyphs, glyphArray, 0);
   (*env)->ReleaseIntArrayElements (env, codepoints, cpvals, 0);
-
-  pango_fc_font_unlock_face (font);
-
-  return retArray;
+  (*env)->ReleaseLongArrayElements (env, fonts, fontArray, 0);
 }
 
 JNIEXPORT jobject JNICALL 
 Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning
-(JNIEnv *env, jobject obj, jint rightGlyph, jint leftGlyph)
+(JNIEnv *env, jobject obj __attribute__((unused)), jint rightGlyph, jint leftGlyph, jlong fnt)
 {
   FT_Face ft_face;
   FT_Vector kern;
@@ -125,7 +177,7 @@
   jvalue values[2];
   PangoFcFont *font;
 
-  font = getFont(env, obj);
+  font = JLONG_TO_PTR(PangoFcFont, fnt);
   ft_face = pango_fc_font_lock_face( font );
   g_assert (ft_face != NULL);
   FT_Get_Kerning( ft_face, rightGlyph, leftGlyph, FT_KERNING_DEFAULT, &kern );
@@ -142,14 +194,14 @@
 
 JNIEXPORT jdoubleArray JNICALL 
 Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative
-(JNIEnv *env, jobject obj, jint glyphIndex )
+(JNIEnv *env, jobject obj __attribute__((unused)), jint glyphIndex, jlong fnt)
 {
   FT_Face ft_face;
   jdouble *values;
   jdoubleArray retArray = NULL;
   PangoFcFont *font;
 
-  font = getFont(env, obj);
+  font = JLONG_TO_PTR(PangoFcFont, fnt);
   ft_face = pango_fc_font_lock_face( font );
 
   g_assert (ft_face != NULL);
@@ -285,7 +337,7 @@
 
 JNIEXPORT jobject JNICALL 
 Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative
- (JNIEnv *env, jobject obj, jint glyphIndex)
+ (JNIEnv *env, jobject obj __attribute__((unused)), jint glyphIndex, jlong fnt)
 {
   generalpath *path;
   jobject gp;
@@ -302,7 +354,7 @@
   FT_Face ft_face;
   FT_Glyph glyph;
 
-  font = getFont(env, obj);
+  font = JLONG_TO_PTR(PangoFcFont, fnt);
   ft_face = pango_fc_font_lock_face( font );
 
   g_assert (ft_face != NULL);
@@ -345,4 +397,26 @@
   return gp; 
 }
 
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose
+ (JNIEnv *env, jobject obj __attribute__((unused)), jlongArray fontset)
+{
+  PangoFcFont *font;
+  jlong *fontArray; 
+  int i, length;
+
+  length = (*env)->GetArrayLength (env, fontset);
+  fontArray = (*env)->GetLongArrayElements (env, fontset, NULL);
+  
+  gdk_threads_enter();
+  
+  for( i = 0; i < length; i++ )
+  {
+    font = JLONG_TO_PTR(PangoFcFont, fontArray[i]);
+    g_object_unref(font);
+  }
+  
+  gdk_threads_leave();
 
+  (*env)->ReleaseLongArrayElements (env, fontset, fontArray, 0);
+}
Index: native/jni/gtk-peer/gdkfont.h
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gdkfont.h,v
retrieving revision 1.10
diff -u -r1.10 gdkfont.h
--- native/jni/gtk-peer/gdkfont.h	21 Nov 2006 14:14:25 -0000	1.10
+++ native/jni/gtk-peer/gdkfont.h	2 Apr 2007 19:36:03 -0000
@@ -40,6 +40,7 @@
 
 #include "gtkpeer.h"
 
+#define PANGO_ENABLE_ENGINE
 #include <pango/pango.h>
 #include <pango/pango-context.h>
 #include <pango/pango-fontmap.h>
@@ -123,6 +124,7 @@
 struct peerfont
 {
   PangoFont *font;
+  PangoFontset *set;
   PangoFontDescription *desc;
   PangoContext *ctx;
   PangoLayout *layout;
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,v
retrieving revision 1.21
diff -u -r1.21 gnu_java_awt_peer_gtk_CairoGraphics2D.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c	16 Mar 2007 15:14:55 -0000	1.21
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c	2 Apr 2007 19:36:03 -0000
@@ -308,9 +308,8 @@
  jobject font,
  jfloat x, jfloat y, jint n,
  jintArray java_codes,
- jfloatArray java_positions)
+ jfloatArray java_positions, jlongArray java_fontset)
 {
-  
   struct cairographics2d *gr = NULL;
   struct peerfont *pfont = NULL;
   cairo_glyph_t *glyphs = NULL;
@@ -333,6 +332,7 @@
   native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
   native_positions = (*env)->GetFloatArrayElements (env, java_positions, NULL);
   
+  /* Set up glyphs and layout */
   for (i = 0; i < n; ++i)
     {
       glyphs[i].index = native_codes[i];
@@ -343,10 +343,31 @@
   (*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
   (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
 
-  pango_fc_font_lock_face( (PangoFcFont *)pfont->font );
-  cairo_show_glyphs (gr->cr, glyphs, n);
-  pango_fc_font_unlock_face( (PangoFcFont *)pfont->font );
+  /* Iterate through glyphs and draw */
+  jlong* fonts = (*env)->GetLongArrayElements (env, java_fontset, NULL);
+  for (i = 0; i < n; i++)
+    {
+      PangoFcFont *font = JLONG_TO_PTR(PangoFcFont, fonts[i]);
+
+      /* Draw as many glyphs as possible with the current font */
+      int length = 0;
+      while (i < n-1 && fonts[i] == fonts[i+1])
+        {
+          length++;
+          i++;
+        }
+    
+      FT_Face face = pango_fc_font_lock_face( font );
+      cairo_font_face_t *ft = cairo_ft_font_face_create_for_ft_face (face, 0);
+      g_assert (ft != NULL);
 
+      cairo_set_font_face (gr->cr, ft);
+      cairo_show_glyphs (gr->cr, &glyphs[i-length], length+1);
+                       
+      cairo_font_face_destroy (ft);
+      pango_fc_font_unlock_face(font);
+    }
+    
   g_free(glyphs);
 }
 
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c,v
retrieving revision 1.22
diff -u -r1.22 gnu_java_awt_peer_gtk_GdkFontPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c	26 Feb 2007 22:11:38 -0000	1.22
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c	2 Apr 2007 19:36:03 -0000
@@ -35,6 +35,7 @@
    obligated to do so.  If you do not wish to do so, delete this
    exception statement from your version. */
 
+#define PANGO_ENABLE_ENGINE
 #include <pango/pango.h>
 #include <pango/pangoft2.h>
 #include <pango/pangofc-font.h>
@@ -97,6 +98,8 @@
     g_object_unref (pfont->layout);
   if (pfont->font != NULL)
     g_object_unref (pfont->font);
+  if (pfont->set != NULL)
+    g_object_unref (pfont->set);
   if (pfont->ctx != NULL)
     g_object_unref (pfont->ctx);
   if (pfont->desc != NULL)
@@ -257,6 +260,8 @@
     g_object_unref (pfont->ctx);
   if (pfont->font != NULL)
     g_object_unref (pfont->font);
+  if (pfont->set != NULL)
+    g_object_unref (pfont->set);
   if (pfont->desc != NULL)
     pango_font_description_free (pfont->desc);
 
@@ -268,7 +273,6 @@
   pango_font_description_set_family (pfont->desc, family_name);
   (*env)->ReleaseStringUTFChars(env, family_name_str, family_name);
 
-
   if (style & java_awt_font_BOLD)
     pango_font_description_set_weight (pfont->desc, PANGO_WEIGHT_BOLD);
 
@@ -293,6 +297,8 @@
   
   pango_context_set_font_description (pfont->ctx, pfont->desc);
   pango_context_set_language (pfont->ctx, gtk_get_default_language());
+  pfont->set = pango_context_load_fontset(pfont->ctx, pfont->desc,
+  										  gtk_get_default_language());
   pfont->font = pango_context_load_font (pfont->ctx, pfont->desc);
   g_assert (pfont->font != NULL);
 
Index: gnu/java/awt/peer/gtk/ComponentGraphics.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,v
retrieving revision 1.25
diff -u -r1.25 ComponentGraphics.java
--- gnu/java/awt/peer/gtk/ComponentGraphics.java	16 Mar 2007 15:14:53 -0000	1.25
+++ gnu/java/awt/peer/gtk/ComponentGraphics.java	2 Apr 2007 19:36:03 -0000
@@ -121,7 +121,7 @@
    */
   private void lock()
   {
-    Integer i = (Integer) hasLock.get();
+    Integer i = hasLock.get();
     if (i == null)
       {
         start_gdk_drawing();
@@ -136,7 +136,7 @@
    */
   private void unlock()
   {
-    Integer i = (Integer) hasLock.get();
+    Integer i = hasLock.get();
     if (i == null)
       throw new IllegalStateException();
     if (i == ONE)
@@ -144,6 +144,8 @@
         hasLock.set(null);
         end_gdk_drawing();
       }
+    else if (i.intValue() == 2)
+      hasLock.set(ONE);
     else
       hasLock.set(Integer.valueOf(i.intValue() - 1));
   }
@@ -744,12 +746,14 @@
   @Override
   protected void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
                                       float x, float y, int n,
-                                      int[] codes, float[] positions)
+                                      int[] codes, float[] positions,
+                                      long[] fontset)
   {
     try
     {
       lock();
-      super.cairoDrawGlyphVector(pointer, font, x, y, n, codes, positions);
+      super.cairoDrawGlyphVector(pointer, font, x, y, n, codes, positions,
+                                 fontset);
     }
     finally
     {
Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v
retrieving revision 1.67
diff -u -r1.67 CairoGraphics2D.java
--- gnu/java/awt/peer/gtk/CairoGraphics2D.java	16 Mar 2007 15:14:53 -0000	1.67
+++ gnu/java/awt/peer/gtk/CairoGraphics2D.java	2 Apr 2007 19:36:03 -0000
@@ -402,7 +402,7 @@
    */
   protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font, 
                                    float x, float y, int n, 
-                                   int[] codes, float[] positions);
+                                   int[] codes, float[] positions, long[] fontset);
 
   /**
    * Set the font in cairo.
@@ -1730,6 +1730,7 @@
       {
         int n = gv.getNumGlyphs ();
         int[] codes = gv.getGlyphCodes (0, n, null);
+        long[] fontset = ((FreetypeGlyphVector)gv).getGlyphFonts (0, n, null);
         float[] positions = gv.getGlyphPositions (0, n, null);
 
         setFont (gv.getFont ());
@@ -1737,7 +1738,7 @@
         synchronized (fontPeer) 
           { 
             cairoDrawGlyphVector(nativePointer, fontPeer,
-                                 x, y, n, codes, positions);
+                                 x, y, n, codes, positions, fontset);
           }
       }
     else
Index: gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,v
retrieving revision 1.16
diff -u -r1.16 FreetypeGlyphVector.java
--- gnu/java/awt/peer/gtk/FreetypeGlyphVector.java	6 Mar 2007 19:38:31 -0000	1.16
+++ gnu/java/awt/peer/gtk/FreetypeGlyphVector.java	2 Apr 2007 19:36:03 -0000
@@ -79,6 +79,11 @@
    * The glyph codes
    */
   private int[] glyphCodes;
+  
+  /**
+   * The set of fonts used in this glyph vector.
+   */
+  private long[] fontSet;
 
   /**
    * Glyph transforms. (de facto only the translation is used)
@@ -86,6 +91,8 @@
   private AffineTransform[] glyphTransforms;
 
   private GlyphMetrics[] metricsCache;
+  
+  private native void dispose(long[] fonts);
 
   /**
    * Create a glyphvector from a given (Freetype) font and a String.
@@ -167,6 +174,11 @@
     System.arraycopy(gv.glyphPositions, 0, glyphPositions, 0,
                      glyphPositions.length);
   }
+  
+  public void finalize()
+  {
+    dispose(fontSet);
+  }
 
   /**
    * Create the array of glyph codes.
@@ -175,6 +187,7 @@
   {
     nGlyphs = s.codePointCount( 0, s.length() );
     glyphCodes = new int[ nGlyphs ];
+    fontSet = new long[ nGlyphs ];
     int[] codePoints = new int[ nGlyphs ];
     int stringIndex = 0;
 
@@ -194,22 +207,22 @@
           }
       }
 
-   glyphCodes = getGlyphs( codePoints );
+    getGlyphs( codePoints, glyphCodes, fontSet );
   }
 
   /**
    * Returns the glyph code within the font for a given character
    */
-  public native int[] getGlyphs(int[] codepoints);
+  public native int[] getGlyphs(int[] codepoints, int[] glyphs, long[] fonts);
 
   /**
    * Returns the kerning of a glyph pair
    */
-  private native Point2D getKerning(int leftGlyph, int rightGlyph);
+  private native Point2D getKerning(int leftGlyph, int rightGlyph, long font);
 
-  private native double[] getMetricsNative( int glyphCode );
+  private native double[] getMetricsNative(int glyphCode, long font);
 
-  private native GeneralPath getGlyphOutlineNative(int glyphIndex);
+  private native GeneralPath getGlyphOutlineNative(int glyphIndex, long font);
 
 
   public Object clone()
@@ -267,10 +280,12 @@
 
         x += gm.getAdvanceX();
         y += gm.getAdvanceY();
-        
-        if (i != nGlyphs-1)
+
+        // Get the kerning only if it's not the last glyph, and the two glyphs are
+        // using the same font
+        if (i != nGlyphs-1 && fontSet[i] == fontSet[i+1])
           {
-            Point2D p = getKerning(glyphCodes[i], glyphCodes[i + 1]);
+            Point2D p = getKerning(glyphCodes[i], glyphCodes[i + 1], fontSet[i]);
             x += p.getX();
             y += p.getY();
           }
@@ -305,6 +320,26 @@
     return rval;
   }
 
+  /**
+   * Returns pointers to the fonts used in this glyph vector.
+   * 
+   * The array index matches that of the glyph vector itself.
+   */
+  protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries, 
+                                 long[] codeReturn)
+  {
+    long[] rval;
+
+    if( codeReturn == null || codeReturn.length < numEntries)
+      rval = new long[ numEntries ];
+    else
+      rval = codeReturn;
+    
+    System.arraycopy(fontSet, beginGlyphIndex, rval, 0, numEntries);
+
+    return rval;
+  }
+
   public Shape getGlyphLogicalBounds(int glyphIndex)
   {
     GlyphMetrics gm = getGlyphMetrics( glyphIndex );
@@ -335,11 +370,10 @@
 
     for(int i = 0; i < nGlyphs; i++)
       {
-        GlyphMetrics gm = (GlyphMetrics)
-        peer.getGlyphMetrics( glyphCodes[ i ] );
+        GlyphMetrics gm = (GlyphMetrics)peer.getGlyphMetrics(glyphCodes[i]);
         if( gm == null )
           {
-            double[] val = getMetricsNative( glyphCodes[ i ] );
+            double[] val = getMetricsNative(glyphCodes[i], fontSet[i]);
             if( val == null )
               gm = null;
             else
@@ -376,7 +410,8 @@
    */
   public Shape getGlyphOutline(int glyphIndex)
   {
-    GeneralPath gp = getGlyphOutlineNative( glyphCodes[ glyphIndex ] );
+    GeneralPath gp = getGlyphOutlineNative(glyphCodes[glyphIndex],
+                                           fontSet[glyphIndex]);
     
     AffineTransform tx = AffineTransform.getTranslateInstance(glyphPositions[glyphIndex*2],
                                                               glyphPositions[glyphIndex*2+1]);
Index: include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
===================================================================
RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h,v
retrieving revision 1.2
diff -u -r1.2 gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
--- include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h	11 Jun 2006 08:29:57 -0000	1.2
+++ include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h	2 Apr 2007 19:36:03 -0000
@@ -10,10 +10,11 @@
 {
 #endif
 
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs (JNIEnv *env, jobject, jintArray);
-JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning (JNIEnv *env, jobject, jint, jint);
-JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative (JNIEnv *env, jobject, jint);
-JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs (JNIEnv *env, jobject, jintArray, jintArray, jlongArray);
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning (JNIEnv *env, jobject, jint, jint, jlong);
+JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative (JNIEnv *env, jobject, jint, jlong);
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative (JNIEnv *env, jobject, jint, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose (JNIEnv *env, jobject, jlongArray);
 
 #ifdef __cplusplus
 }
Index: include/gnu_java_awt_peer_gtk_CairoGraphics2D.h
===================================================================
RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,v
retrieving revision 1.17
diff -u -r1.17 gnu_java_awt_peer_gtk_CairoGraphics2D.h
--- include/gnu_java_awt_peer_gtk_CairoGraphics2D.h	16 Mar 2007 15:14:53 -0000	1.17
+++ include/gnu_java_awt_peer_gtk_CairoGraphics2D.h	2 Apr 2007 19:36:03 -0000
@@ -22,7 +22,7 @@
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule (JNIEnv *env, jobject, jlong, jint);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine (JNIEnv *env, jobject, jlong, jdouble, jint, jint, jdouble);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash (JNIEnv *env, jobject, jlong, jdoubleArray, jint, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jlong, jobject, jfloat, jfloat, jint, jintArray, jfloatArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jlong, jobject, jfloat, jfloat, jint, jintArray, jfloatArray, jlongArray);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFont (JNIEnv *env, jobject, jlong, jobject);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRectangle (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoArc (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble, jdouble);

Reply via email to