Minor tidy ups and fixed a couple of compiler warnings
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
diff --git a/include/FTFont.h b/include/FTFont.h
index 1d6fc27..3a0c703 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -8,10 +8,9 @@
#include "FTFace.h"
-//#include "FTGL.h"
+#include "FTGL.h"
-//class FTGlyph;
class FTGlyphContainer;
using namespace std;
@@ -27,12 +26,10 @@ class FTFont
virtual void Close();
virtual bool FaceSize( const int size, const int res = 72 );
virtual bool CharMap( CHARMAP encoding );
-// virtual FTGlyph* Glyph( unsigned char code );
-// virtual FTGlyph* Glyph( unsigned char thisCode, unsigned char nextCode );
virtual int Ascender() const;
virtual int Descender() const;
- virtual void BBox( const char* text, int& llx, int& lly, int& urx, int& ury ) const;
- virtual bool render( const char* string );
+ 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;}
@@ -45,11 +42,11 @@ class FTFont
// attributes
FT_Error err;
- // list of faces
+ // future list of faces
FTFace face;
int numFaces;
- // list of sizes
+ // future list of sizes
FTSize charSize;
int numGlyphs;
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index 59cce82..6eeb0df 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -1,12 +1,9 @@
#include "FTFace.h"
#include "FTFont.h"
#include "FTGlyphContainer.h"
-//#include "FTGL.h"
+#include "FTGL.h"
-
-
-// OPSignature: FTFont:FTFont()
FTFont::FTFont()
: fontName(0),
numFaces(0),
@@ -17,16 +14,10 @@ FTFont::FTFont()
}
-// OPSignature: FTFont:~FTFont()
FTFont::~FTFont()
-{
-//Insert your own code here.
+{}
-//End of user code.
-}
-
-// OPSignature: bool FTFont:Open( const char*:fontname )
bool FTFont::Open( const char* fontname )
{
//FIXME first check map to see if it's already open.
@@ -45,21 +36,16 @@ bool FTFont::Open( const char* fontname )
{
return false;
}
-
-
}
-// OPSignature: void FTFont:Close()
void FTFont::Close()
{
face.Close();
delete glyphList;
-
}
-// OPSignature: bool FTFont:SetFaceSize( const int:size const int:res )
bool FTFont::FaceSize( const int size, const int res )
{
charSize = face.Size( size, res);
@@ -71,14 +57,13 @@ bool FTFont::FaceSize( const int size, const int res )
MakeGlyphList();
-
return true;
}
+
bool FTFont::CharMap( CHARMAP encoding)
{
face.CharMap( encoding);
-// assert( face);
//FIXME
if( glyphList)
@@ -86,33 +71,29 @@ bool FTFont::CharMap( CHARMAP encoding)
glyphList = new FTGlyphContainer( face.Face(), numGlyphs);
- MakeGlyphList();
+ if( MakeGlyphList())
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
-//FTGlyph* FTFont::Glyph( unsigned char code )
-//{}
-//
-//
-//FTGlyph* FTFont::Glyph( unsigned char thisCode, unsigned char nextCode )
-//{}
-
-
-// OPSignature: int FTFont:getAscender()
int FTFont::Ascender() const
{
return charSize.Ascender();
}
-// OPSignature: int FTFont:getDescender()
int FTFont::Descender() const
{
return charSize.Descender();
}
-// OPSignature: void FTFont:getBBox( const char*:text int&:llx int&:lly int&:urx int&:ury )
void FTFont::BBox( const char* text, int& llx, int& lly, int& urx, int& ury ) const
{
//Insert your own code here.
@@ -121,10 +102,9 @@ void FTFont::BBox( const char* text, int& llx, int& lly, int& urx, int& ury ) co
}
-// OPSignature: bool FTFont:render( const char*:string )
-bool FTFont::render( const char* string )
+void FTFont::render( const char* string )
{
- char* c = string;
+ const char* c = string;
FT_Vector kernAdvance;
pen.x = 0; pen.y = 0;