Changed behaviour so that if an errror occurs the object isn't modified. (strong guarantee).
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 70 71 72 73 74
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;