Error handling in Attach
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
diff --git a/include/FTFont.h b/include/FTFont.h
index 917f0aa..a13cb9e 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -58,7 +58,7 @@ class FTGL_EXPORT FTFont
bool Open( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
/**
- * Attach auxilliary file to font (e.g., font metrics).
+ * Attach auxilliary file to font (e.g. font metrics).
*
* @param filename auxilliary font file name.
*
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index 1b2059d..14af89e 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -44,7 +44,7 @@ bool FTFont::Open( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
{
FT_Face* ftFace = face.Face();
numGlyphs = (*ftFace)->num_glyphs;
-
+ err = 0;
return true;
}
else
@@ -57,7 +57,16 @@ bool FTFont::Open( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
bool FTFont::Attach( const char* filename)
{
- return face.Attach( filename);
+ if( face.Attach( filename))
+ {
+ err = 0;
+ return true;
+ }
+ else
+ {
+ err = face.Error();
+ return false;
+ }
}