Added a test to bail early of the client sets the size to the existing size. Removed the pixels per em function because no one is using them.
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
diff --git a/src/FTSize.cpp b/src/FTSize.cpp
index 5fb8ffb..07a5b83 100755
--- a/src/FTSize.cpp
+++ b/src/FTSize.cpp
@@ -5,6 +5,8 @@ FTSize::FTSize()
: ftFace(0),
ftSize(0),
size(0),
+ xResolution(0),
+ yResolution(0),
err(0)
{}
@@ -13,21 +15,28 @@ FTSize::~FTSize()
{}
-bool FTSize::CharSize( FT_Face* face, unsigned int point_size, unsigned int x_resolution, unsigned int y_resolution )
+bool FTSize::CharSize( FT_Face* face, unsigned int pointSize, unsigned int xRes, unsigned int yRes )
{
- err = FT_Set_Char_Size( *face, 0L, point_size * 64, x_resolution, y_resolution);
-
- if( !err)
+ if( size != pointSize || xResolution != xRes || yResolution != yRes)
{
- ftFace = face;
- size = point_size;
- ftSize = (*ftFace)->size;
- }
- else
- {
- ftFace = 0;
- size = 0;
- ftSize = 0;
+ err = FT_Set_Char_Size( *face, 0L, pointSize * 64, xResolution, yResolution);
+
+ if( !err)
+ {
+ ftFace = face;
+ size = pointSize;
+ xResolution = xRes;
+ yResolution = yRes;
+ ftSize = (*ftFace)->size;
+ }
+ else
+ {
+ ftFace = 0;
+ size = 0;
+ xResolution = 0;
+ yResolution = 0;
+ ftSize = 0;
+ }
}
return !err;
@@ -93,13 +102,3 @@ float FTSize::Underline() const
return 0.0f;
}
-unsigned int FTSize::XPixelsPerEm() const
-{
- return ftSize == 0 ? 0 : ftSize->metrics.x_ppem;
-}
-
-unsigned int FTSize::YPixelsPerEm() const
-{
- return ftSize == 0 ? 0 : ftSize->metrics.y_ppem;
-}
-