Commit 5de43fe69d84dea3bb78ea0e486ee55df91e7d17

sammy 2008-05-22T15:31:32

* Empty the FTBufferFont cache when changing the face size.

diff --git a/src/FTFont/FTBufferFont.cpp b/src/FTFont/FTBufferFont.cpp
index 2d7a75f..29e3058 100644
--- a/src/FTFont/FTBufferFont.cpp
+++ b/src/FTFont/FTBufferFont.cpp
@@ -134,6 +134,22 @@ FTGlyph* FTBufferFontImpl::MakeGlyphImpl(FT_GlyphSlot ftGlyph)
 }
 
 
+bool FTBufferFontImpl::FaceSize(const unsigned int size,
+                                const unsigned int res)
+{
+    for(int i = 0; i < BUFFER_CACHE_SIZE; i++)
+    {
+        if(stringCache[i])
+        {
+            free(stringCache[i]);
+            stringCache[i] = NULL;
+        }
+    }
+
+    return FTFontImpl::FaceSize(size, res);
+}
+
+
 static inline GLuint NextPowerOf2(GLuint in)
 {
      in -= 1;
diff --git a/src/FTFont/FTBufferFontImpl.h b/src/FTFont/FTBufferFontImpl.h
index 1c39ec0..15557f6 100644
--- a/src/FTFont/FTBufferFontImpl.h
+++ b/src/FTFont/FTBufferFontImpl.h
@@ -51,6 +51,9 @@ class FTBufferFontImpl : public FTFontImpl
                                FTPoint position, FTPoint spacing,
                                int renderMode);
 
+        virtual bool FaceSize(const unsigned int size,
+                              const unsigned int res);
+
     private:
         /**
          * Create an FTBufferGlyph object for the base class.