Updated to reflect changes in FTFace & FTGlyphContainer
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 75 76 77 78 79 80 81 82
diff --git a/include/FTFont.h b/include/FTFont.h
index 55d96ce..c2ab3e8 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -25,13 +25,15 @@ class FTFont
virtual bool Open( const char* fontname );
virtual void Close();
virtual bool FaceSize( const int size, const int res = 72 );
- virtual bool CharMap( CHARMAP encoding );
+ virtual bool CharMap( FT_Encoding encoding );
virtual int Ascender() const;
virtual int Descender() const;
virtual void BBox( const char* text, int& llx, int& lly, int& urx, int& ury ) const;
virtual void render( const char* string );
virtual FT_Error Error() const { return err;}
+// virtual const char* ErrorString();
+
// attributes
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index fbad1f7..00067a2 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -22,14 +22,9 @@ FTFont::~FTFont()
bool FTFont::Open( const char* fontname )
{
- //FIXME first check map to see if it's already open.
-// FTFace face; // When we have a list of faces
-
if( face.Open( fontname))
{
-// faceList.insert( FaceMap::value_type( string( fontname), face));
- FT_Face* ftFace = face.Face();
-
+ FT_Face* ftFace = face.Face();
numGlyphs = (*ftFace)->num_glyphs;
return true;
@@ -56,7 +51,7 @@ bool FTFont::FaceSize( const int size, const int res )
if( glyphList)
delete glyphList;
- glyphList = new FTGlyphContainer( face.Face(), numGlyphs);
+ glyphList = new FTGlyphContainer( &face, numGlyphs);
if( MakeGlyphList())
{
@@ -69,10 +64,10 @@ bool FTFont::FaceSize( const int size, const int res )
}
-bool FTFont::CharMap( CHARMAP encoding)
+bool FTFont::CharMap( FT_Encoding encoding)
{
- face.CharMap( encoding);
- return false; // for the moment seeing as this doesn't do anything!!!
+ err = face.CharMap( encoding);
+ return !err;
}
@@ -112,3 +107,17 @@ void FTFont::render( const char* string )
++c;
}
}
+
+
+//const char* FTFont::ErrorString()
+// {
+// static char ukn[1024];
+//
+// for (uint32 i = 0; ft_errors[i].err_code != 0 || ft_errors[i].err_msg != 0; i++)
+// {
+// if (ft_errors[i].err_code == fte)
+// return ft_errors[i].err_msg;
+// }
+// smprintf (ukn, 1024, "Unknown freetype2 error, errcode: 0x%x", fte);
+// return ukn;
+// }