Commit 9209411236d721068a075fe408466dc3eb570721

sammy 2008-04-23T15:56:47

* Only build outset contours when really needed. This spares quite a few operations and removes now useless parameters from several methods. Patch by Eric Beets, reworked by me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
diff --git a/include/FTContour.h b/include/FTContour.h
index bc5cbdc..ba86187 100644
--- a/include/FTContour.h
+++ b/include/FTContour.h
@@ -59,11 +59,8 @@ class FTGL_EXPORT FTContour
          * @param contour
          * @param pointTags
          * @param numberOfPoints
-         * @param front front outset
-         * @param back back outset
          */
-        FTContour(FT_Vector* contour, char* pointTags, unsigned int numberOfPoints, 
-                   float front = 0.0f, float back = 0.0f);
+        FTContour(FT_Vector* contour, char* pointTags, unsigned int numberOfPoints);
 
         /**
          * Destructor
@@ -72,15 +69,22 @@ class FTGL_EXPORT FTContour
         {
             pointList.clear();
         }
-        
+
         /**
          * Return a point at index.
          *
          * @param index of the point in the curve.
          * @return const point reference
          */
-        const FTPoint& Point( unsigned int index) const { return pointList[index];}
+        const FTPoint& Point(unsigned int index) const { return pointList[index]; }
 
+        /**
+         * Return a point at index.
+         *
+         * @param index of the point in the outset curve.
+         * @return const point reference
+         */
+        const FTPoint& Outset(unsigned int index) const { return outsetPointList[index]; }
 
         /**
          * Return a point at index of the front outset contour.
@@ -124,6 +128,14 @@ class FTGL_EXPORT FTContour
         size_t FrontPointCount() const { return frontPointList.size(); }
         size_t BackPointCount() const { return backPointList.size(); }
 
+        /**
+         * Create the front/back outset contour
+         *
+         * @param outset The outset distance
+         */
+        void buildFrontOutset(float outset);
+        void buildBackOutset(float outset);
+
     private:
         /**
          * Add a point to this contour. This function tests for duplicate
@@ -131,7 +143,15 @@ class FTGL_EXPORT FTContour
          *
          * @param point The point to be added to the contour.
          */
-        inline void AddPoint( FTPoint point);
+        inline void AddPoint(FTPoint point);
+
+        /**
+         * Add a point to this contour. This function tests for duplicate
+         * points.
+         *
+         * @param point The point to be added to the contour.
+         */
+        inline void AddOutsetPoint(FTPoint point);
 
         /*
          * Add a point to this outset contour. This function tests for duplicate
@@ -156,11 +176,8 @@ class FTGL_EXPORT FTContour
 
         /**
          * Create the list point of the outset contour.
-         *
-         * @param frontOutset front outset size
-         * @param backOutset back outset size
          */
-        inline void outsetContour(float frontOutset, float backtOuset);
+        inline void outsetContour();
 
         /**
          * Compute the vector norm
@@ -180,18 +197,19 @@ class FTGL_EXPORT FTContour
         /**
          * Compute the vector bisecting from a vector 'v' and a distance 'd'
          */
-        inline void ComputeBisec(FTPoint &v, double d);
+        inline void ComputeBisec(FTPoint &v);
 
         /**
          * Compute the outset point coordinates
          */
-        inline FTPoint ComputeOutsetPoint(FTPoint a, FTPoint b, FTPoint c, FTGL_DOUBLE d);
+        inline FTPoint ComputeOutsetPoint(FTPoint a, FTPoint b, FTPoint c);
 
         /**
          *  The list of points in this contour
          */
         typedef FTVector<FTPoint> PointVector;
         PointVector pointList;
+        PointVector outsetPointList;
         PointVector frontPointList;
         PointVector backPointList;
 };
diff --git a/include/FTExtrdGlyph.h b/include/FTExtrdGlyph.h
index eb98888..289e2e9 100644
--- a/include/FTExtrdGlyph.h
+++ b/include/FTExtrdGlyph.h
@@ -96,6 +96,7 @@ class FTGL_EXPORT FTExtrdGlyph : public FTGlyph
          */
         unsigned int hscale, vscale;
         float depth;
+        float frontOutset, backOutset;
         FTVectoriser *vectoriser;
 
         /**
diff --git a/include/FTGLOutlineFont.h b/include/FTGLOutlineFont.h
index e5c12d4..aefe992 100644
--- a/include/FTGLOutlineFont.h
+++ b/include/FTGLOutlineFont.h
@@ -58,7 +58,7 @@ class FTGL_EXPORT FTGLOutlineFont : public FTFont
          * @param fontFilePath  font file path.
          */
         FTGLOutlineFont( const char* fontFilePath);
-        
+
         /**
          * Open and read a font from a buffer in memory. Sets Error flag.
          *
@@ -66,7 +66,7 @@ class FTGL_EXPORT FTGLOutlineFont : public FTFont
          * @param bufferSizeInBytes  the length of the buffer in bytes
          */
         FTGLOutlineFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
-        
+
         /**
          * Destructor
          */
@@ -80,18 +80,17 @@ class FTGL_EXPORT FTGLOutlineFont : public FTFont
          */
         void Outset(float o) { outset = o; }
 
-        
         /**
          * Renders a string of characters
-         * 
-         * @param string    'C' style string to be output.   
+         *
+         * @param string    'C' style string to be output.
          */
         void Render(const char* string);
-        
+
         /**
          * Renders a string of characters
-         * 
-         * @param string    wchar_t string to be output.     
+         *
+         * @param string    wchar_t string to be output.
          */
         void Render(const wchar_t* string);
 
@@ -103,7 +102,7 @@ class FTGL_EXPORT FTGLOutlineFont : public FTFont
          * @return  An FTOutlineGlyph or <code>null</code> on failure.
          */
         inline virtual FTGlyph* MakeGlyph(unsigned int g);
-        
+
         /**
          * The outset distance for the font.
          */
diff --git a/include/FTOutlineGlyph.h b/include/FTOutlineGlyph.h
index e129166..5182bb3 100644
--- a/include/FTOutlineGlyph.h
+++ b/include/FTOutlineGlyph.h
@@ -92,6 +92,11 @@ class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
         FTVectoriser *vectoriser;
 
         /**
+         * Private rendering variables.
+         */
+        float outset;
+
+        /**
          * OpenGL display list
          */
         GLuint glList;
diff --git a/include/FTPolyGlyph.h b/include/FTPolyGlyph.h
index 98de29e..de90458 100644
--- a/include/FTPolyGlyph.h
+++ b/include/FTPolyGlyph.h
@@ -60,7 +60,7 @@ class FTGL_EXPORT FTPolyGlyph : public FTGlyph
          * Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
          *
          * @param glyph The Freetype glyph to be processed
-         * @param glyph The Freetype glyph to be processed
+         * @param outset  The outset distance
          * @param useDisplayList Enable or disable the use of Display Lists for this glyph
          *                       <code>true</code> turns ON display lists.
          *                       <code>false</code> turns OFF display lists.
@@ -92,6 +92,7 @@ class FTGL_EXPORT FTPolyGlyph : public FTGlyph
          */
         unsigned int hscale, vscale;
         FTVectoriser *vectoriser;
+        float outset;
 
         /**
          * OpenGL display list
diff --git a/include/FTVectoriser.h b/include/FTVectoriser.h
index 5f80381..eb270f7 100644
--- a/include/FTVectoriser.h
+++ b/include/FTVectoriser.h
@@ -216,10 +216,8 @@ class FTGL_EXPORT FTVectoriser
          * Constructor
          *
          * @param glyph The freetype glyph to be processed
-         * @param front front outset distance
-         * @param back back outset distance
          */
-        FTVectoriser(const FT_GlyphSlot glyph, float front, float back = 0.0f);
+        FTVectoriser(const FT_GlyphSlot glyph);
 
         /**
          *  Destructor
@@ -227,23 +225,24 @@ class FTGL_EXPORT FTVectoriser
         virtual ~FTVectoriser();
 
         /**
-         * Build an FTMesh from the vector outline data. 
+         * Build an FTMesh from the vector outline data.
          *
          * @param zNormal   The direction of the z axis of the normal
          *                  for this mesh
          * FIXME: change the following for a constant
-         * @param outset Specify the outset contour
+         * @param outsetType Specify the outset type contour
          *  0 : Original
          *  1 : Front
          *  2 : Back
+         * @param outsetSize Specify the outset size contour
          */
-        void MakeMesh(FTGL_DOUBLE zNormal = FTGL_FRONT_FACING, int outset = 0);
-        
+        void MakeMesh(FTGL_DOUBLE zNormal = FTGL_FRONT_FACING, int outsetType = 0, float outsetSize = 0.0f);
+
         /**
          * Get the current mesh.
          */
         const FTMesh* const GetMesh() const { return mesh;}
-        
+
         /**
          * Get the total count of points in this outline
          *
@@ -279,7 +278,7 @@ class FTGL_EXPORT FTVectoriser
          * @return The contour flag
          */
         int ContourFlag() const { return contourFlag;}
-        
+
     private:
         /**
          * Process the freetype outline data into contours of points
@@ -287,7 +286,7 @@ class FTGL_EXPORT FTVectoriser
          * @param front front outset distance
          * @param back back outset distance
          */
-        void ProcessContours(float front, float back);
+        void ProcessContours();
 
         /**
          * The list of contours in the glyph
@@ -298,7 +297,7 @@ class FTGL_EXPORT FTVectoriser
          * A Mesh for tesselations
          */
         FTMesh* mesh;
-        
+
         /**
          * The number of contours reported by Freetype
          */
diff --git a/src/FTContour.cpp b/src/FTContour.cpp
index 6cdcc9e..5eab697 100644
--- a/src/FTContour.cpp
+++ b/src/FTContour.cpp
@@ -52,6 +52,15 @@ void FTContour::AddPoint(FTPoint point)
     }
 }
 
+void FTContour::AddOutsetPoint(FTPoint point)
+{
+    if(outsetPointList.empty() || (point != outsetPointList[pointList.size() - 1]
+                              && point != outsetPointList[0]))
+    {
+        outsetPointList.push_back(point);
+    }
+}
+
 
 void FTContour::evaluateQuadraticCurve(FTPoint A, FTPoint B, FTPoint C)
 {
@@ -125,17 +134,16 @@ void FTContour::MultMatrixVect(FTGL_DOUBLE *mat, FTPoint &v)
     v.Y(res.Y());
 }
 
-void FTContour::ComputeBisec(FTPoint &v, double d)
+void FTContour::ComputeBisec(FTPoint &v)
 {
-    int sgn = 1;
+    FTGL_DOUBLE sgn = 64.0;
     if((v.Y() / NormVector(v)) < 0)
-        sgn = -1;
-    double tg = sgn * sqrt((NormVector(v) - v.X()) / (NormVector(v) + v.X()));
-    v.X(-d * tg);
-    v.Y(d);
+        sgn = -64.0;
+    v.X(sgn * sqrt((NormVector(v) - v.X()) / (NormVector(v) + v.X())));
+    v.Y(64.0);
 }
 
-FTPoint FTContour::ComputeOutsetPoint(FTPoint a, FTPoint b, FTPoint c, FTGL_DOUBLE dist)
+FTPoint FTContour::ComputeOutsetPoint(FTPoint a, FTPoint b, FTPoint c)
 {
     FTGL_DOUBLE mat[4], inv[4];
     /* Build the rotation matrix from 'ab' vector */
@@ -145,14 +153,13 @@ FTPoint FTContour::ComputeOutsetPoint(FTPoint a, FTPoint b, FTPoint c, FTGL_DOUB
     /* Apply the rotation to the second vector 'bc' */
     MultMatrixVect(mat, h);
     /* Compute the vector bisecting 'bh' */
-    ComputeBisec(h, dist);
+    ComputeBisec(h);
     /* Apply the inverted rotation matrix to 'bh' */
     MultMatrixVect(inv, h);
-    /* Translate the vector 'bh' to the second point 'b' to have the point 'h' */
-    return b + h;
+    return h;
 }
 
-void FTContour::outsetContour(float frontOutset, float backOutset)
+void FTContour::outsetContour()
 {
     size_t size = PointCount();
     FTPoint vOutsetF, vOutsetB;
@@ -161,24 +168,13 @@ void FTContour::outsetContour(float frontOutset, float backOutset)
         int prev = (pointIndex%size + size - 1) % size;
         int cur = pointIndex%size;
         int next = (pointIndex%size + 1) % size;
-
-        if(frontOutset != 0.0f)
-        {
-            vOutsetF = ComputeOutsetPoint(Point(prev), Point(cur), Point(next),
-                                          frontOutset);
-            AddFrontPoint(vOutsetF);
-        }
-        if(backOutset != 0.0f)
-        {
-            vOutsetB = ComputeOutsetPoint(Point(prev), Point(cur), Point(next),
-                                          backOutset);
-            AddBackPoint(vOutsetB);
-        }
+        /* Build the outset shape with d = 1.0f */
+        vOutsetB = ComputeOutsetPoint(Point(prev), Point(cur), Point(next));
+        AddOutsetPoint(vOutsetB);
     }
 }
 
-FTContour::FTContour(FT_Vector* contour, char* tags, unsigned int n,
-                     float frontOutset, float backOutset)
+FTContour::FTContour(FT_Vector* contour, char* tags, unsigned int n)
 {
     for(unsigned int i = 0; i < n; ++ i)
     {
@@ -233,6 +229,27 @@ FTContour::FTContour(FT_Vector* contour, char* tags, unsigned int n,
     }
 
     /* Create (or not) front outset and/or back outset */
-    outsetContour(frontOutset, backOutset);
+    outsetContour();
+}
+
+void FTContour::buildFrontOutset(float outset)
+{
+    for( size_t i = 0; i < PointCount(); ++i)
+    {
+        FTPoint point = FTPoint(Point(i).X() + Outset(i).X() * outset,
+                                Point(i).Y() + Outset(i).Y() * outset,
+                                0);
+       AddFrontPoint(point);
+    }
+}
+void FTContour::buildBackOutset(float outset)
+{
+    for( size_t i = 0; i < PointCount(); ++i)
+    {
+        FTPoint point = FTPoint(Point(i).X() + Outset(i).X() * outset,
+                                Point(i).Y() + Outset(i).Y() * outset,
+                                0);
+       AddBackPoint(point);
+    }
 }
 
diff --git a/src/FTExtrdGlyph.cpp b/src/FTExtrdGlyph.cpp
index 8e9d778..66a49eb 100644
--- a/src/FTExtrdGlyph.cpp
+++ b/src/FTExtrdGlyph.cpp
@@ -52,8 +52,8 @@ FTExtrdGlyph::FTExtrdGlyph(FT_GlyphSlot glyph, float depth, float frontOutset, f
         return;
     }
 
-    vectoriser = new FTVectoriser(glyph, frontOutset * 64.0f,
-                                         backOutset * 64.0f);
+    vectoriser = new FTVectoriser(glyph);
+
     if((vectoriser->ContourCount() < 1) || (vectoriser->PointCount() < 3))
     {
         delete vectoriser;
@@ -64,6 +64,8 @@ FTExtrdGlyph::FTExtrdGlyph(FT_GlyphSlot glyph, float depth, float frontOutset, f
     this->hscale = glyph->face->size->metrics.x_ppem * 64;
     this->vscale = glyph->face->size->metrics.y_ppem * 64;
     this->depth = depth;
+    this->frontOutset = frontOutset;
+    this->backOutset = backOutset;
 
     if(useDisplayList)
     {
@@ -132,7 +134,7 @@ const FTPoint& FTExtrdGlyph::Render(const FTPoint& pen, int renderMode)
 
 void FTExtrdGlyph::RenderFront()
 {
-    vectoriser->MakeMesh(1.0, 1);
+    vectoriser->MakeMesh(1.0, 1, frontOutset);
     glNormal3d(0.0, 0.0, 1.0);
 
     const FTMesh *mesh = vectoriser->GetMesh();
@@ -160,7 +162,7 @@ void FTExtrdGlyph::RenderFront()
 
 void FTExtrdGlyph::RenderBack()
 {
-    vectoriser->MakeMesh(-1.0, 2);
+    vectoriser->MakeMesh(-1.0, 2, backOutset);
     glNormal3d(0.0, 0.0, -1.0);
 
     const FTMesh *mesh = vectoriser->GetMesh();
diff --git a/src/FTOutlineGlyph.cpp b/src/FTOutlineGlyph.cpp
index bc7cf4f..8b17c88 100644
--- a/src/FTOutlineGlyph.cpp
+++ b/src/FTOutlineGlyph.cpp
@@ -49,7 +49,7 @@ FTOutlineGlyph::FTOutlineGlyph(FT_GlyphSlot glyph, float outset, bool useDisplay
         return;
     }
 
-    vectoriser = new FTVectoriser(glyph, outset * 64.0f);
+    vectoriser = new FTVectoriser(glyph);
 
     if((vectoriser->ContourCount() < 1) || (vectoriser->PointCount() < 3))
     {
@@ -58,6 +58,8 @@ FTOutlineGlyph::FTOutlineGlyph(FT_GlyphSlot glyph, float outset, bool useDisplay
         return;
     }
 
+    this->outset = outset;
+
     if(useDisplayList)
     {
         glList = glGenLists(1);
@@ -112,7 +114,9 @@ void FTOutlineGlyph::DoRender()
         glBegin(GL_LINE_LOOP);
             for(unsigned int i = 0; i < contour->PointCount(); ++i)
             {
-                FTPoint point = contour->FrontPoint(i);
+                FTPoint point = FTPoint(contour->Point(i).X() + contour->Outset(i).X() * outset,
+                                        contour->Point(i).Y() + contour->Outset(i).Y() * outset,
+                                        0);
                 glVertex2f(point.X() / 64.0f, point.Y() / 64.0f);
             }
         glEnd();
diff --git a/src/FTPolyGlyph.cpp b/src/FTPolyGlyph.cpp
index 02e32b7..f812abd 100644
--- a/src/FTPolyGlyph.cpp
+++ b/src/FTPolyGlyph.cpp
@@ -49,7 +49,7 @@ FTPolyGlyph::FTPolyGlyph(FT_GlyphSlot glyph, float outset, bool useDisplayList)
         return;
     }
 
-    vectoriser = new FTVectoriser(glyph, outset * 64.0f);
+    vectoriser = new FTVectoriser(glyph);
 
     if((vectoriser->ContourCount() < 1) || (vectoriser->PointCount() < 3))
     {
@@ -58,10 +58,10 @@ FTPolyGlyph::FTPolyGlyph(FT_GlyphSlot glyph, float outset, bool useDisplayList)
         return;
     }
 
-    vectoriser->MakeMesh(1.0, 1);
 
-    hscale = glyph->face->size->metrics.x_ppem * 64;
-    vscale = glyph->face->size->metrics.y_ppem * 64;
+    this->hscale = glyph->face->size->metrics.x_ppem * 64;
+    this->vscale = glyph->face->size->metrics.y_ppem * 64;
+    this->outset = outset;
 
     if(useDisplayList)
     {
@@ -110,6 +110,8 @@ const FTPoint& FTPolyGlyph::Render(const FTPoint& pen, int renderMode)
 
 void FTPolyGlyph::DoRender()
 {
+    vectoriser->MakeMesh(1.0, 1, outset);
+
     const FTMesh *mesh = vectoriser->GetMesh();
 
     for(unsigned int t = 0; t < mesh->TesselationCount(); ++t)
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
index a9217be..7ef4bb0 100644
--- a/src/FTVectoriser.cpp
+++ b/src/FTVectoriser.cpp
@@ -69,7 +69,6 @@ void CALLBACK ftglCombine( FTGL_DOUBLE coords[3], void* vertex_data[4], GLfloat 
     const FTGL_DOUBLE* vertex = static_cast<const FTGL_DOUBLE*>(coords);
     *outData = const_cast<FTGL_DOUBLE*>(mesh->Combine( vertex[0], vertex[1], vertex[2]));
 }
-        
 
 void CALLBACK ftglBegin( GLenum type, FTMesh* mesh)
 {
@@ -97,7 +96,7 @@ FTMesh::~FTMesh()
     {
         delete tesselationList[t];
     }
-    
+
     tesselationList.clear();
 }
 
@@ -133,7 +132,7 @@ const FTTesselation* const FTMesh::Tesselation( unsigned int index) const
 }
 
 
-FTVectoriser::FTVectoriser(const FT_GlyphSlot glyph, float frontOutset, float backOutset)
+FTVectoriser::FTVectoriser(const FT_GlyphSlot glyph)
 :   contourList(0),
     mesh(0),
     ftContourCount(0),
@@ -142,12 +141,12 @@ FTVectoriser::FTVectoriser(const FT_GlyphSlot glyph, float frontOutset, float ba
     if( glyph)
     {
         outline = glyph->outline;
-        
+
         ftContourCount = outline.n_contours;
         contourList = 0;
         contourFlag = outline.flags;
-        
-        ProcessContours(frontOutset, backOutset);
+
+        ProcessContours();
     }
 }
 
@@ -164,26 +163,26 @@ FTVectoriser::~FTVectoriser()
 }
 
 
-void FTVectoriser::ProcessContours(float frontOutset, float backOutset)
+void FTVectoriser::ProcessContours()
 {
     short contourLength = 0;
     short startIndex = 0;
     short endIndex = 0;
-    
+
     contourList = new FTContour*[ftContourCount];
-    
+
     for( short contourIndex = 0; contourIndex < ftContourCount; ++contourIndex)
     {
         FT_Vector* pointList = &outline.points[startIndex];
         char* tagList = &outline.tags[startIndex];
-        
+
         endIndex = outline.contours[contourIndex];
         contourLength =  ( endIndex - startIndex) + 1;
 
-        FTContour* contour = new FTContour(pointList, tagList, contourLength, frontOutset, backOutset);
-        
+        FTContour* contour = new FTContour(pointList, tagList, contourLength);
+
         contourList[contourIndex] = contour;
-        
+
         startIndex = endIndex + 1;
     }
 }
@@ -196,7 +195,7 @@ size_t FTVectoriser::PointCount()
     {
         s += contourList[c]->PointCount();
     }
-    
+
     return s;
 }
 
@@ -207,15 +206,15 @@ const FTContour* const FTVectoriser::Contour( unsigned int index) const
 }
 
 
-void FTVectoriser::MakeMesh(FTGL_DOUBLE zNormal, int outsetContour)
+void FTVectoriser::MakeMesh(FTGL_DOUBLE zNormal, int outsetType, float outsetSize)
 {
     if( mesh)
     {
         delete mesh;
     }
-        
+
     mesh = new FTMesh;
-    
+
     GLUtesselator* tobj = gluNewTess();
 
     gluTessCallback( tobj, GLU_TESS_BEGIN_DATA,     (GLUTesselatorFunction)ftglBegin);
@@ -223,7 +222,7 @@ void FTVectoriser::MakeMesh(FTGL_DOUBLE zNormal, int outsetContour)
     gluTessCallback( tobj, GLU_TESS_COMBINE_DATA,   (GLUTesselatorFunction)ftglCombine);
     gluTessCallback( tobj, GLU_TESS_END_DATA,       (GLUTesselatorFunction)ftglEnd);
     gluTessCallback( tobj, GLU_TESS_ERROR_DATA,     (GLUTesselatorFunction)ftglError);
-    
+
     if( contourFlag & ft_outline_even_odd_fill) // ft_outline_reverse_fill
     {
         gluTessProperty( tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD);
@@ -232,25 +231,32 @@ void FTVectoriser::MakeMesh(FTGL_DOUBLE zNormal, int outsetContour)
     {
         gluTessProperty( tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO);
     }
-    
-    
+
+
     gluTessProperty( tobj, GLU_TESS_TOLERANCE, 0);
     gluTessNormal( tobj, 0.0f, 0.0f, zNormal);
     gluTessBeginPolygon( tobj, mesh);
 
         for( size_t c = 0; c < ContourCount(); ++c)
         {
+            /* Build the */
+            switch(outsetType)
+            {
+                case 1 : contourList[c]->buildFrontOutset(outsetSize); break;
+                case 2 : contourList[c]->buildBackOutset(outsetSize); break;
+            }
             const FTContour* contour = contourList[c];
 
+
             gluTessBeginContour( tobj);
                 for( size_t p = 0; p < contour->PointCount(); ++p)
                 {
                     const FTGL_DOUBLE* d;
-                    switch(outsetContour)
+                    switch(outsetType)
                     {
                         case 0: d = contour->Point(p); break;
-                        case 1 : d = contour->FrontPoint(p); break;
-                        case 2 : d = contour->BackPoint(p);  break;
+                        case 1: d = contour->FrontPoint(p); break;
+                        case 2: d = contour->BackPoint(p); break;
                     }
                     gluTessVertex( tobj, (GLdouble*)d, (GLdouble*)d);
                 }
diff --git a/test/FTVectoriser-Test.cpp b/test/FTVectoriser-Test.cpp
index 9f88125..8735c22 100644
--- a/test/FTVectoriser-Test.cpp
+++ b/test/FTVectoriser-Test.cpp
@@ -296,7 +296,7 @@ class FTVectoriserTest : public CppUnit::TestCase
 
         void testNullGlyphProcess()
         {
-            FTVectoriser vectoriser(NULL, 0);
+            FTVectoriser vectoriser(NULL);
             CPPUNIT_ASSERT_EQUAL((size_t)0, vectoriser.ContourCount());
         }
         
@@ -305,7 +305,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( NULL_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser(face->glyph, 0);
+            FTVectoriser vectoriser(face->glyph);
             CPPUNIT_ASSERT_EQUAL((size_t)0, vectoriser.ContourCount());
             
             tearDownFreetype();
@@ -316,7 +316,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser(face->glyph, 0);
+            FTVectoriser vectoriser(face->glyph);
 
             CPPUNIT_ASSERT_EQUAL((size_t)2, vectoriser.ContourCount());
             CPPUNIT_ASSERT_EQUAL((size_t)8, vectoriser.PointCount());
@@ -329,7 +329,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser(face->glyph, 0);
+            FTVectoriser vectoriser(face->glyph);
 
             CPPUNIT_ASSERT_EQUAL((size_t)2, vectoriser.ContourCount());
             CPPUNIT_ASSERT_EQUAL((size_t)91, vectoriser.PointCount());
@@ -342,7 +342,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser(face->glyph, 0);
+            FTVectoriser vectoriser(face->glyph);
 
             CPPUNIT_ASSERT( vectoriser.Contour(1));
             CPPUNIT_ASSERT( vectoriser.Contour(99) == NULL);
@@ -355,7 +355,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser(face->glyph, 0);
+            FTVectoriser vectoriser(face->glyph);
             
             unsigned int d = 0;
             for( size_t c = 0; c < vectoriser.ContourCount(); ++c)
@@ -378,7 +378,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser(face->glyph, 0);
+            FTVectoriser vectoriser(face->glyph);
             CPPUNIT_ASSERT( vectoriser.GetMesh() == NULL);
 
             vectoriser.MakeMesh( FTGL_FRONT_FACING);
@@ -391,7 +391,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser(face->glyph, 0);
+            FTVectoriser vectoriser(face->glyph);
 
             vectoriser.MakeMesh( FTGL_FRONT_FACING);