I added a fallback for CairoGraphics2D.drawGlyphVector() that can draw
GlyphVector instances other than FreetypeGlyphVector too. For this case
it simply calls fill(Shape) with the coordinate system translated
accordingly.

This allows me to play with GnuGlyphVector and CairoGraphics2D.

2006-06-08  Roman Kennke  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/CairoGraphics2D.java
        (drawGlyphVector): Added fallback for non-FreetypeGlyphVector
        implementations.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v
retrieving revision 1.15
diff -u -1 -0 -r1.15 CairoGraphics2D.java
--- gnu/java/awt/peer/gtk/CairoGraphics2D.java	7 Jun 2006 19:12:03 -0000	1.15
+++ gnu/java/awt/peer/gtk/CairoGraphics2D.java	9 Jun 2006 16:02:34 -0000
@@ -1280,26 +1280,36 @@
     drawString (str, (float) x, (float) y);
   }
 
   public void drawString(AttributedCharacterIterator ci, int x, int y)
   {
     drawString (ci, (float) x, (float) y);
   }
 
   public void drawGlyphVector(GlyphVector gv, float x, float y)
   {
-    int n = gv.getNumGlyphs ();
-    int[] codes = gv.getGlyphCodes (0, n, null);
-    float[] positions = gv.getGlyphPositions (0, n, null);
-    
-    setFont (gv.getFont ());
-    cairoDrawGlyphVector( (GdkFontPeer)getFont().getPeer(), x, y, n, codes, positions);
+    if (gv instanceof FreetypeGlyphVector)
+      {
+        int n = gv.getNumGlyphs ();
+        int[] codes = gv.getGlyphCodes (0, n, null);
+        float[] positions = gv.getGlyphPositions (0, n, null);
+
+        setFont (gv.getFont ());
+        cairoDrawGlyphVector( (GdkFontPeer)getFont().getPeer(), x, y, n, codes,
+                              positions);
+      }
+    else
+      {
+        translate(x, y);
+        fill(gv.getOutline());
+        translate(-x, -y);
+      }
   }
 
   public void drawString(AttributedCharacterIterator ci, float x, float y)
   {
     GlyphVector gv = getFont().createGlyphVector(getFontRenderContext(), ci);
     drawGlyphVector(gv, x, y);
   }
 
   /**
    * Should perhaps be contexct dependent, but this is left for now as an 

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to