Commit 5760ea260cd269b785761dd9ccdc5ca3205cb6b2

henry 2004-12-12T10:01:50

Changed behaviour so that if an errror occurs the object isn't modified. (strong guarantee).

diff --git a/include/FTCharmap.h b/include/FTCharmap.h
index 74ca6f2..092e677 100644
--- a/include/FTCharmap.h
+++ b/include/FTCharmap.h
@@ -47,7 +47,7 @@ class FTGL_EXPORT FTCharmap
         FT_Encoding Encoding() const { return ftEncoding;}
         
         /**
-         * Sets the character map for the face.
+         * Sets the character map for the face. If an error occurs the object is not modified.
          * Valid encodings as at Freetype 2.0.4
          *      ft_encoding_none
          *      ft_encoding_symbol
@@ -65,8 +65,7 @@ class FTGL_EXPORT FTCharmap
          *
          * @param encoding  the Freetype encoding symbol. See above.
          * @return          <code>true</code> if charmap was valid and set
-         *                  correctly. If the requested encoding is
-         *                  unavailable it will be set to ft_encoding_none.
+         *                  correctly.
          */
         bool CharMap( FT_Encoding encoding);
         
diff --git a/include/FTSize.h b/include/FTSize.h
index d18d70e..619db9d 100755
--- a/include/FTSize.h
+++ b/include/FTSize.h
@@ -32,7 +32,7 @@ class FTGL_EXPORT FTSize
          * Sets the char size for the current face.
          *
          * This doesn't guarantee that the size was set correctly. Clients
-         * should check errors.
+         * should check errors. If an error does occur the size object isn't modified.
          *
          * @param face           Parent face for this size object
          * @param point_size     the face size in points (1/72 inch)
diff --git a/src/FTCharmap.cpp b/src/FTCharmap.cpp
index f2400ee..87b2f23 100644
--- a/src/FTCharmap.cpp
+++ b/src/FTCharmap.cpp
@@ -33,13 +33,9 @@ bool FTCharmap::CharMap( FT_Encoding encoding)
     if( !err)
     {
         ftEncoding = encoding;
-    }
-    else
-    {
-        ftEncoding = ft_encoding_none;
+        charMap.clear();
     }
         
-    charMap.clear();
     return !err;
 }
 
diff --git a/src/FTSize.cpp b/src/FTSize.cpp
index 07a5b83..4259b69 100755
--- a/src/FTSize.cpp
+++ b/src/FTSize.cpp
@@ -29,14 +29,6 @@ bool FTSize::CharSize( FT_Face* face, unsigned int pointSize, unsigned int xRes,
             yResolution = yRes;
             ftSize = (*ftFace)->size;
         }
-        else
-        {
-            ftFace = 0;
-            size = 0;
-            xResolution = 0;
-            yResolution = 0;
-            ftSize = 0;
-        }
     }
     
     return !err;