Commit ce37d790dbc6d87fba8813d084a0dc413e1447a9

henry 2004-09-29T23:06:42

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.

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;
-}
-