This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] new font model for awt / java2d


hi,

this patch (and associated new files) implement the new font model we
have been discussing recently on the classpath list ( see thread from
http://article.gmane.org/gmane.comp.java.classpath.devel/1933 )

briefly: this code makes java.awt.Font objects delegate all their
logic to a Toolkit-provided peer object called a ClasspathFontPeer. an
extension of java.awt.Toolkit is made, called ClasspathToolkit, which
supports the necessary factory methods. toolkit authors can then
transparently "swap in" different native or pure java font
implementations, along with their respective toolkits.

I do not intend to activate this code immediately, but would like to
commit "all but the changes to Font" to gcc's libjava, for safe
keeping, while I continue to work on integration with supporting code
(pango and cairo).

comments / suggestions?

-graydon


2003-10-14  Graydon Hoare  <graydon@redhat.com>

	* gnu/java/awt/ClasspathToolkit.java: New abstract class.
	* gnu/java/awt/peer/gtk/GtkToolkit.java: Inherit from
	ClasspathToolkit.
	* java/awt/Font.java: Delegate all methods to ClasspathFontPeer
	* gnu/java/awt/peer/ClasspathFontPeer.java: New abstract class.
	* gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c:
	New concrete implementation of ClasspathFontPeer, with native part.
	* gnu/java/awt/peer/gtk/GdkGlyphVector.java,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:
	New class, with native part.
	* gnu/java/awt/peer/gtk/GdkGraphics2D.java,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
	implement setFont, cairoSetFont, drawGlyphVector, cairoShowGlyphs.


Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2267
diff -u -r1.2267 ChangeLog
--- ChangeLog	14 Oct 2003 17:53:39 -0000	1.2267
+++ ChangeLog	15 Oct 2003 00:26:57 -0000
@@ -1,3 +1,20 @@
+2003-10-14  Graydon Hoare  <graydon@redhat.com>
+
+	* gnu/java/awt/ClasspathToolkit.java: New abstract class.
+	* gnu/java/awt/peer/gtk/GtkToolkit.java: Inherit from
+	ClasspathToolkit.
+	* java/awt/Font.java: Delegate all methods to ClasspathFontPeer
+	* gnu/java/awt/peer/ClasspathFontPeer.java: New abstract class.
+	* gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java,
+	jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c:
+	New concrete implementation of ClasspathFontPeer, with native part.
+	* gnu/java/awt/peer/gtk/GdkGlyphVector.java,
+	jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:
+	New class, with native part.
+	* gnu/java/awt/peer/gtk/GdkGraphics2D.java,
+	jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
+	implement setFont, cairoSetFont, drawGlyphVector, cairoShowGlyphs.
+
 2003-10-14  Paolo Bonzini  <bonzini@gnu.org>
 
 	* interpret.cc (_Jv_InterpMethod::run): Don't
Index: java/awt/Font.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Font.java,v
retrieving revision 1.14
diff -u -r1.14 Font.java
--- java/awt/Font.java	13 Aug 2003 16:49:57 -0000	1.14
+++ java/awt/Font.java	15 Oct 2003 00:26:59 -0000
@@ -1,39 +1,39 @@
 /* Font.java -- Font object
    Copyright (C) 1999, 2002 Free Software Foundation, Inc.
 
-This file is part of GNU Classpath.
+   This file is part of GNU Classpath.
 
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
 
 
 package java.awt;
@@ -42,6 +42,7 @@
 import java.awt.font.GlyphVector;
 import java.awt.font.LineMetrics;
 import java.awt.font.TextAttribute;
+import java.awt.font.TransformAttribute;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
 import java.awt.peer.FontPeer;
@@ -50,52 +51,58 @@
 import java.io.Serializable;
 import java.util.Locale;
 import java.util.Map;
+import java.util.HashMap;
 import java.util.StringTokenizer;
 import java.text.CharacterIterator;
 import java.text.AttributedCharacterIterator;
+import java.text.StringCharacterIterator;
+
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.peer.ClasspathFontPeer;
 
 /**
-  * This class represents a windowing system font.
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Warren Levy <warrenl@cygnus.com>
-  */
+ * This class represents a windowing system font.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @author Graydon Hoare <graydon@redhat.com>
+ */
 public class Font implements Serializable
 {
 
-/*
- * Static Variables
- */
+  /*
+   * Static Variables
+   */
 
-/**
-  * Constant indicating a "plain" font.
-  */
-public static final int PLAIN = 0;
+  /**
+   * Constant indicating a "plain" font.
+   */
+  public static final int PLAIN = 0;
 
-/**
-  * Constant indicating a "bold" font.
-  */
-public static final int BOLD = 1;
+  /**
+   * Constant indicating a "bold" font.
+   */
+  public static final int BOLD = 1;
 
-/**
-  * Constant indicating an "italic" font.
-  */
-public static final int ITALIC = 2;
+  /**
+   * Constant indicating an "italic" font.
+   */
+  public static final int ITALIC = 2;
 
-/**
- * Constant indicating the baseline mode characteristic of Roman.
- */
-public static final int ROMAN_BASELINE = 0;
+  /**
+   * Constant indicating the baseline mode characteristic of Roman.
+   */
+  public static final int ROMAN_BASELINE = 0;
 
-/**
- * Constant indicating the baseline mode characteristic of Chinese.
- */
-public static final int CENTER_BASELINE = 1;
+  /**
+   * Constant indicating the baseline mode characteristic of Chinese.
+   */
+  public static final int CENTER_BASELINE = 1;
 
-/**
- * Constant indicating the baseline mode characteristic of Devanigri.
- */
-public static final int HANGING_BASELINE = 2;  
+  /**
+   * Constant indicating the baseline mode characteristic of Devanigri.
+   */
+  public static final int HANGING_BASELINE = 2;  
 
 
   /**
@@ -157,1108 +164,1071 @@
   public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
 
 
-// Serialization constant
-private static final long serialVersionUID = -4206021311591459213L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
-  * The name of this font
-  */
-protected String name;
-
-/**
-  * The font style, which is a combination (by summing, not OR-ing) of
-  * the font style constants in this class.
-  */
-protected int style;
-
-/**
-  * The font point size.
-  */
-protected int size;
-
-protected float pointSize;
-
-// The native peer for this font
-private FontPeer peer;
+  // Serialization constant
+  private static final long serialVersionUID = -4206021311591459213L;
+  
+    
+  // The ClasspathToolkit-provided peer which implements this font
+  private ClasspathFontPeer peer;
+  
+  /*************************************************************************/
 
-/*************************************************************************/
+  /*
+   * Static Methods
+   */
 
-/*
- * Static Methods
- */
+  /**
+   * Creates a <code>Font</code> object from the specified string, which
+   * is in one of the following formats:
+   * <p>
+   * <ul>
+   * <li>fontname-style-pointsize
+   * <li>fontname-style
+   * <li>fontname-pointsize
+   * <li>fontname
+   * </ul>
+   * <p>
+   * The style should be one of BOLD, ITALIC, or BOLDITALIC.  The default
+   * style if none is specified is PLAIN.  The default size if none
+   * is specified is 12.
+   */
+  public static Font decode (String fontspec)
+  {
+    String name = null;
+    int style = PLAIN;
+    int size = 12;
+
+    StringTokenizer st = new StringTokenizer(fontspec, "-");
+    while (st.hasMoreTokens())
+      {
+        String token = st.nextToken();
+        if (name == null)
+          {
+            name = token;
+            continue;
+          }
+
+        if (token.toUpperCase().equals("BOLD"))
+          {
+            style = BOLD;
+            continue;
+          }
+        if (token.toUpperCase().equals("ITALIC"))
+          {
+            style = ITALIC;
+            continue;
+          }
+        if (token.toUpperCase().equals("BOLDITALIC"))
+          {
+            style = BOLD | ITALIC;
+            continue;
+          }
+
+        int tokenval = 0;
+        try
+          {
+            tokenval = Integer.parseInt(token);
+          }
+        catch(NumberFormatException e) { ; }
+
+        if (tokenval != 0)
+          size = tokenval;
+      }
 
-/**
-  * Creates a <code>Font</code> object from the specified string, which
-  * is in one of the following formats:
-  * <p>
-  * <ul>
-  * <li>fontname-style-pointsize
-  * <li>fontname-style
-  * <li>fontname-pointsize
-  * <li>fontname
-  * </ul>
-  * <p>
-  * The style should be one of BOLD, ITALIC, or BOLDITALIC.  The default
-  * style if none is specified is PLAIN.  The default size if none
-  * is specified is 12.
-  */
-public static Font
-decode(String fontspec)
-{
-  String name = null;
-  int style = PLAIN;
-  int size = 12;
-
-  StringTokenizer st = new StringTokenizer(fontspec, "-");
-  while (st.hasMoreTokens())
-    {
-      String token = st.nextToken();
-      if (name == null)
-        {
-          name = token;
-          continue;
-        }
-
-      if (token.toUpperCase().equals("BOLD"))
-        {
-          style = BOLD;
-          continue;
-        }
-      if (token.toUpperCase().equals("ITALIC"))
-        {
-          style = ITALIC;
-          continue;
-        }
-      if (token.toUpperCase().equals("BOLDITALIC"))
-        {
-          style = BOLD + ITALIC;
-          continue;
-        }
-
-      int tokenval = 0;
-      try
-        {
-          tokenval = Integer.parseInt(token);
-        }
-      catch(NumberFormatException e) { ; }
-
-      if (tokenval != 0)
-        size = tokenval;
-    }
+    return getFontFromToolkit (name, attrsToMap (style, size));
+  }
 
-  return(new Font(name, style, size));
-}
+  /* These methods delegate to the toolkit. */
 
-/*************************************************************************/
+  protected static ClasspathToolkit tk ()
+  {
+    return (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
+  }
 
-/**
-  * Returns a <code>Font</code> object from the passed property name.
-  *
-  * @param propname The name of the system property.
-  * @param default Value to use if the property is not found.
-  *
-  * @return The requested font, or <code>default</code> if the property 
-  * not exist or is malformed.
-  */
-public static Font
-getFont(String propname, Font defval)
-{
-  String propval = System.getProperty(propname);
-  if (propval != null)
-    return(decode(propval));
+  protected static Map attrsToMap(int style, int size)
+  {
+    Map attrs = new HashMap();
+    attrs.put (TextAttribute.SIZE, new Float ((float)size));
+    
+    if ((style & BOLD) == BOLD)
+      attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
+    else
+      attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR);
+
+    if ((style & ITALIC) == ITALIC)
+      attrs.put (TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
+    else
+      attrs.put (TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
+    return attrs;
+  }
 
-  return(defval);
-}
+  /* Every factory method in Font should eventually call this. */
+  protected static Font getFontFromToolkit (String name, Map attribs)
+  {
+    return tk ().getFont (name, attribs);
+  }
 
-/*************************************************************************/
+  /* Every Font constructor should eventually call this. */
+  protected static ClasspathFontPeer getPeerFromToolkit (String name, Map attrs)
+  {
+    return tk ().getClasspathFontPeer (name, attrs);
+  }
 
-/**
-  * Returns a <code>Font</code> object from the passed property name.
-  *
-  * @param propname The name of the system property.
-  *
-  * @return The requested font, or <code>null</code> if the property 
-  * not exist or is malformed.
-  */
-public static Font
-getFont(String propname)
-{
-  return(getFont(propname, null));
-}
 
-/*************************************************************************/
+  /*************************************************************************/
 
-/*
- * Constructors
- */
+  /**
+   * Returns a <code>Font</code> object from the passed property name.
+   *
+   * @param propname The name of the system property.
+   * @param default Value to use if the property is not found.
+   *
+   * @return The requested font, or <code>default</code> if the property 
+   * not exist or is malformed.
+   */
+  public static Font getFont (String propname, Font defval)
+  {
+    String propval = System.getProperty (propname);
+    if (propval != null)
+      return decode (propval);
+    return defval;
+  }
 
-/**
-  * Initializes a new instance of <code>Font</code> with the specified
-  * attributes.
-  *
-  * @param name The name of the font.
-  * @param style The font style.
-  * @param size The font point size.
-  */
-public
-Font(String name, int style, int size)
-{
-  this.name = name;
-  this.style = style;
-  this.size = size;
-  this.pointSize = size;
-}
+  /*************************************************************************/
 
-public  
-Font(Map attributes)
-{
-  throw new UnsupportedOperationException();
-}
+  /**
+   * Returns a <code>Font</code> object from the passed property name.
+   *
+   * @param propname The name of the system property.
+   *
+   * @return The requested font, or <code>null</code> if the property 
+   * not exist or is malformed.
+   */
+  public static Font getFont (String propname)
+  {
+    return getFont (propname, (Font)null);
+  }
 
-/*************************************************************************/
+  /*************************************************************************/
 
-/*
- * Instance Methods
- */
+  /*
+   * Constructors
+   */
 
-/**
-  * Returns the logical name of the font.  A logical name describes a very
-  * general typographic style (such as Sans Serif). It is less specific
-  * than both a font family name (such as Helvetica) and a font face name
-  * (such as Helvetica Bold).
-  *
-  * @return The logical name of the font.
-  *
-  * @see getFamily()
-  * @see getFontName()
-  */
-public String
-getName()
-{
-  return(name);
-}
+  /**
+   * Initializes a new instance of <code>Font</code> with the specified
+   * attributes.
+   *
+   * @param name The name of the font.
+   * @param style The font style.
+   * @param size The font point size.
+   */
 
-/*************************************************************************/
+  public Font (String name, int style, int size)
+  {
+    this.peer = getPeerFromToolkit (name, attrsToMap (style, size));
+  }
 
-/**
-  * Returns the style of the font.
-  * 
-  * @return The font style.
-  */
-public int
-getSize()
-{
-  return(size);
-}
+  public Font (Map attrs)
+  {
+    this.peer = getPeerFromToolkit (null, attrs);
+  }
 
-public float
-getSize2D()
-{
-  return pointSize;
-}
+  /* This extra constructor is here to permit ClasspathToolkit and to build
+     a font with a "logical name" as well as attrs.  */
+  public Font (String name, Map attrs)
+  {
+    this.peer = getPeerFromToolkit (name, attrs);
+  }
 
-/*************************************************************************/
+  /*************************************************************************/
 
-/**
-  * Tests whether or not this is a plain font.  This will be true if
-  * and only if neither the bold nor the italics style is set.
-  *
-  * @return <code>true</code> if this is a plain font, <code>false</code>
-  * otherwise.
-  */
-public boolean
-isPlain()
-{
-  if (style == PLAIN)
-    return(true);
-  else
-    return(false);
-}
+  /*
+   * Instance Methods
+   */
 
-/*************************************************************************/
+  /**
+   * Returns the logical name of the font.  A logical name is the name the
+   * font was constructed with. It may be the name of a logical font (one
+   * of 6 required names in all java environments) or it may be a face
+   * name.
+   *
+   * @return The logical name of the font.
+   *
+   * @see getFamily()
+   * @see getFontName()
+   */
+  public String getName ()
+  {
+    return peer.getName (this);
+  }
 
-/**
-  * Tests whether or not this font is bold.
-  *
-  * @return <code>true</code> if this font is bold, <code>false</code>
-  * otherwise.
-  */
-public boolean
-isBold()
-{
-  if ((style == BOLD) || (style == (BOLD+ITALIC)))
-    return(true);
-  else
-    return(false);
-}
+  /*************************************************************************/
 
-/*************************************************************************/
+  /**
+   * Returns the style of the font.
+   * 
+   * @return The font style.
+   */
+  public int getSize ()
+  {
+    return (int) peer.getSize (this);
+  }
 
-/**
-  * Tests whether or not this font is italic.
-  *
-  * @return <code>true</code> if this font is italic, <code>false</code>
-  * otherwise.
-  */
-public boolean
-isItalic()
-{
-  if ((style == ITALIC) || (style == (BOLD+ITALIC)))
-    return(true);
-  else
-    return(false);
-}
+  public float getSize2D ()
+  {
+    return peer.getSize (this);
+  }
 
-/*************************************************************************/
+  /*************************************************************************/
 
-/**
-  * Returns the family name of this font. A family name describes a
-  * typographic style (such as Helvetica or Palatino). It is more specific
-  * than a logical font name (such as Sans Serif) but less specific than a
-  * font face name (such as Helvetica Bold).
-  *
-  * @return A string containing the font family name.
-  *
-  * @since 1.2
-  *
-  * @see getName()
-  * @see getFontName()
-  * @see GraphicsEnvironment.getAvailableFontFamilyNames()
-  */
-public String
-getFamily()
-{
-  // FIXME: How do I implement this?
-  return(name);
-}
+  /**
+   * Tests whether or not this is a plain font.  This will be true if
+   * and only if neither the bold nor the italics style is set.
+   *
+   * @return <code>true</code> if this is a plain font, <code>false</code>
+   * otherwise.
+   */
+  public boolean isPlain ()
+  {
+    return peer.isPlain (this); 
+  }
 
-/**
-  * Returns integer code representing the sum of style flags of this font, a
-  * combination of either {@link PLAIN}, {@link BOLD}, or {@link ITALIC}.
-  *
-  * @return code representing the style of this font.
-  *
-  * @see isPlain()
-  * @see isBold()
-  * @see isItalic()
-  */
-public int
-getStyle()
-{
-  return style;
-}
+  /*************************************************************************/
 
-/**
-  * Checks if specified character maps to a glyph in this font.
-  *
-  * @param c The character to check.
-  *
-  * @return Whether the character has a corresponding glyph in this font.
-  *
-  * @since 1.2
-  */
-public boolean 
-canDisplay(char c)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Tests whether or not this font is bold.
+   *
+   * @return <code>true</code> if this font is bold, <code>false</code>
+   * otherwise.
+   */
+  public boolean isBold ()
+  {
+    return peer.isBold (this);
+  }
 
-/**
-  * Checks how much of a given string can be mapped to glyphs in 
-  * this font.
-  *
-  * @param s The string to check.
-  *
-  * @return The index of the first character in <code>s</code> which cannot
-  * be converted to a glyph by this font, or <code>-1</code> if all
-  * characters can be mapped to glyphs.
-  *
-  * @since 1.2
-  */
-public int 
-canDisplayUpTo(String s)
-{
-  throw new UnsupportedOperationException ();
-}
+  /*************************************************************************/
 
-/**
-  * Checks how much of a given sequence of text can be mapped to glyphs in
-  * this font.
-  *
-  * @param text Array containing the text to check.
-  * @param start Position of first character to check in <code>text</code>.
-  * @param limit Position of last character to check in <code>text</code>.
-  *
-  * @return The index of the first character in the indicated range which
-  * cannot be converted to a glyph by this font, or <code>-1</code> if all
-  * characters can be mapped to glyphs.
-  *
-  * @since 1.2
-  *
-  * @throws IndexOutOfBoundsException if the range [start, limit] is
-  * invalid in <code>text</code>.
-  */
-public int
-canDisplayUpTo(char[] text, int start, int limit)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Tests whether or not this font is italic.
+   *
+   * @return <code>true</code> if this font is italic, <code>false</code>
+   * otherwise.
+   */
+  public boolean isItalic ()
+  {
+    return peer.isItalic (this);
+  }
 
-/**
-  * Checks how much of a given sequence of text can be mapped to glyphs in
-  * this font.
-  *
-  * @param i Iterator over the text to check.
-  * @param start Position of first character to check in <code>i</code>.
-  * @param limit Position of last character to check in <code>i</code>.
-  *
-  * @return The index of the first character in the indicated range which
-  * cannot be converted to a glyph by this font, or <code>-1</code> if all
-  * characters can be mapped to glyphs.
-  *
-  * @since 1.2
-  *
-  * @throws IndexOutOfBoundsException if the range [start, limit] is
-  * invalid in <code>i</code>.
-  */
-public int
-canDisplayUpTo(CharacterIterator i, int start, int limit)
-{
-  throw new UnsupportedOperationException ();
-}
+  /*************************************************************************/
 
-/**
-  * Creates a new font with point size 1 and {@link PLAIN} style,
-  * reading font data from the provided input stream. The resulting font
-  * can have further fonts derived from it using its
-  * <code>deriveFont</code> method.
-  *
-  * @param fontFormat Integer code indicating the format the font data is
-  * in.Currently this can only be {@link TRUETYPE_FONT}.
-  * @param is {@link InputStream} from which font data will be read. This
-  * stream is not closed after font data is extracted.
-  *
-  * @return A new {@link Font} of the format indicated.
-  *
-  * @throws IllegalArgumentException if <code>fontType</code> is not
-  * recognized.
-  * @throws FontFormatException if data in InputStream is not of format
-  * indicated.
-  * @throws IOException if insufficient data is present on InputStream.
-  *
-  * @since 1.3
-  */
-public static Font 
-createFont(int fontFormat, InputStream is) 
-  throws FontFormatException, IOException
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the family name of this font. A family name describes a design
+   * or "brand name" (such as Helvetica or Palatino). It is less specific
+   * than a font face name (such as Helvetica Bold).
+   *
+   * @return A string containing the font family name.
+   *
+   * @since 1.2
+   *
+   * @see getName()
+   * @see getFontName()
+   * @see GraphicsEnvironment.getAvailableFontFamilyNames()
+   */
+  public String getFamily ()
+  {
+    return peer.getFamily (this);
+  }
 
-/**
-  * Maps characters to glyphs in a one-to-one relationship, returning a new
-  * {@link GlyphVector} with a mapped glyph for each input character. This
-  * sort of mapping is often sufficient for some scripts such as Roman, but
-  * is inappropriate for scripts with special shaping or contextual layout
-  * requirements such as Arabic, Indic, Hebrew or Thai.
-  *
-  * @param ctx The rendering context used for precise glyph placement.
-  * @param str The string to convert to Glyphs.
-  *
-  * @return A new {@link GlyphVector} containing glyphs mapped from str,
-  * through the font's cmap table.
-  *
-  * @see layoutGlyphVector()
-  */
-public GlyphVector
-createGlyphVector(FontRenderContext ctx, String str)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns integer code representing the sum of style flags of this font, a
+   * combination of either {@link PLAIN}, {@link BOLD}, or {@link ITALIC}.
+   *
+   * @return code representing the style of this font.
+   *
+   * @see isPlain()
+   * @see isBold()
+   * @see isItalic()
+   */
+  public int getStyle ()
+  {
+    return peer.getStyle (this);
+  }
 
-/**
-  * Maps characters to glyphs in a one-to-one relationship, returning a new
-  * {@link GlyphVector} with a mapped glyph for each input character. This
-  * sort of mapping is often sufficient for some scripts such as Roman, but
-  * is inappropriate for scripts with special shaping or contextual layout
-  * requirements such as Arabic, Indic, Hebrew or Thai.
-  *
-  * @param ctx The rendering context used for precise glyph placement.
-  * @param i Iterator over the text to convert to glyphs.
-  *
-  * @return A new {@link GlyphVector} containing glyphs mapped from str,
-  * through the font's cmap table.
-  *
-  * @see layoutGlyphVector()
-  */
-public GlyphVector
-createGlyphVector(FontRenderContext ctx, CharacterIterator i)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Checks if specified character maps to a glyph in this font.
+   *
+   * @param c The character to check.
+   *
+   * @return Whether the character has a corresponding glyph in this font.
+   *
+   * @since 1.2
+   */
+  public boolean canDisplay (char c)
+  {
+    return peer.canDisplay (this, c);    
+  }
 
-/**
-  * Maps characters to glyphs in a one-to-one relationship, returning a new
-  * {@link GlyphVector} with a mapped glyph for each input character. This
-  * sort of mapping is often sufficient for some scripts such as Roman, but
-  * is inappropriate for scripts with special shaping or contextual layout
-  * requirements such as Arabic, Indic, Hebrew or Thai.
-  *
-  * @param ctx The rendering context used for precise glyph placement.
-  * @param chars Array of characters to convert to glyphs.
-  *
-  * @return A new {@link GlyphVector} containing glyphs mapped from str,
-  * through the font's cmap table.
-  *
-  * @see layoutGlyphVector()
-  */
-public GlyphVector
-createGlyphVector(FontRenderContext ctx, char[] chars)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Checks how much of a given string can be mapped to glyphs in 
+   * this font.
+   *
+   * @param s The string to check.
+   *
+   * @return The index of the first character in <code>s</code> which cannot
+   * be converted to a glyph by this font, or <code>-1</code> if all
+   * characters can be mapped to glyphs.
+   *
+   * @since 1.2
+   */
+  public int canDisplayUpTo (String s)
+  {
+    return peer.canDisplayUpTo (this, new StringCharacterIterator (s), 
+                                0, s.length () - 1);
+  }
 
-/**
-  * Extracts a sequence of glyphs from a font, returning a new {@link
-  * GlyphVector} with a mapped glyph for each input glyph code. 
-  *
-  * @param ctx The rendering context used for precise glyph placement.
-  * @param chars Array of characters to convert to glyphs.
-  *
-  * @return A new {@link GlyphVector} containing glyphs mapped from str,
-  * through the font's cmap table.
-  *
-  * @see layoutGlyphVector()
-  *
-  * @specnote This method is documented to perform character-to-glyph
-  * conversions, in the Sun documentation, but its second parameter name is
-  * "glyphCodes" and it is not clear to me why it would exist if its
-  * purpose was to transport character codes inside integers. I assume it
-  * is mis-documented in the Sun documentation.
-  */
-public GlyphVector
-createGlyphVector(FontRenderContext ctx, int[] glyphCodes)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Checks how much of a given sequence of text can be mapped to glyphs in
+   * this font.
+   *
+   * @param text Array containing the text to check.
+   * @param start Position of first character to check in <code>text</code>.
+   * @param limit Position of last character to check in <code>text</code>.
+   *
+   * @return The index of the first character in the indicated range which
+   * cannot be converted to a glyph by this font, or <code>-1</code> if all
+   * characters can be mapped to glyphs.
+   *
+   * @since 1.2
+   *
+   * @throws IndexOutOfBoundsException if the range [start, limit] is
+   * invalid in <code>text</code>.
+   */
+  public int canDisplayUpTo (char[] text, int start, int limit)
+  {
+    return peer.canDisplayUpTo 
+      (this, new StringCharacterIterator (new String (text)), start, limit);
+  }
+  
+  /**
+   * Checks how much of a given sequence of text can be mapped to glyphs in
+   * this font.
+   *
+   * @param i Iterator over the text to check.
+   * @param start Position of first character to check in <code>i</code>.
+   * @param limit Position of last character to check in <code>i</code>.
+   *
+   * @return The index of the first character in the indicated range which
+   * cannot be converted to a glyph by this font, or <code>-1</code> if all
+   * characters can be mapped to glyphs.
+   *
+   * @since 1.2
+   *
+   * @throws IndexOutOfBoundsException if the range [start, limit] is
+   * invalid in <code>i</code>.
+   */
+  public int canDisplayUpTo (CharacterIterator i, int start, int limit)
+  {
+    return peer.canDisplayUpTo (this, i, start, limit);    
+  }
 
-/**
-  * Produces a new {@link Font} based on the current font, adjusted to a
-  * new size.
-  *
-  * @param size The size of the newly created font.
-  *
-  * @return A clone of the current font, with the specified size.
-  *
-  * @since 1.2
-  */
-public Font
-deriveFont(float size)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Creates a new font with point size 1 and {@link PLAIN} style,
+   * reading font data from the provided input stream. The resulting font
+   * can have further fonts derived from it using its
+   * <code>deriveFont</code> method.
+   *
+   * @param fontFormat Integer code indicating the format the font data is
+   * in.Currently this can only be {@link TRUETYPE_FONT}.
+   * @param is {@link InputStream} from which font data will be read. This
+   * stream is not closed after font data is extracted.
+   *
+   * @return A new {@link Font} of the format indicated.
+   *
+   * @throws IllegalArgumentException if <code>fontType</code> is not
+   * recognized.
+   * @throws FontFormatException if data in InputStream is not of format
+   * indicated.
+   * @throws IOException if insufficient data is present on InputStream.
+   *
+   * @since 1.3
+   */
+  public static Font createFont (int fontFormat, InputStream is) 
+    throws FontFormatException, IOException
+  {
+    return tk().createFont (fontFormat, is);
+  }
 
-/**
-  * Produces a new {@link Font} based on the current font, adjusted to a
-  * new style.
-  *
-  * @param style The style of the newly created font.
-  *
-  * @return A clone of the current font, with the specified style.
-  *
-  * @since 1.2
-  */
-public Font
-deriveFont(int style)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Maps characters to glyphs in a one-to-one relationship, returning a new
+   * {@link GlyphVector} with a mapped glyph for each input character. This
+   * sort of mapping is often sufficient for some scripts such as Roman, but
+   * is inappropriate for scripts with special shaping or contextual layout
+   * requirements such as Arabic, Indic, Hebrew or Thai.
+   *
+   * @param ctx The rendering context used for precise glyph placement.
+   * @param str The string to convert to Glyphs.
+   *
+   * @return A new {@link GlyphVector} containing glyphs mapped from str,
+   * through the font's cmap table.
+   *
+   * @see layoutGlyphVector()
+   */
+  public GlyphVector createGlyphVector (FontRenderContext ctx, String str)
+  {
+    return peer.createGlyphVector (this, ctx, new StringCharacterIterator (str));
+  }
 
-/**
-  * Produces a new {@link Font} based on the current font, adjusted to a
-  * new style and subjected to a new affine transformation.
-  *
-  * @param style The style of the newly created font.
-  * @param a The transformation to apply.
-  *
-  * @return A clone of the current font, with the specified style and
-  * transform.
-  *
-  * @throws IllegalArgumentException If transformation is
-  * <code>null</code>.
-  *
-  * @since 1.2
-  */
-public Font
-deriveFont(int style, AffineTransform a)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Maps characters to glyphs in a one-to-one relationship, returning a new
+   * {@link GlyphVector} with a mapped glyph for each input character. This
+   * sort of mapping is often sufficient for some scripts such as Roman, but
+   * is inappropriate for scripts with special shaping or contextual layout
+   * requirements such as Arabic, Indic, Hebrew or Thai.
+   *
+   * @param ctx The rendering context used for precise glyph placement.
+   * @param i Iterator over the text to convert to glyphs.
+   *
+   * @return A new {@link GlyphVector} containing glyphs mapped from str,
+   * through the font's cmap table.
+   *
+   * @see layoutGlyphVector()
+   */
+  public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i)
+  {
+    return peer.createGlyphVector (this, ctx, i);
+  }
 
-/**
-  * Produces a new {@link Font} based on the current font, adjusted to a
-  * new set of attributes.
-  *
-  * @param attributes Attributes of the newly created font.
-  *
-  * @return A clone of the current font, with the specified attributes.
-  *
-  * @since 1.2
-  */
-public Font
-deriveFont(Map attributes)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Maps characters to glyphs in a one-to-one relationship, returning a new
+   * {@link GlyphVector} with a mapped glyph for each input character. This
+   * sort of mapping is often sufficient for some scripts such as Roman, but
+   * is inappropriate for scripts with special shaping or contextual layout
+   * requirements such as Arabic, Indic, Hebrew or Thai.
+   *
+   * @param ctx The rendering context used for precise glyph placement.
+   * @param chars Array of characters to convert to glyphs.
+   *
+   * @return A new {@link GlyphVector} containing glyphs mapped from str,
+   * through the font's cmap table.
+   *
+   * @see layoutGlyphVector()
+   */
+  public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars)
+  {
+    return peer.createGlyphVector 
+      (this, ctx, new StringCharacterIterator (new String (chars)));
+  }
 
-/**
-  * Returns a map of chracter attributes which this font currently has set.
-  *
-  * @return A map of chracter attributes which this font currently has set.
-  *
-  * @see getAvailableAttributes()
-  * @see java.text.AttributedCharacterIterator.Attribute
-  * @see java.awt.font.TextAttribute
-  */
-public Map
-getAttributes()
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Extracts a sequence of glyphs from a font, returning a new {@link
+   * GlyphVector} with a mapped glyph for each input glyph code. 
+   *
+   * @param ctx The rendering context used for precise glyph placement.
+   * @param chars Array of characters to convert to glyphs.
+   *
+   * @return A new {@link GlyphVector} containing glyphs mapped from str,
+   * through the font's cmap table.
+   *
+   * @see layoutGlyphVector()
+   *
+   * @specnote This method is documented to perform character-to-glyph
+   * conversions, in the Sun documentation, but its second parameter name is
+   * "glyphCodes" and it is not clear to me why it would exist if its
+   * purpose was to transport character codes inside integers. I assume it
+   * is mis-documented in the Sun documentation.
+   */
 
-/**
-  * Returns an array of chracter attribute keys which this font understands. 
-  *
-  * @return An array of chracter attribute keys which this font understands.
-  *
-  * @see getAttributes()
-  * @see java.text.AttributedCharacterIterator.Attribute
-  * @see java.awt.font.TextAttribute
-  */
-public AttributedCharacterIterator.Attribute[]
-getAvailableAttributes()
-{
-  throw new UnsupportedOperationException ();
-}
+  public GlyphVector createGlyphVector (FontRenderContext ctx, int[] glyphCodes)
+  {
+    return peer.createGlyphVector (this, ctx, glyphCodes);
+  }
 
-/**
-  * Returns a baseline code (one of {@link ROMAN_BASELINE}, {@link
-  * CENTER_BASELINE} or {@link HANGING_BASELINE}) indicating which baseline
-  * this font will measure baseline offsets for, when presenting glyph
-  * metrics for a given character.
-  *
-  * Baseline offsets describe the position of a glyph relative to an
-  * invisible line drawn under, through the center of, or over a line of
-  * rendered text, respectively. Different scripts use different baseline
-  * modes, so clients should not assume all baseline offsets in a glyph
-  * vector are from a common baseline.
-  *
-  * @param c The character code to select a baseline mode for.
-  *
-  * @return The baseline mode which would be used in a glyph associated
-  * with the provided character.
-  *
-  * @since 1.2
-  *
-  * @see LineMetrics.getBaselineOffsets()
-  */
-public byte 
-getBaselineFor(char c)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Produces a new {@link Font} based on the current font, adjusted to a
+   * new size.
+   *
+   * @param size The size of the newly created font.
+   *
+   * @return A clone of the current font, with the specified size.
+   *
+   * @since 1.2
+   */
+  public Font deriveFont (float size)
+  {
+    return peer.deriveFont (this, size);
+  }
 
-/**
-  * Returns the family name of this font. A family name describes a
-  * typographic style (such as Helvetica or Palatino). It is more specific
-  * than a logical font name (such as Sans Serif) but less specific than a
-  * font face name (such as Helvetica Bold).
-  *
-  * @param lc The locale in which to describe the name of the font family.
-  *
-  * @return A string containing the font family name, localized for the
-  * provided locale.
-  *
-  * @since 1.2
-  *
-  * @see getName()
-  * @see getFontName()
-  * @see GraphicsEnvironment.getAvailableFontFamilyNames()
-  * @see Locale
-  */
-public String
-getFamily(Locale lc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Produces a new {@link Font} based on the current font, adjusted to a
+   * new style.
+   *
+   * @param style The style of the newly created font.
+   *
+   * @return A clone of the current font, with the specified style.
+   *
+   * @since 1.2
+   */
+  public Font deriveFont (int style)
+  {
+    return peer.deriveFont (this, style);
+  }
 
-/**
-  * Returns a font appropriate for the given attribute set.
-  *
-  * @param attributes The attributes required for the new font.
-  *
-  * @return A new Font with the given attributes.
-  *
-  * @since 1.2
-  *
-  * @see TextAttribure  
-  */
-public static Font
-getFont(Map attributes)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Produces a new {@link Font} based on the current font, adjusted to a
+   * new style and subjected to a new affine transformation.
+   *
+   * @param style The style of the newly created font.
+   * @param a The transformation to apply.
+   *
+   * @return A clone of the current font, with the specified style and
+   * transform.
+   *
+   * @throws IllegalArgumentException If transformation is
+   * <code>null</code>.
+   *
+   * @since 1.2
+   */
+  public Font deriveFont (int style, AffineTransform a)
+  {
+    if (a == null)
+      throw new IllegalArgumentException ("Affine transformation is null");
 
-/**
-  * Returns the font face name of the font.  A font face name describes a
-  * specific variant of a font family (such as Helvetica Bold). It is more
-  * specific than both a font family name (such as Helvetica) and a logical
-  * font name (such as Sans Serif).
-  *
-  * @return The font face name of the font.
-  *
-  * @since 1.2
-  *
-  * @see getName()
-  * @see getFamily()
-  */
-public String
-getFontName()
-{
-  throw new UnsupportedOperationException ();
-}
+    return peer.deriveFont (this, style, a);
+  }
 
-/**
-  * Returns the font face name of the font.  A font face name describes a
-  * specific variant of a font family (such as Helvetica Bold). It is more
-  * specific than both a font family name (such as Helvetica) and a logical
-  * font name (such as Sans Serif).
-  *
-  * @param lc The locale in which to describe the name of the font face.
-  *
-  * @return A string containing the font face name, localized for the
-  * provided locale.
-  *
-  * @since 1.2
-  *
-  * @see getName()
-  * @see getFamily()
-  */
-public String
-getFontName(Locale lc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Produces a new {@link Font} based on the current font, adjusted to a
+   * new set of attributes.
+   *
+   * @param attributes Attributes of the newly created font.
+   *
+   * @return A clone of the current font, with the specified attributes.
+   *
+   * @since 1.2
+   */
+  public Font deriveFont (Map attributes)
+  {
+    return peer.deriveFont (this, attributes);
+  }
 
-/**
-  * Returns the italic angle of this font, a measurement of its slant when
-  * style is {@link ITALIC}. The precise meaning is the inverse slope of a
-  * caret line which "best measures" the font's italic posture.
-  *
-  * @return The italic angle.
-  *
-  * @see TextAttribute.POSTURE
-  */
-public float
-getItalicAngle()
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns a map of chracter attributes which this font currently has set.
+   *
+   * @return A map of chracter attributes which this font currently has set.
+   *
+   * @see getAvailableAttributes()
+   * @see java.text.AttributedCharacterIterator.Attribute
+   * @see java.awt.font.TextAttribute
+   */
+  public Map getAttributes ()
+  {
+    return peer.getAttributes (this);
+  }
 
-/**
-  * Returns a {@link LineMetrics} object constructed with the specified
-  * text and {@link FontRenderContext}. 
-  *
-  * @param text The string to calculate metrics from.
-  * @param begin Index of first character in <code>text</code> to measure.
-  * @param limit Index of last character in <code>text</code> to measure.
-  * @param rc Context for calculating precise glyph placement and hints.
-  *
-  * @return A new {@link LineMetrics} object.
-  *
-  * @throws IndexOutOfBoundsException if the range [begin, limit] is
-  * invalid in <code>text</code>.
-  */
-public LineMetrics
-getLineMetrics(String text, int begin, int limit, FontRenderContext rc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns an array of chracter attribute keys which this font understands. 
+   *
+   * @return An array of chracter attribute keys which this font understands.
+   *
+   * @see getAttributes()
+   * @see java.text.AttributedCharacterIterator.Attribute
+   * @see java.awt.font.TextAttribute
+   */
+  public AttributedCharacterIterator.Attribute[] getAvailableAttributes()
+  {
+    return peer.getAvailableAttributes (this);
+  }
 
-/**
-  * Returns a {@link LineMetrics} object constructed with the specified
-  * text and {@link FontRenderContext}. 
-  *
-  * @param chars The string to calculate metrics from.
-  * @param begin Index of first character in <code>text</code> to measure.
-  * @param limit Index of last character in <code>text</code> to measure.
-  * @param rc Context for calculating precise glyph placement and hints.
-  *
-  * @return A new {@link LineMetrics} object.
-  *
-  * @throws IndexOutOfBoundsException if the range [begin, limit] is
-  * invalid in <code>chars</code>.
-  */
-public LineMetrics
-getLineMetrics(char[] chars, int begin, int limit, FontRenderContext rc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns a baseline code (one of {@link ROMAN_BASELINE}, {@link
+   * CENTER_BASELINE} or {@link HANGING_BASELINE}) indicating which baseline
+   * this font will measure baseline offsets for, when presenting glyph
+   * metrics for a given character.
+   *
+   * Baseline offsets describe the position of a glyph relative to an
+   * invisible line drawn under, through the center of, or over a line of
+   * rendered text, respectively. Different scripts use different baseline
+   * modes, so clients should not assume all baseline offsets in a glyph
+   * vector are from a common baseline.
+   *
+   * @param c The character code to select a baseline mode for.
+   *
+   * @return The baseline mode which would be used in a glyph associated
+   * with the provided character.
+   *
+   * @since 1.2
+   *
+   * @see LineMetrics.getBaselineOffsets()
+   */
+  public byte getBaselineFor (char c)
+  {
+    return peer.getBaselineFor (this, c);
+  }
 
-/**
-  * Returns a {@link LineMetrics} object constructed with the specified
-  * text and {@link FontRenderContext}. 
-  *
-  * @param ci The string to calculate metrics from.
-  * @param begin Index of first character in <code>text</code> to measure.
-  * @param limit Index of last character in <code>text</code> to measure.
-  * @param rc Context for calculating precise glyph placement and hints.
-  *
-  * @return A new {@link LineMetrics} object.
-  *
-  * @throws IndexOutOfBoundsException if the range [begin, limit] is
-  * invalid in <code>ci</code>.
-  */
-public LineMetrics
-getLineMetrics(CharacterIterator ci, int begin, int limit, FontRenderContext rc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the family name of this font. A family name describes a
+   * typographic style (such as Helvetica or Palatino). It is more specific
+   * than a logical font name (such as Sans Serif) but less specific than a
+   * font face name (such as Helvetica Bold).
+   *
+   * @param lc The locale in which to describe the name of the font family.
+   *
+   * @return A string containing the font family name, localized for the
+   * provided locale.
+   *
+   * @since 1.2
+   *
+   * @see getName()
+   * @see getFontName()
+   * @see GraphicsEnvironment.getAvailableFontFamilyNames()
+   * @see Locale
+   */
+  public String getFamily (Locale lc)
+  {
+    return peer.getFamily (this, lc); 
+  }
 
-/**
-  * Returns the maximal bounding box of all the bounding boxes in this
-  * font, when the font's bounding boxes are evaluated in a given {@link
-  * FontRenderContext}
-  *
-  * @param rc Context in which to evaluate bounding boxes.
-  *
-  * @return The maximal bounding box.
-  */
-public Rectangle2D
-getMaxCharBounds(FontRenderContext rc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns a font appropriate for the given attribute set.
+   *
+   * @param attributes The attributes required for the new font.
+   *
+   * @return A new Font with the given attributes.
+   *
+   * @since 1.2
+   *
+   * @see TextAttribure  
+   */
+  public static Font getFont (Map attributes)
+  {
+    return getFontFromToolkit (null, attributes);
+  }
 
-/**
-  * Returns the glyph code this font uses to represent missing glyphs. This
-  * code will be present in glyph vectors when the font was unable to
-  * locate a glyph to represent a particular character code.
-  *
-  * @return The missing glyph code.
-  *
-  * @since 1.2
-  */
-public int
-getMissingGlyphCode()
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the font face name of the font.  A font face name describes a
+   * specific variant of a font family (such as Helvetica Bold). It is more
+   * specific than both a font family name (such as Helvetica) and a logical
+   * font name (such as Sans Serif).
+   *
+   * @return The font face name of the font.
+   *
+   * @since 1.2
+   *
+   * @see getName()
+   * @see getFamily()
+   */
+  public String getFontName ()
+  {
+    return peer.getFontName (this);
+  }
 
-/**
-  * Returns the overall number of glyphs in this font. This number is one
-  * more than the greatest glyph code used in any glyph vectors this font
-  * produces. In other words, glyph codes are taken from the range
-  * <code>[ 0, getNumGlyphs() - 1 ]</code>.
-  *
-  * @return The number of glyphs in this font.
-  * 
-  * @since 1.2
-  */
-public int
-getNumGlyphs()
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the font face name of the font.  A font face name describes a
+   * specific variant of a font family (such as Helvetica Bold). It is more
+   * specific than both a font family name (such as Helvetica).
+   *
+   * @param lc The locale in which to describe the name of the font face.
+   *
+   * @return A string containing the font face name, localized for the
+   * provided locale.
+   *
+   * @since 1.2
+   *
+   * @see getName()
+   * @see getFamily()
+   */
+  public String getFontName (Locale lc)
+  {
+    return peer.getFontName (this, lc);
+  }
 
-/**
-  * Returns the PostScript Name of this font.   
-  *
-  * @return The PostScript Name of this font.
-  *
-  * @since 1.2
-  *
-  * @see getName()
-  * @see getFamily()
-  * @see getFontName()
-  */
-public String
-getPSName()
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the italic angle of this font, a measurement of its slant when
+   * style is {@link ITALIC}. The precise meaning is the inverse slope of a
+   * caret line which "best measures" the font's italic posture.
+   *
+   * @return The italic angle.
+   *
+   * @see TextAttribute.POSTURE
+   */
+  public float getItalicAngle ()
+  {
+    return peer.getItalicAngle (this);
+  }
 
-/**
-  * Returns the logical bounds of the specified string when rendered with this
-  * font in the specified {@link FontRenderContext}. This box will include the
-  * glyph origin, ascent, advance, height, and leading, but may not include all
-  * diacritics or accents. To get the complete visual bounding box of all the
-  * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
-  * {@link TextLayout}.
-  *
-  * @param str The string to measure.
-  * @param frc The context in which to make the precise glyph measurements.
-  * 
-  * @return A bounding box covering the logical bounds of the specified text.
-  *
-  * @see createGlyphVector()
-  */
-public Rectangle2D
-getStringBounds(String str, FontRenderContext frc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns a {@link LineMetrics} object constructed with the specified
+   * text and {@link FontRenderContext}. 
+   *
+   * @param text The string to calculate metrics from.
+   * @param begin Index of first character in <code>text</code> to measure.
+   * @param limit Index of last character in <code>text</code> to measure.
+   * @param rc Context for calculating precise glyph placement and hints.
+   *
+   * @return A new {@link LineMetrics} object.
+   *
+   * @throws IndexOutOfBoundsException if the range [begin, limit] is
+   * invalid in <code>text</code>.
+   */
+  public LineMetrics getLineMetrics(String text, int begin, 
+                                    int limit, FontRenderContext rc)
+  {
+    return peer.getLineMetrics (this, new StringCharacterIterator (text), 
+                                begin, limit, rc);
+  }
 
-/**
-  * Returns the logical bounds of the specified string when rendered with this
-  * font in the specified {@link FontRenderContext}. This box will include the
-  * glyph origin, ascent, advance, height, and leading, but may not include all
-  * diacritics or accents. To get the complete visual bounding box of all the
-  * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
-  * {@link TextLayout}.
-  *
-  * @param str The string to measure.
-  * @param begin Index of the first character in <code>str</code> to measure.
-  * @param limit Index of the last character in <code>str</code> to measure.
-  * @param frc The context in which to make the precise glyph measurements.
-  * 
-  * @return A bounding box covering the logical bounds of the specified text.
-  *
-  * @throws IndexOutOfBoundsException if the range [begin, limit] is
-  * invalid in <code>str</code>.
-  *
-  * @since 1.2
-  *
-  * @see createGlyphVector()
-  */
-public Rectangle2D
-getStringBounds(String str, int begin, int limit, FontRenderContext frc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns a {@link LineMetrics} object constructed with the specified
+   * text and {@link FontRenderContext}. 
+   *
+   * @param chars The string to calculate metrics from.
+   * @param begin Index of first character in <code>text</code> to measure.
+   * @param limit Index of last character in <code>text</code> to measure.
+   * @param rc Context for calculating precise glyph placement and hints.
+   *
+   * @return A new {@link LineMetrics} object.
+   *
+   * @throws IndexOutOfBoundsException if the range [begin, limit] is
+   * invalid in <code>chars</code>.
+   */
+  public LineMetrics getLineMetrics(char[] chars, int begin, 
+                                    int limit, FontRenderContext rc)
+  {
+    return peer.getLineMetrics (this, new StringCharacterIterator (new String(chars)), 
+                                begin, limit, rc);
+  }
 
-/**
-  * Returns the logical bounds of the specified string when rendered with this
-  * font in the specified {@link FontRenderContext}. This box will include the
-  * glyph origin, ascent, advance, height, and leading, but may not include all
-  * diacritics or accents. To get the complete visual bounding box of all the
-  * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
-  * {@link TextLayout}.
-  *
-  * @param ci The text to measure.
-  * @param begin Index of the first character in <code>ci</code> to measure.
-  * @param limit Index of the last character in <code>ci</code> to measure.
-  * @param frc The context in which to make the precise glyph measurements.
-  * 
-  * @return A bounding box covering the logical bounds of the specified text.
-  *
-  * @throws IndexOutOfBoundsException if the range [begin, limit] is
-  * invalid in <code>ci</code>.
-  *
-  * @since 1.2
-  *
-  * @see createGlyphVector()
-  */
-public Rectangle2D
-getStringBounds(CharacterIterator ci, int begin, int limit, FontRenderContext frc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns a {@link LineMetrics} object constructed with the specified
+   * text and {@link FontRenderContext}. 
+   *
+   * @param ci The string to calculate metrics from.
+   * @param begin Index of first character in <code>text</code> to measure.
+   * @param limit Index of last character in <code>text</code> to measure.
+   * @param rc Context for calculating precise glyph placement and hints.
+   *
+   * @return A new {@link LineMetrics} object.
+   *
+   * @throws IndexOutOfBoundsException if the range [begin, limit] is
+   * invalid in <code>ci</code>.
+   */
+  public LineMetrics getLineMetrics (CharacterIterator ci, int begin, 
+                                     int limit, FontRenderContext rc)
+  {
+    return peer.getLineMetrics (this, ci, begin, limit, rc);
+  }
 
-/**
-  * Returns the logical bounds of the specified string when rendered with this
-  * font in the specified {@link FontRenderContext}. This box will include the
-  * glyph origin, ascent, advance, height, and leading, but may not include all
-  * diacritics or accents. To get the complete visual bounding box of all the
-  * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
-  * {@link TextLayout}.
-  *
-  * @param chars The text to measure.
-  * @param begin Index of the first character in <code>ci</code> to measure.
-  * @param limit Index of the last character in <code>ci</code> to measure.
-  * @param frc The context in which to make the precise glyph measurements.
-  * 
-  * @return A bounding box covering the logical bounds of the specified text.
-  *
-  * @throws IndexOutOfBoundsException if the range [begin, limit] is
-  * invalid in <code>chars</code>.
-  *
-  * @since 1.2
-  *
-  * @see createGlyphVector()
-  */
-public Rectangle2D
-getStringBounds(char[] chars, int begin, int limit, FontRenderContext frc)
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the maximal bounding box of all the bounding boxes in this
+   * font, when the font's bounding boxes are evaluated in a given {@link
+   * FontRenderContext}
+   *
+   * @param rc Context in which to evaluate bounding boxes.
+   *
+   * @return The maximal bounding box.
+   */
+  public Rectangle2D getMaxCharBounds (FontRenderContext rc)
+  {
+    return peer.getMaxCharBounds (this, rc);
+  }
 
-/**
-  * Returns a copy of the affine transformation this font is currently
-  * subject to, if any.
-  *
-  * @return The current transformation.
- */
-public AffineTransform
-getTransform()
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the glyph code this font uses to represent missing glyphs. This
+   * code will be present in glyph vectors when the font was unable to
+   * locate a glyph to represent a particular character code.
+   *
+   * @return The missing glyph code.
+   *
+   * @since 1.2
+   */
+  public int getMissingGlyphCode ()
+  {
+    return peer.getMissingGlyphCode (this);
+  }
 
-/**
-  * Indicates whether this font's line metrics are uniform. A font may be
-  * composed of several "subfonts", each covering a different code range,
-  * and each with their own line metrics. A font with no subfonts, or
-  * subfonts with identical line metrics, is said to have "uniform" line
-  * metrics.
-  *
-  * @return Whether this font has uniform line metrics.
-  *
-  * @see LineMetrics
-  * @see getLineMetrics()
-  */
-public boolean
-hasUniformLineMetrics()
-{
-  throw new UnsupportedOperationException ();
-}
+  /**
+   * Returns the overall number of glyphs in this font. This number is one
+   * more than the greatest glyph code used in any glyph vectors this font
+   * produces. In other words, glyph codes are taken from the range
+   * <code>[ 0, getNumGlyphs() - 1 ]</code>.
+   *
+   * @return The number of glyphs in this font.
+   * 
+   * @since 1.2
+   */
+  public int getNumGlyphs ()
+  {
+    return peer.getMissingGlyphCode (this);
+  }
 
-/**
-  * Indicates whether this font is subject to a non-identity affine
-  * transformation.
-  *
-  * @return <code>true</code> iff the font has a non-identity affine
-  * transformation applied to it.
-  */
-public boolean
-isTransformed()
-{
-  throw new UnsupportedOperationException ();  
-}
+  /**
+   * Returns the PostScript Name of this font.   
+   *
+   * @return The PostScript Name of this font.
+   *
+   * @since 1.2
+   *
+   * @see getName()
+   * @see getFamily()
+   * @see getFontName()
+   */
+  public String getPSName ()
+  {
+    return peer.getPostScriptName (this);
+  }
 
-/**
-  * Produces a glyph vector representing a full layout fo the specified
-  * text in this font. Full layouts may include complex shaping and
-  * reordering operations, for scripts such as Arabic or Hindi.
-  *
-  * Bidirectional (bidi) layout is not performed in this method; text
-  * should have its bidi direction specified with one of the flags {@link
-  * LAYOUT_LEFT_TO_RIGHT} or {@link LAYOUT_RIGHT_TO_LEFT}.
-  *
-  * Some types of layout (notably Arabic glyph shaping) may examine context
-  * characters beyond the bounds of the indicated range, in order to select
-  * an appropriate shape. The flags {@link LAYOUT_NO_START_CONTEXT} and
-  * {@link LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra
-  * context areas from being examined, for instance if they contain invalid
-  * characters.
-  *
-  * @param frc Context in which to perform the layout.
-  * @param chars Text to perform layout on.
-  * @param start Index of first character to perform layout on.
-  * @param limit Index of last character to perform layout on.
-  * @param flags Combination of flags controlling layout.
-  *
-  * @return A new {@link GlyphVector} representing the specified text.
-  *
-  * @throws IndexOutOfBoundsException if the range [begin, limit] is
-  * invalid in <code>chars</code>. 
-  */
-public GlyphVector
-layoutGlyphVector(FontRenderContext frc, char[] chars, int start, int limit, int flags)
-{
-  throw new UnsupportedOperationException ();  
-}
+  /**
+   * Returns the logical bounds of the specified string when rendered with this
+   * font in the specified {@link FontRenderContext}. This box will include the
+   * glyph origin, ascent, advance, height, and leading, but may not include all
+   * diacritics or accents. To get the complete visual bounding box of all the
+   * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+   * {@link TextLayout}.
+   *
+   * @param str The string to measure.
+   * @param frc The context in which to make the precise glyph measurements.
+   * 
+   * @return A bounding box covering the logical bounds of the specified text.
+   *
+   * @see createGlyphVector()
+   */
+  public Rectangle2D getStringBounds (String str, FontRenderContext frc)
+  {
+    return getStringBounds (str, 0, str.length () - 1, frc);
+  }
 
+  /**
+   * Returns the logical bounds of the specified string when rendered with this
+   * font in the specified {@link FontRenderContext}. This box will include the
+   * glyph origin, ascent, advance, height, and leading, but may not include all
+   * diacritics or accents. To get the complete visual bounding box of all the
+   * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+   * {@link TextLayout}.
+   *
+   * @param str The string to measure.
+   * @param begin Index of the first character in <code>str</code> to measure.
+   * @param limit Index of the last character in <code>str</code> to measure.
+   * @param frc The context in which to make the precise glyph measurements.
+   * 
+   * @return A bounding box covering the logical bounds of the specified text.
+   *
+   * @throws IndexOutOfBoundsException if the range [begin, limit] is
+   * invalid in <code>str</code>.
+   *
+   * @since 1.2
+   *
+   * @see createGlyphVector()
+   */
+  public Rectangle2D getStringBounds (String str, int begin, 
+                                      int limit, FontRenderContext frc)
+  {
+    return peer.getStringBounds (this, new StringCharacterIterator(str), begin, limit, frc);
+  }
 
-/*************************************************************************/
+  /**
+   * Returns the logical bounds of the specified string when rendered with this
+   * font in the specified {@link FontRenderContext}. This box will include the
+   * glyph origin, ascent, advance, height, and leading, but may not include all
+   * diacritics or accents. To get the complete visual bounding box of all the
+   * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+   * {@link TextLayout}.
+   *
+   * @param ci The text to measure.
+   * @param begin Index of the first character in <code>ci</code> to measure.
+   * @param limit Index of the last character in <code>ci</code> to measure.
+   * @param frc The context in which to make the precise glyph measurements.
+   * 
+   * @return A bounding box covering the logical bounds of the specified text.
+   *
+   * @throws IndexOutOfBoundsException if the range [begin, limit] is
+   * invalid in <code>ci</code>.
+   *
+   * @since 1.2
+   *
+   * @see createGlyphVector()
+   */
+  public Rectangle2D getStringBounds (CharacterIterator ci, int begin, 
+                                      int limit, FontRenderContext frc)
+  {
+    return peer.getStringBounds (this, ci, begin, limit, frc);
+  }
 
-/**
-  * Returns a native peer object for this font.
-  *
-  * @return A native peer object for this font.
-  *
-  * @deprecated
-  */
-public FontPeer
-getPeer()
-{
-  if (peer != null)
-    return(peer);
+  /**
+   * Returns the logical bounds of the specified string when rendered with this
+   * font in the specified {@link FontRenderContext}. This box will include the
+   * glyph origin, ascent, advance, height, and leading, but may not include all
+   * diacritics or accents. To get the complete visual bounding box of all the
+   * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+   * {@link TextLayout}.
+   *
+   * @param chars The text to measure.
+   * @param begin Index of the first character in <code>ci</code> to measure.
+   * @param limit Index of the last character in <code>ci</code> to measure.
+   * @param frc The context in which to make the precise glyph measurements.
+   * 
+   * @return A bounding box covering the logical bounds of the specified text.
+   *
+   * @throws IndexOutOfBoundsException if the range [begin, limit] is
+   * invalid in <code>chars</code>.
+   *
+   * @since 1.2
+   *
+   * @see createGlyphVector()
+   */
+  public Rectangle2D getStringBounds (char[] chars, int begin, 
+                                      int limit, FontRenderContext frc)
+  {
+    return peer.getStringBounds (this, new StringCharacterIterator (new String (chars)), 
+                                 begin, limit, frc);
+  }
 
-  peer = Toolkit.getDefaultToolkit().getFontPeer(name, style);
-  return(peer);
-}
+  /**
+   * Returns a copy of the affine transformation this font is currently
+   * subject to, if any.
+   *
+   * @return The current transformation.
+   */
+  public AffineTransform getTransform ()
+  {
+    return peer.getTransform (this);
+  }
 
-/*************************************************************************/
+  /**
+   * Indicates whether this font's line metrics are uniform. A font may be
+   * composed of several "subfonts", each covering a different code range,
+   * and each with their own line metrics. A font with no subfonts, or
+   * subfonts with identical line metrics, is said to have "uniform" line
+   * metrics.
+   *
+   * @return Whether this font has uniform line metrics.
+   *
+   * @see LineMetrics
+   * @see getLineMetrics()
+   */
+  public boolean hasUniformLineMetrics ()
+  {
+    return peer.hasUniformLineMetrics (this);
+  }
 
-/**
-  * Returns a hash value for this font.
-  * 
-  * @return A hash for this font.
-  */
-public int
-hashCode()
-{
-  return((new String(name + size + style)).hashCode());
-}
+  /**
+   * Indicates whether this font is subject to a non-identity affine
+   * transformation.
+   *
+   * @return <code>true</code> iff the font has a non-identity affine
+   * transformation applied to it.
+   */
+  public boolean isTransformed ()
+  {
+    return peer.isTransformed (this);
+  }
 
-/*************************************************************************/
+  /**
+   * Produces a glyph vector representing a full layout fo the specified
+   * text in this font. Full layouts may include complex shaping and
+   * reordering operations, for scripts such as Arabic or Hindi.
+   *
+   * Bidirectional (bidi) layout is not performed in this method; text
+   * should have its bidi direction specified with one of the flags {@link
+   * LAYOUT_LEFT_TO_RIGHT} or {@link LAYOUT_RIGHT_TO_LEFT}.
+   *
+   * Some types of layout (notably Arabic glyph shaping) may examine context
+   * characters beyond the bounds of the indicated range, in order to select
+   * an appropriate shape. The flags {@link LAYOUT_NO_START_CONTEXT} and
+   * {@link LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra
+   * context areas from being examined, for instance if they contain invalid
+   * characters.
+   *
+   * @param frc Context in which to perform the layout.
+   * @param chars Text to perform layout on.
+   * @param start Index of first character to perform layout on.
+   * @param limit Index of last character to perform layout on.
+   * @param flags Combination of flags controlling layout.
+   *
+   * @return A new {@link GlyphVector} representing the specified text.
+   *
+   * @throws IndexOutOfBoundsException if the range [begin, limit] is
+   * invalid in <code>chars</code>. 
+   */
+  public GlyphVector layoutGlyphVector (FontRenderContext frc, 
+                                        char[] chars, int start, 
+                                        int limit, int flags)
+  {
+    return peer.layoutGlyphVector (this, frc, chars, start, limit, flags);
+  }
 
-/**
-  * Tests whether or not the specified object is equal to this font.  This
-  * will be true if and only if:
-  * <P>
-  * <ul>
-  * <li>The object is not <code>null</code>.
-  * <li>The object is an instance of <code>Font</code>.
-  * <li>The object has the same name, style, and size as this object.
-  * </ul>
-  *
-  * @return <code>true</code> if the specified object is equal to this
-  * object, <code>false</code> otherwise.
-  */
-public boolean
-equals(Object obj)
-{
-  if (obj == null)
-    return(false);
 
-  if (!(obj instanceof Font))
-    return(false);
+  /**
+   * Returns a native peer object for this font.
+   *
+   * @return A native peer object for this font.
+   *
+   * @deprecated
+   */
+  public FontPeer getPeer ()
+  {
+    return peer;
+  }
 
-  Font f = (Font)obj;
 
-  if (!f.name.equals(name))
-    return(false);
+  /**
+   * Returns a hash value for this font.
+   * 
+   * @return A hash for this font.
+   */
+  public int hashCode()
+  {
+    return this.toString().hashCode();
+  }
 
-  if (f.size != size)
-    return(false);
 
-  if (f.style != style)
-    return(false);
+  /**
+   * Tests whether or not the specified object is equal to this font.  This
+   * will be true if and only if:
+   * <P>
+   * <ul>
+   * <li>The object is not <code>null</code>.
+   * <li>The object is an instance of <code>Font</code>.
+   * <li>The object has the same names, style, size, and transform as this object.
+   * </ul>
+   *
+   * @return <code>true</code> if the specified object is equal to this
+   * object, <code>false</code> otherwise.
+   */
+  public boolean equals (Object obj)
+  {
+    if (obj == null)
+      return false;
 
-  return(true);
-} 
+    if (!(obj instanceof Font))
+      return false;
 
-/*************************************************************************/
+    Font f = (Font)obj;
+    
+    return (f.getName ().equals (this.getName ()) &&
+            f.getFamily ().equals (this.getFamily ()) &&
+            f.getFontName ().equals (this.getFontName ()) &&
+            f.getTransform ().equals (this.getTransform ()) &&
+            f.getSize() == this.getSize() &&
+            f.getStyle() == this.getStyle());
+  } 
+  
 
-/**
-  * Returns a string representation of this font.
-  *
-  * @return A string representation of this font.
-  */
-public String
-toString()
-{
-  return(getClass().getName() + "(name=" + name + ",style=" + style +
-         ",size=" + size + ")");
-}
+  /**
+   * Returns a string representation of this font.
+   *
+   * @return A string representation of this font.
+   */
+  public String toString ()
+  {
+    return(getClass().getName() 
+           + "(logical=" + getName () 
+           + ",family=" + getFamily ()
+           + ",face=" + getFontName ()
+           + ",style=" + getStyle ()
+           + ",size=" + getSize ()
+           + ",transform=" + getTransform () + ")");
+  }
 
 
   /**
@@ -1279,9 +1249,10 @@
    *
    * @see java.awt.Graphics2D#getFontRenderContext()
    */
-  public LineMetrics getLineMetrics(String str, FontRenderContext frc)
+  public LineMetrics getLineMetrics (String str, FontRenderContext frc)
   {
-    throw new UnsupportedOperationException(); // FIXME
+    return getLineMetrics (str, 0, str.length () - 1, frc);
   }
+
 } // class Font 
 
Index: gnu/java/awt/peer/gtk/GtkToolkit.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java,v
retrieving revision 1.3
diff -u -r1.3 GtkToolkit.java
--- gnu/java/awt/peer/gtk/GtkToolkit.java	27 Jul 2003 19:04:42 -0000	1.3
+++ gnu/java/awt/peer/gtk/GtkToolkit.java	15 Oct 2003 00:26:59 -0000
@@ -55,7 +55,9 @@
 import gnu.java.awt.EmbeddedWindow;
 import gnu.java.awt.EmbeddedWindowSupport;
 import gnu.java.awt.peer.EmbeddedWindowPeer;
+import gnu.java.awt.peer.ClasspathFontPeer;
 import gnu.classpath.Configuration;
+import gnu.java.awt.peer.gtk.GdkPixbufDecoder;
 
 /* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
    This merits comment.  We are basically calling Sun's bluff on this one.
@@ -64,7 +66,7 @@
    this class.  If getPeer() ever goes away, we can implement a hash table
    that will keep up with every window's peer, but for now this is faster. */
 
-public class GtkToolkit extends Toolkit
+public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
   implements EmbeddedWindowSupport
 {
   GtkMainThread main;
@@ -99,16 +101,12 @@
 
   public Image createImage (String filename)
   {
-    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
-    // return new GtkImage (new GdkPixbufDecoder (filename), null);
-    return null;
+    return new GtkImage (new GdkPixbufDecoder (filename), null);
   }
 
   public Image createImage (URL url)
   {
-    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
-    // return new GtkImage (new GdkPixbufDecoder (url), null);
-    return null;
+    return new GtkImage (new GdkPixbufDecoder (url), null);
   }
 
   public Image createImage (ImageProducer producer) 
@@ -144,18 +142,14 @@
 
   public Image getImage (String filename) 
   {
-    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
-    // return new GtkImage (new GdkPixbufDecoder (filename), null);
-    return null;
+    return new GtkImage (new GdkPixbufDecoder (filename), null);
   }
 
   public Image getImage (URL url) 
   {
-    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
-    // return new GtkImage (new GdkPixbufDecoder (url), null);
-    return null;
+    return new GtkImage (new GdkPixbufDecoder (url), null);
   }
-
+  
   public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) 
   {
     return null;
@@ -308,6 +302,7 @@
     return new GtkEmbeddedWindowPeer (w);
   }
 
+  /* deprecated, part of the older AWT Toolkit API. */
   protected FontPeer getFontPeer (String name, int style) 
   {
     try {
@@ -318,6 +313,14 @@
     }
   }
 
+  /* newer method to produce a peer for a Font object, even though Sun's
+     design claims Font should now be peerless, we do not agree with this
+     model, hence "ClasspathFontPeer". */
+  public ClasspathFontPeer getClasspathFontPeer(String name, Map attrs)
+  {
+    return new GdkClasspathFontPeer (name, attrs);
+  }
+
   protected EventQueue getSystemEventQueueImpl() 
   {
     return q;
@@ -336,4 +339,18 @@
   {
     throw new Error("not implemented");
   }
+
+  // ClasspathToolkit methods
+
+  public GraphicsEnvironment getLocalGraphicsEnvironment()
+  {
+    throw new java.lang.UnsupportedOperationException ();
+  }
+
+  public Font createFont(int format, java.io.InputStream stream)
+  {
+    throw new java.lang.UnsupportedOperationException ();
+  }
+
+
 } // class GtkToolkit
Index: gnu/java/awt/peer/gtk/GdkGraphics2D.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java,v
retrieving revision 1.1
diff -u -r1.1 GdkGraphics2D.java
--- gnu/java/awt/peer/gtk/GdkGraphics2D.java	17 Sep 2003 20:03:02 -0000	1.1
+++ gnu/java/awt/peer/gtk/GdkGraphics2D.java	15 Oct 2003 00:27:00 -0000
@@ -48,6 +48,8 @@
 import java.text.AttributedCharacterIterator;
 import java.util.Map;
 import java.lang.Integer;
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.peer.ClasspathFontPeer;
 import gnu.classpath.Configuration;
 
 public class GdkGraphics2D extends Graphics2D
@@ -75,8 +77,8 @@
   private Shape clip;
   private AffineTransform transform;
   private GtkComponentPeer component;
-  private GdkFont font;  
-
+  private Font font;  
+  
   native private int[] initState (GtkComponentPeer component);
   native private void initState (int width, int height);
   native private void copyState (GdkGraphics2D g);
@@ -172,6 +174,10 @@
   private native void cairoSetMatrix (double m00, double m10, 
                                       double m01, double m11,
                                       double m02, double m12);
+  private native void cairoSetFont (GdkClasspathFontPeer peer);
+  private native void cairoShowGlyphs (int codes[],
+                                       float positions[],
+                                       int nglyphs);
   private native void cairoSetOperator (int cairoOperator);
   private native void cairoSetRGBColor (double red, double green, double blue);
   private native void cairoSetAlpha (double alpha);
@@ -1024,8 +1030,14 @@
   }
 
   public void drawGlyphVector (GlyphVector g, float x, float y)
-  {
-    throw new java.lang.UnsupportedOperationException ();
+  {    
+    cairoSave ();
+    cairoMoveTo ((double)x, (double)y);
+    int nglyphs = g.getNumGlyphs ();
+    int codes[] = g.getGlyphCodes (0, nglyphs, (int []) null);
+    float posns[] = g.getGlyphPositions (0, nglyphs, (float []) null);
+    cairoShowGlyphs (codes, posns, nglyphs);
+    cairoRestore ();
   }
 
   public void copyArea (int x, int y, int width, int height, int dx, int dy)
@@ -1132,10 +1144,16 @@
 
   public void setFont (Font f)
   {
-    if (f instanceof GdkFont)
-      font = (GdkFont) f;
+    if (f.getPeer() instanceof GdkClasspathFontPeer)
+      font = f;
     else
-      font = new GdkFont (f.getAttributes ());
+      font = 
+        ((ClasspathToolkit)(Toolkit.getDefaultToolkit ()))
+        .getFont (f.getName(), f.getAttributes ());
+
+    if (f != null && 
+        f.getPeer() instanceof GdkClasspathFontPeer)
+      cairoSetFont ((GdkClasspathFontPeer) f.getPeer());
   }
 
   public String toString()
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v
retrieving revision 1.1
diff -u -r1.1 gnu_java_awt_peer_gtk_GdkGraphics2D.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	17 Sep 2003 20:03:02 -0000	1.1
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	15 Oct 2003 00:27:11 -0000
@@ -36,6 +36,7 @@
    exception statement from your version. */
 
 #include "gtkpeer.h"
+#include "gdkfont.h"
 #include "gnu_java_awt_peer_gtk_GdkGraphics2D.h"
 #include <gdk/gdktypes.h>
 #include <gdk/gdkprivate.h>
@@ -198,9 +199,9 @@
   vis = gdk_x11_visual_get_xvisual (gdk_drawable_get_visual (gr->drawable));
   g_assert (vis != NULL);
   
-  gr->surface = cairo_surface_create_for_drawable (dpy, draw, vis, 
-						   CAIRO_FORMAT_ARGB32,
-						   DefaultColormap (dpy, DefaultScreen (dpy)));
+  gr->surface = cairo_xlib_surface_create (dpy, draw, vis, 
+					   CAIRO_FORMAT_ARGB32,
+					   DefaultColormap (dpy, DefaultScreen (dpy)));
   g_assert (gr->surface != NULL);
   g_assert (gr->cr != NULL);
   cairo_set_target_surface (gr->cr, gr->surface);
@@ -378,8 +379,8 @@
   gc = gdk_gc_new (dst->drawable);
   g_assert (gc != NULL);
 
-  gdk_draw_drawable(dst->drawable, gc, src->drawable,
-		    0, 0, x, y, width, height);
+  gdk_draw_drawable(dst->drawable, gc, src->drawable, 
+ 		    0, 0, x, y, width, height); 
 
   g_object_unref (gc);
 
@@ -474,7 +475,6 @@
     g_object_unref (gr->drawbuf); 
 
   g_object_unref (gr->drawable);
-  free (gr);
 
   if (gr->pattern)
     cairo_surface_destroy (gr->pattern);
@@ -483,6 +483,7 @@
     free (gr->pattern_pixels);
 
   if (gr->debug) printf ("disposed of graphics2d\n");
+  free (gr);
 
   gdk_threads_leave ();
 }
@@ -662,6 +663,7 @@
 
   begin_drawing_operation (gr);
 
+  
  {
    cairo_surface_t *surf = cairo_surface_create_for_image ((char *)jpixels, 
 							   CAIRO_FORMAT_ARGB32, 
@@ -670,8 +672,9 @@
    cairo_show_surface (gr->cr, surf, w, h);
    cairo_surface_destroy (surf);
  }
+  
 
-  end_drawing_operation (gr);
+ end_drawing_operation (gr);
 
   (*env)->ReleaseIntArrayElements (env, jarr, jpixels, 0);
 
@@ -721,6 +724,78 @@
     cairo_matrix_destroy (mat);
   }
   update_pattern_transform (gr);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont 
+   (JNIEnv *env, jobject obj, jobject font)
+{
+  struct graphics2d *gr = NULL;
+  struct peerfont *pfont = NULL;
+  cairo_ft_font_t *ft = NULL;
+  FT_Face face = NULL;
+
+  gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
+  g_assert (gr != NULL);
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
+  g_assert (pfont != NULL);
+
+  gdk_threads_enter ();
+
+  face = pango_ft2_font_get_face (pfont->font);
+  g_assert (face != NULL);
+
+  ft = cairo_ft_font_create_for_ft_face (face);
+  g_assert (ft != NULL);
+
+  if (gr->debug) printf ("cairo_set_font '%s'\n", 
+			 face->family_name);
+  
+  cairo_set_font (gr->cr, cairo_font_from_ft_font (ft));
+
+  cairo_font_destroy (cairo_font_from_ft_font (ft));
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoShowGlyphs
+   (JNIEnv *env, jobject obj, jintArray jcodes, jfloatArray jposns, jint nglyphs)
+{
+  struct graphics2d *gr = NULL;
+  cairo_glyph_t *glyphs = NULL;
+  jfloat *posns = NULL;
+  jint *codes = NULL;
+  jint i;
+
+  gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
+  g_assert (gr != NULL);
+
+  if (gr->debug) printf ("cairo_show_glyphs (%d glyphs)\n", nglyphs);
+
+  glyphs = malloc (sizeof(cairo_glyph_t) * nglyphs);
+  g_assert (glyphs);
+
+  codes = (*env)->GetIntArrayElements (env, jcodes, NULL);  
+  g_assert (codes != NULL);
+
+  posns = (*env)->GetFloatArrayElements (env, jposns, NULL);  
+  g_assert (posns != NULL);
+
+  for (i = 0; i < nglyphs; ++i)
+    {
+      glyphs[i].index = (cairo_glyph_index_t) codes[i];
+      glyphs[i].x = (double) posns[2*i];
+      glyphs[i].y = (double) posns[2*i + 1];
+    }
+
+  (*env)->ReleaseIntArrayElements (env, jcodes, codes, 0);
+  (*env)->ReleaseFloatArrayElements (env, jposns, posns, 0);
+
+  begin_drawing_operation (gr);
+  cairo_show_glyphs (gr->cr, glyphs, nglyphs);
+  end_drawing_operation (gr);
+
+  free(glyphs);
 }
 
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator 

Attachment: ClasspathToolkit.java
Description: Text document

Attachment: ClasspathFontPeer.java
Description: Text document

Attachment: GdkClasspathFontPeer.java
Description: text/plain

Attachment: GdkGlyphVector.java
Description: Text document

Attachment: gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c
Description: Text document

Attachment: gnu_java_awt_peer_gtk_GdkGlyphVector.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]