Commit f8bb8b421fb1a3307477eafb5577b9d579d0e465

henry 2001-08-27T21:32:38

Changed the return type of FTFace::Glyph() from a reference to a pointer so I can return NULL on failure.

diff --git a/include/FTFace.h b/include/FTFace.h
index c909463..1c9494b 100755
--- a/include/FTFace.h
+++ b/include/FTFace.h
@@ -52,8 +52,8 @@ class	FTFace
 		 * This doesn't guarantee that the size was set correctly. Clients
 		 * should check errors.
 		 *
-		 * @params size		the face size in points (1/72 inch)
-		 * @params res		the resolution of the target device.
+		 * @param size		the face size in points (1/72 inch)
+		 * @param res		the resolution of the target device.
 		 * @return			<code>FTSize</code> object
 		 */
 		FTSize& Size( const unsigned int size, const unsigned int res);
@@ -61,7 +61,7 @@ class	FTFace
 		/**
 		 * Sets the character map for the face.
 		 *
-		 * @params encoding		XXXXXXX
+		 * @param encoding		XXXXXXX
 		 * @return				<code>true</code> if charmap was valid and
 		 *						set correctly
 		 */
@@ -70,13 +70,14 @@ class	FTFace
 		/**
 		 *	Get the glyph index of the input character.
 		 *
-		 * @param
-		 * @return
+		 * @param index The character code of the requested glyph in the
+		 *				current encoding eg apple roman.
+		 * @return		The glyph index for the character.
 		 */
 		unsigned int CharIndex( unsigned int index ) const;
 
 		/**
-		 * Gets the ferning vector between two glyphs
+		 * Gets the kerning vector between two glyphs
 		 */
 		FT_Vector& KernAdvance( unsigned int index1, unsigned int index2);
 		
@@ -84,7 +85,7 @@ class	FTFace
 		/**
 		 * Loads and creates a Freetype glyph.
 		 */
-		FT_Glyph& Glyph( unsigned int index, FT_Int load_flags);
+		FT_Glyph* Glyph( unsigned int index, FT_Int load_flags);
 
 		/**
 		 * Gets the current Freetype face.
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 24d6dea..8be3cd0 100755
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -122,18 +122,18 @@ FT_Vector& FTFace::KernAdvance( unsigned int index1, unsigned int index2 )
 }
 
 
-FT_Glyph& FTFace::Glyph( unsigned int index, FT_Int load_flags)
+FT_Glyph* FTFace::Glyph( unsigned int index, FT_Int load_flags)
 {
 	err = FT_Load_Glyph( *ftFace, index, load_flags);	
 	err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
 		
 	if( !err)
 	{
-		return ftGlyph;
+		return &ftGlyph;
 	}
 	else
 	{
-		return NULL; // FIXME
+		return NULL;
 	}
 }
 
diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index 82116fe..53d3cca 100755
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -20,10 +20,10 @@ bool FTGLBitmapFont::MakeGlyphList()
 //	if( preCache)
 	for( unsigned int c = 0; c < numGlyphs; ++c)
 	{
-		FT_Glyph ftGlyph = face.Glyph( c, FT_LOAD_DEFAULT);
+		FT_Glyph* ftGlyph = face.Glyph( c, FT_LOAD_DEFAULT);
 //		FT_HAS_VERTICAL(face)
 
-		tempGlyph = new FTBitmapGlyph( ftGlyph, c);
+		tempGlyph = new FTBitmapGlyph( *ftGlyph, c);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index bc05bf2..8466e43 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -19,9 +19,9 @@ bool FTGLOutlineFont::MakeGlyphList()
 {
 	for( unsigned int n = 0; n < numGlyphs; ++n)
 	{
-		FT_Glyph ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
+		FT_Glyph* ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
 		
-		tempGlyph = new FTVectorGlyph( ftGlyph, n);
+		tempGlyph = new FTVectorGlyph( *ftGlyph, n);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index 2880c0c..19aa5de 100755
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -20,10 +20,10 @@ bool FTGLPixmapFont::MakeGlyphList()
 //	if( preCache)
 	for( unsigned int c = 0; c < numGlyphs; ++c)
 	{
-		FT_Glyph ftGlyph = face.Glyph( c, FT_LOAD_DEFAULT);
+		FT_Glyph* ftGlyph = face.Glyph( c, FT_LOAD_DEFAULT);
 //		FT_HAS_VERTICAL(face)
 
-		tempGlyph = new FTPixmapGlyph( ftGlyph, c);
+		tempGlyph = new FTPixmapGlyph( *ftGlyph, c);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index de574f2..54df152 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -18,9 +18,9 @@ bool FTGLPolygonFont::MakeGlyphList()
 {
 	for( unsigned int n = 0; n < numGlyphs; ++n)
 	{
-		FT_Glyph ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
+		FT_Glyph* ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
 		
-		tempGlyph = new FTPolyGlyph( ftGlyph, n);
+		tempGlyph = new FTPolyGlyph( *ftGlyph, n);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index 2ec77bf..d191db1 100755
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -115,13 +115,13 @@ unsigned int FTGLTextureFont::FillGlyphs( unsigned int glyphStart, int id, int w
 	
 	for( n = glyphStart; n <= numGlyphs; ++n)
 	{
-		FT_Glyph ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING);
+		FT_Glyph* ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING);
 		
 		unsigned char* data = textdata + (( currentTextY * width) + currentTextX);
 		
 		currTextU = (float)currentTextX / (float)width;
 		
-		tempGlyph = new FTTextureGlyph( ftGlyph, n, id, data, width, height, currTextU, currTextV);
+		tempGlyph = new FTTextureGlyph( *ftGlyph, n, id, data, width, height, currTextU, currTextV);
 		glyphList->Add( tempGlyph);
 		
 		currentTextX += glyphWidth;