From 192631530503b8046abcfa9b2ca6760e3f39ae66 Mon Sep 17 00:00:00 2001
From: Rami Santina <rami.santina@gmail.com>
Date: Tue, 10 May 2011 14:29:12 +0300
Subject: Fix: glyph outline orientation with the removal of inversion

---
 src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java | 13 +++++++++++++
 src/jogl/classes/jogamp/graph/curve/tess/Loop.java        |  4 ++--
 src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java  |  3 ++-
 3 files changed, 17 insertions(+), 3 deletions(-)

(limited to 'src/jogl/classes')

diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index 11307d518..7f8e386a1 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -279,6 +279,19 @@ public class OutlineShape implements Comparable<OutlineShape> {
             bbox.resize(lo.getBounds());
         }
     }
+    
+    /** Adds a vertex to the last open outline in the shape. 
+     * at {@code position} 
+     * @param position indx at which the vertex will be added 
+     * @param v the vertex to be added to the OutlineShape
+     */
+    public final void addVertex(int position, Vertex v){
+        final Outline lo = getLastOutline();
+        lo.addVertex(position, v);
+        if( 0 == ( dirtyBits & DIRTY_BOUNDS ) ) {
+            bbox.resize(lo.getBounds());
+        }
+    }
 
     /** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute
      * of the vertex. The 2D vertex will be represented as Z=0.
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index 038d41b84..956fd56f2 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -104,8 +104,8 @@ public class Loop {
         }
         boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(),
                 vertices.get(2).getPoint());
-        boolean invert = isCCW != (direction == VectorUtil.CCW);
-
+        boolean invert = isCCW && (direction == VectorUtil.CW);
+        
         final int dir;
         final int max;
         final int edgeType;
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
index b6f37a610..b47612f51 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
@@ -73,7 +73,8 @@ public class GlyphShape {
     public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); }
     
     private void addVertexToLastOutline(Vertex vertex) {
-        shape.addVertex(vertex);
+    	//FIXME: assuming font outline comes in CW order
+        shape.addVertex(0, vertex);
     }
     
     private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){
-- 
cgit v1.2.3