Commit 6c2a187c98b8d55ae7ee2e405562094cf5727672

sammy 2008-06-08T15:56:35

* Revert the FTFont::Advance() and FTGlyph::Advance() improvements. After discussion, I was convinced they were not worth the backwards compatibility breakage. They now return float again, instead of FTPoint.

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
diff --git a/demo/FTGLDemo.cpp b/demo/FTGLDemo.cpp
index d0d9e61..3616551 100644
--- a/demo/FTGLDemo.cpp
+++ b/demo/FTGLDemo.cpp
@@ -261,7 +261,7 @@ void renderFontmetrics()
         glBegin(GL_LINES);
             glColor3f(0.0, 0.0, 1.0);
             glVertex3f(0.0, 0.0, 0.0);
-            glVertex3f(fonts[current_font]->Advance(myString).Xf(), 0.0, 0.0);
+            glVertex3f(fonts[current_font]->Advance(myString), 0.0, 0.0);
             glVertex3f(0.0, fonts[current_font]->Ascender(), 0.0);
             glVertex3f(0.0, fonts[current_font]->Descender(), 0.0);
         glEnd();
diff --git a/demo/FTGLMFontDemo.cpp b/demo/FTGLMFontDemo.cpp
index efde368..33dea74 100644
--- a/demo/FTGLMFontDemo.cpp
+++ b/demo/FTGLMFontDemo.cpp
@@ -272,7 +272,7 @@ void renderFontmetrics()
         glBegin(GL_LINES);
             glColor3f(0.0, 0.0, 1.0);
             glVertex3f(0.0, 0.0, 0.0);
-            glVertex3f(fonts[current_font]->Advance(myString).Xf(), 0.0, 0.0);
+            glVertex3f(fonts[current_font]->Advance(myString), 0.0, 0.0);
             glVertex3f(0.0, fonts[current_font]->Ascender(), 0.0);
             glVertex3f(0.0, fonts[current_font]->Descender(), 0.0);
         glEnd();
diff --git a/src/FTFont/FTFont.cpp b/src/FTFont/FTFont.cpp
index 2ea7377..fb59656 100644
--- a/src/FTFont/FTFont.cpp
+++ b/src/FTFont/FTFont.cpp
@@ -168,17 +168,15 @@ FTPoint FTFont::Render(const wchar_t * string, const int len,
 }
 
 
-FTPoint FTFont::Advance(const char * string, const int len,
-                        FTPoint position, FTPoint spacing)
+float FTFont::Advance(const char * string, const int len, FTPoint spacing)
 {
-    return impl->Advance(string, len, position, spacing);
+    return impl->Advance(string, len, spacing);
 }
 
 
-FTPoint FTFont::Advance(const wchar_t * string, const int len,
-                        FTPoint position, FTPoint spacing)
+float FTFont::Advance(const wchar_t * string, const int len, FTPoint spacing)
 {
-    return impl->Advance(string, len, position, spacing);
+    return impl->Advance(string, len, spacing);
 }
 
 
@@ -380,7 +378,7 @@ inline FTBBox FTFontImpl::BBoxI(const T* string, const int len,
             totalBBox = glyphList->BBox(thisChar);
             totalBBox += position;
 
-            position += glyphList->Advance(thisChar, nextChar);
+            position += FTPoint(glyphList->Advance(thisChar, nextChar), 0.0);
         }
 
         /* Expand totalBox by each glyph in string */
@@ -397,7 +395,8 @@ inline FTBBox FTFontImpl::BBoxI(const T* string, const int len,
                 tempBBox += position;
                 totalBBox |= tempBBox;
 
-                position += glyphList->Advance(thisChar, nextChar);
+                position += FTPoint(glyphList->Advance(thisChar, nextChar),
+                                    0.0);
             }
         }
     }
@@ -422,9 +421,10 @@ FTBBox FTFontImpl::BBox(const wchar_t *string, const int len,
 
 
 template <typename T>
-inline FTPoint FTFontImpl::AdvanceI(const T* string, const int len,
-                                    FTPoint position, FTPoint spacing)
+inline float FTFontImpl::AdvanceI(const T* string, const int len,
+                                  FTPoint spacing)
 {
+    float advance = 0.0f;
     FTUnicodeStringItr<T> ustr(string);
 
     for(int i = 0; (len < 0 && *ustr) || (len >= 0 && i < len); i++)
@@ -434,32 +434,29 @@ inline FTPoint FTFontImpl::AdvanceI(const T* string, const int len,
 
         if(CheckGlyph(thisChar))
         {
-            position += glyphList->Advance(thisChar, nextChar);
+            advance += glyphList->Advance(thisChar, nextChar);
         }
 
         if(nextChar)
         {
-            position += spacing;
+            advance += spacing.Xf();
         }
     }
 
-    return position;
+    return advance;
 }
 
 
-FTPoint FTFontImpl::Advance(const char* string, const int len,
-                            FTPoint position, FTPoint spacing)
+float FTFontImpl::Advance(const char* string, const int len, FTPoint spacing)
 {
     /* The chars need to be unsigned because they are cast to int later */
-    return AdvanceI((const unsigned char *)string,
-                    len, position, spacing);
+    return AdvanceI((const unsigned char *)string, len, spacing);
 }
 
 
-FTPoint FTFontImpl::Advance(const wchar_t* string, const int len,
-                            FTPoint position, FTPoint spacing)
+float FTFontImpl::Advance(const wchar_t* string, const int len, FTPoint spacing)
 {
-    return AdvanceI(string, len, position, spacing);
+    return AdvanceI(string, len, spacing);
 }
 
 
@@ -468,7 +465,7 @@ inline FTPoint FTFontImpl::RenderI(const T* string, const int len,
                                    FTPoint position, FTPoint spacing,
                                    int renderMode)
 {
-     // for multibyte - we can't rely on sizeof(T) == character
+    // for multibyte - we can't rely on sizeof(T) == character
     FTUnicodeStringItr<T> ustr(string);
 
     for(int i = 0; (len < 0 && *ustr) || (len >= 0 && i < len); i++)
diff --git a/src/FTFont/FTFontGlue.cpp b/src/FTFont/FTFontGlue.cpp
index cb5c334..ccb4e95 100644
--- a/src/FTFont/FTFontGlue.cpp
+++ b/src/FTFont/FTFontGlue.cpp
@@ -200,15 +200,8 @@ void ftglGetFontBBox(FTGLfont *f, const char* s, int len, float c[6])
 }
 
 // float FTFont::Advance(const char* string);
-extern "C++" {
-C_FUN(static FTPoint, _ftglGetFontAdvance, (FTGLfont *f, char const *s),
-      return static_ftpoint, Advance, (s));
-}
-
-float ftglGetFontAdvance(FTGLfont *f, const char* s)
-{
-    return _ftglGetFontAdvance(f, s).Xf();
-}
+C_FUN(float, ftglGetFontAdvance, (FTGLfont *f, char const *s),
+      return 0.0, Advance, (s));
 
 // virtual void Render(const char* string, int renderMode);
 extern "C++" {
diff --git a/src/FTFont/FTFontImpl.h b/src/FTFont/FTFontImpl.h
index 7962e8e..e9dd3d2 100644
--- a/src/FTFont/FTFontImpl.h
+++ b/src/FTFont/FTFontImpl.h
@@ -79,11 +79,9 @@ class FTFontImpl
 
         virtual FTBBox BBox(const wchar_t *s, const int len, FTPoint, FTPoint);
 
-        virtual FTPoint Advance(const char *s, const int len,
-                                FTPoint, FTPoint);
+        virtual float Advance(const char *s, const int len, FTPoint);
 
-        virtual FTPoint Advance(const wchar_t *s, const int len,
-                                FTPoint, FTPoint);
+        virtual float Advance(const wchar_t *s, const int len, FTPoint);
 
         virtual FTPoint Render(const char *s, const int len,
                                FTPoint, FTPoint, int);
@@ -144,8 +142,7 @@ class FTFontImpl
 
         /* Internal generic Advance() implementation */
         template <typename T>
-        inline FTPoint AdvanceI(const T *s, const int len,
-                                FTPoint position, FTPoint spacing);
+        inline float AdvanceI(const T *s, const int len, FTPoint spacing);
 
         /* Internal generic Render() implementation */
         template <typename T>
diff --git a/src/FTGL/FTFont.h b/src/FTGL/FTFont.h
index 9887600..608b1a0 100644
--- a/src/FTGL/FTFont.h
+++ b/src/FTGL/FTFont.h
@@ -289,14 +289,12 @@ class FTGL_EXPORT FTFont
          * @param len  The length of the string. If < 0 then all characters
          *             will be checked until a null character is encountered
          *             (optional).
-         * @param position  The pen position of the first character (optional).
          * @param spacing  A displacement vector to add after each character
          *                 has been checked (optional).
-         * @return  The new pen position after the last character.
+         * @return  The string's advance width.
          */
-        virtual FTPoint Advance(const char* string, const int len = -1,
-                                FTPoint position = FTPoint(),
-                                FTPoint spacing = FTPoint());
+        virtual float Advance(const char* string, const int len = -1,
+                              FTPoint spacing = FTPoint());
 
         /**
          * Get the advance for a string.
@@ -305,14 +303,12 @@ class FTGL_EXPORT FTFont
          * @param len  The length of the string. If < 0 then all characters
          *             will be checked until a null character is encountered
          *             (optional).
-         * @param position  The pen position of the first character (optional).
          * @param spacing  A displacement vector to add after each character
          *                 has been checked (optional).
-         * @return  The new pen position after the last character.
+         * @return  The string's advance width.
          */
-        virtual FTPoint Advance(const wchar_t* string, const int len = -1,
-                                FTPoint position = FTPoint(),
-                                FTPoint spacing = FTPoint());
+        virtual float Advance(const wchar_t* string, const int len = -1,
+                              FTPoint spacing = FTPoint());
 
         /**
          * Render a string of characters.
diff --git a/src/FTGL/FTGlyph.h b/src/FTGL/FTGlyph.h
index bffe244..b446d96 100644
--- a/src/FTGL/FTGlyph.h
+++ b/src/FTGL/FTGlyph.h
@@ -95,7 +95,7 @@ class FTGL_EXPORT FTGlyph
          *
          * @return  advance width.
          */
-        virtual const FTPoint& Advance() const;
+        virtual float Advance() const;
 
         /**
          * Return the bounding box for this glyph.
@@ -174,13 +174,9 @@ FTGL_EXPORT void ftglRenderGlyph(FTGLglyph *glyph, FTGL_DOUBLE penx,
  * Return the advance for a glyph.
  *
  * @param glyph  An FTGLglyph* object.
- * @param advancex  A pointer to an FTGL_DOUBLE where to write the advance's X
- *                  component.
- * @param advancey  A pointer to an FTGL_DOUBLE where to write the advance's Y
- *                  component.
+ * @param return  The advance's X component.
  */
-FTGL_EXPORT void ftglGetGlyphAdvance(FTGLglyph *glyph, FTGL_DOUBLE *advancex,
-                                     FTGL_DOUBLE *advancey);
+FTGL_EXPORT float ftglGetGlyphAdvance(FTGLglyph *glyph);
 
 /**
  * Return the bounding box for a glyph.
diff --git a/src/FTGlyph/FTGlyph.cpp b/src/FTGlyph/FTGlyph.cpp
index 8c3eab7..4116ebf 100644
--- a/src/FTGlyph/FTGlyph.cpp
+++ b/src/FTGlyph/FTGlyph.cpp
@@ -54,7 +54,7 @@ FTGlyph::~FTGlyph()
 }
 
 
-const FTPoint& FTGlyph::Advance() const
+float FTGlyph::Advance() const
 {
     return impl->Advance();
 }
@@ -82,7 +82,8 @@ FTGlyphImpl::FTGlyphImpl(FT_GlyphSlot glyph, bool useList) : err(0)
     if(glyph)
     {
         bBox = FTBBox(glyph);
-        advance = FTPoint(glyph->advance.x / 64.0f, glyph->advance.y / 64.0f, 0.0f);
+        advance = FTPoint(glyph->advance.x / 64.0f,
+                          glyph->advance.y / 64.0f);
     }
 }
 
@@ -91,9 +92,9 @@ FTGlyphImpl::~FTGlyphImpl()
 {}
 
 
-const FTPoint& FTGlyphImpl::Advance() const
+float FTGlyphImpl::Advance() const
 {
-    return advance;
+    return advance.Xf();
 }
 
 
diff --git a/src/FTGlyph/FTGlyphGlue.cpp b/src/FTGlyph/FTGlyphGlue.cpp
index d377461..dddc31b 100644
--- a/src/FTGlyph/FTGlyphGlue.cpp
+++ b/src/FTGlyph/FTGlyphGlue.cpp
@@ -104,7 +104,7 @@ public:
         destroyCallback(baseGlyph, data);
     }
 
-    const FTPoint& Advance() const { return baseGlyph->ptr->Advance(); }
+    float Advance() const { return baseGlyph->ptr->Advance(); }
 
     const FTPoint& Render(const FTPoint& pen, int renderMode)
     {
@@ -175,19 +175,8 @@ void ftglRenderGlyph(FTGLglyph *g, FTGL_DOUBLE penx, FTGL_DOUBLE peny,
     *advancey = ret.Y();
 }
 
-// const FTPoint& FTGlyph::Advance() const;
-extern "C++" {
-C_FUN(static const FTPoint&, _ftglGetGlyphAdvance, (FTGLglyph *g),
-      return static_ftpoint, Advance, ());
-}
-
-void ftglGetGlyphAdvance(FTGLglyph *g, FTGL_DOUBLE *advancex,
-                         FTGL_DOUBLE *advancey)
-{
-    FTPoint ret = _ftglGetGlyphAdvance(g);
-    *advancex = ret.X();
-    *advancey = ret.Y();
-}
+// float FTGlyph::Advance() const;
+C_FUN(float, ftglGetGlyphAdvance, (FTGLglyph *g), return 0.0, Advance, ());
 
 // const FTBBox& FTGlyph::BBox() const;
 extern "C++" {
diff --git a/src/FTGlyph/FTGlyphImpl.h b/src/FTGlyph/FTGlyphImpl.h
index e25ad40..d470d0f 100644
--- a/src/FTGlyph/FTGlyphImpl.h
+++ b/src/FTGlyph/FTGlyphImpl.h
@@ -37,7 +37,7 @@ class FTGlyphImpl
 
         virtual ~FTGlyphImpl();
 
-        const FTPoint& Advance() const;
+        float Advance() const;
 
         const FTBBox& BBox() const;
 
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index b18750c..c5fc8f1 100644
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -88,13 +88,13 @@ FTBBox FTGlyphContainer::BBox(const unsigned int charCode) const
 }
 
 
-FTPoint FTGlyphContainer::Advance(const unsigned int charCode,
-                                  const unsigned int nextCharCode)
+float FTGlyphContainer::Advance(const unsigned int charCode,
+                                const unsigned int nextCharCode)
 {
     unsigned int left = charMap->FontIndex(charCode);
     unsigned int right = charMap->FontIndex(nextCharCode);
 
-    return face->KernAdvance(left, right) + Glyph(charCode)->Advance();
+    return face->KernAdvance(left, right).Xf() + Glyph(charCode)->Advance();
 }
 
 
diff --git a/src/FTGlyphContainer.h b/src/FTGlyphContainer.h
index 5e133d7..d27b69c 100644
--- a/src/FTGlyphContainer.h
+++ b/src/FTGlyphContainer.h
@@ -107,8 +107,8 @@ class FTGlyphContainer
         * @param nextCharacterCode the next glyph in a string
         * @return                  advance width
         */
-        FTPoint Advance(const unsigned int characterCode,
-                        const unsigned int nextCharacterCode);
+        float Advance(const unsigned int characterCode,
+                      const unsigned int nextCharacterCode);
 
         /**
          * Renders a character
diff --git a/src/FTLayout/FTSimpleLayout.cpp b/src/FTLayout/FTSimpleLayout.cpp
index 505c813..bcc65a6 100644
--- a/src/FTLayout/FTSimpleLayout.cpp
+++ b/src/FTLayout/FTSimpleLayout.cpp
@@ -222,7 +222,7 @@ inline void FTSimpleLayoutImpl::WrapTextI(const T *buf, const int len,
         glyphBounds = currentFont->BBox(itr.getBufferFromHere(), 1);
         glyphWidth = glyphBounds.Upper().Xf() - glyphBounds.Lower().Xf();
 
-        advance = currentFont->Advance(itr.getBufferFromHere(), 1).Xf();
+        advance = currentFont->Advance(itr.getBufferFromHere(), 1);
         prevWidth = currentWidth;
         // Compute the width of all glyphs up to the end of buf[i]
         currentWidth = nextStart + glyphWidth;
diff --git a/test/FTFont-Test.cpp b/test/FTFont-Test.cpp
index ca28b1a..1bd4333 100644
--- a/test/FTFont-Test.cpp
+++ b/test/FTFont-Test.cpp
@@ -12,10 +12,14 @@ class TestGlyph : public FTGlyph
 {
     public:
         TestGlyph(FT_GlyphSlot glyph)
-        :   FTGlyph(glyph)
+        :   FTGlyph(glyph),
+            advance(FTPoint(Advance(), 0.0))
         {}
 
-        const FTPoint& Render(const FTPoint& pen, int renderMode){ return Advance(); }
+        const FTPoint& Render(const FTPoint& pen, int renderMode){ return advance; }
+
+    private:
+        FTPoint advance;
 };
 
 
@@ -127,7 +131,7 @@ class FTFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT_DOUBLES_EQUAL(0, testFont->Descender(), 0.01);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(0, testFont->LineHeight(), 0.01);
 
-            float advance = testFont->Advance(GOOD_UNICODE_TEST_STRING).Xf();
+            float advance = testFont->Advance(GOOD_UNICODE_TEST_STRING);
             CPPUNIT_ASSERT_EQUAL(advance, 0.f);
 
             CPPUNIT_ASSERT(testFont->FaceSize(FONT_POINT_SIZE));
@@ -227,7 +231,7 @@ class FTFontTest : public CppUnit::TestCase
         {
             BadGlyphTestFont* font = new BadGlyphTestFont(GOOD_FONT_FILE);
 
-            float advance = font->Advance(GOOD_ASCII_TEST_STRING).Xf();
+            float advance = font->Advance(GOOD_ASCII_TEST_STRING);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, advance, 0.01);
         }
 
@@ -236,16 +240,16 @@ class FTFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT(testFont->FaceSize(FONT_POINT_SIZE));
             CPPUNIT_ASSERT_EQUAL(testFont->Error(), 0);
 
-            float advance = testFont->Advance(GOOD_ASCII_TEST_STRING).Xf();
+            float advance = testFont->Advance(GOOD_ASCII_TEST_STRING);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(312.10, advance, 0.01);
 
-            advance = testFont->Advance(BAD_ASCII_TEST_STRING).Xf();
+            advance = testFont->Advance(BAD_ASCII_TEST_STRING);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(0, advance, 0.01);
 
-            advance = testFont->Advance(GOOD_UNICODE_TEST_STRING).Xf();
+            advance = testFont->Advance(GOOD_UNICODE_TEST_STRING);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(144, advance, 0.01);
 
-            advance = testFont->Advance(BAD_UNICODE_TEST_STRING).Xf();
+            advance = testFont->Advance(BAD_UNICODE_TEST_STRING);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(0, advance, 0.01);
         }
 
diff --git a/test/FTGlyph-Test.cpp b/test/FTGlyph-Test.cpp
index 2fb5b6a..e916bfb 100644
--- a/test/FTGlyph-Test.cpp
+++ b/test/FTGlyph-Test.cpp
@@ -13,10 +13,14 @@ class TestGlyph : public FTGlyph
 {
     public:
         TestGlyph(FT_GlyphSlot glyph)
-        :   FTGlyph(glyph)
+        :   FTGlyph(glyph),
+            advance(FTPoint(Advance(), 0.0))
         {}
 
-        const FTPoint& Render(const FTPoint& pen, int renderMode) { return Advance(); };
+        const FTPoint& Render(const FTPoint& pen, int renderMode) { return advance; };
+
+    private:
+        FTPoint advance;
 };
 
 
@@ -37,12 +41,7 @@ class FTGlyphTest : public CppUnit::TestCase
         {
             TestGlyph testGlyph(0);
 
-            FTPoint testPoint;
-
-            CPPUNIT_ASSERT(testPoint == testGlyph.Advance());
-            CPPUNIT_ASSERT_EQUAL(testPoint.X(), testGlyph.Advance().X());
-            CPPUNIT_ASSERT_EQUAL(testPoint.Y(), testGlyph.Advance().Y());
-            CPPUNIT_ASSERT_EQUAL(testPoint.Z(), testGlyph.Advance().Z());
+            CPPUNIT_ASSERT(0.0 == testGlyph.Advance());
 
             CPPUNIT_ASSERT_DOUBLES_EQUAL(0, testGlyph.BBox().Upper().Y(), 0.01);
 
@@ -55,12 +54,9 @@ class FTGlyphTest : public CppUnit::TestCase
             setUpFreetype(CHARACTER_CODE_A);
             TestGlyph testGlyph(face->glyph);
 
-            FTPoint testPoint(47.0, 0.0, 0.0);
-            FTPoint nextPoint = testGlyph.Advance();
-            CPPUNIT_ASSERT(testPoint == nextPoint);
-            CPPUNIT_ASSERT_DOUBLES_EQUAL(testPoint.X(), nextPoint.X(), 0.0001);
-            CPPUNIT_ASSERT_DOUBLES_EQUAL(testPoint.Y(), nextPoint.Y(), 0.0001);
-            CPPUNIT_ASSERT_DOUBLES_EQUAL(testPoint.Z(), nextPoint.Z(), 0.0001);
+            float testPoint = 47.0;
+            float nextPoint = testGlyph.Advance();
+            CPPUNIT_ASSERT_DOUBLES_EQUAL(testPoint, nextPoint, 0.0001);
 
             CPPUNIT_ASSERT_DOUBLES_EQUAL(51.39, testGlyph.BBox().Upper().Y(), 0.01);
 
diff --git a/test/FTGlyphContainer-Test.cpp b/test/FTGlyphContainer-Test.cpp
index 73520b7..b840a3c 100644
--- a/test/FTGlyphContainer-Test.cpp
+++ b/test/FTGlyphContainer-Test.cpp
@@ -86,7 +86,7 @@ class FTGlyphContainerTest : public CppUnit::TestCase
             TestGlyph* glyph = new TestGlyph();
 
             glyphContainer->Add(glyph, CHARACTER_CODE_A);
-            float advance = glyphContainer->Advance(CHARACTER_CODE_A, 0).Xf();
+            float advance = glyphContainer->Advance(CHARACTER_CODE_A, 0);
 
             CPPUNIT_ASSERT_DOUBLES_EQUAL(50, advance, 0.01);
         }