* Empty the FTBufferFont cache when changing the face size.
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
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.