Commit de2532f408856763b3d3013e5eea0d2d81740f46

henry 2001-08-08T01:33:03

Changes to the way charmaps are handled

diff --git a/include/FTFont.h b/include/FTFont.h
index 898384d..55d96ce 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -49,8 +49,6 @@ class	FTFont
 		// future list of sizes
 		FTSize charSize;
 
-//		string fontName;
-		
 		int numGlyphs;
 		FTGlyphContainer*	glyphList;
 		
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index de31df1..fbad1f7 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -72,21 +72,7 @@ bool FTFont::FaceSize( const int size, const int res )
 bool FTFont::CharMap( CHARMAP encoding)
 {
 	face.CharMap( encoding);
-
-	//FIXME
-	if( glyphList)
-		delete glyphList;
-		
-	glyphList = new FTGlyphContainer( face.Face(), numGlyphs);
-	
-	if( MakeGlyphList())
-	{
-		return true;
-	}
-	else
-	{
-		return false;
-	}
+	return false; // for the moment seeing as this doesn't do anything!!!
 }
 
 
diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index 51e1ee9..68210a3 100755
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -20,23 +20,19 @@ bool FTGLBitmapFont::MakeGlyphList()
 //	if( preCache)
 
 	FT_Face* ftFace = face.Face();
-	long glyphIndex;
 	
-	numGlyphs = 256; // FIXME hack
+//	numGlyphs = 256; // FIXME hack
 	
 	for( int c = 0; c < numGlyphs; ++c)
 	{
-		glyphIndex = FT_Get_Char_Index( *ftFace, c );
-		
-		err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+		err = FT_Load_Glyph( *ftFace, c, FT_LOAD_DEFAULT);
 		FT_Glyph ftGlyph;
 		
 		err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
 
 //		FT_HAS_VERTICAL(face)
 
-		tempGlyph = new FTBitmapGlyph( ftGlyph, glyphIndex);
+		tempGlyph = new FTBitmapGlyph( ftGlyph, c);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index 3afe9e5..0831849 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -18,23 +18,19 @@ FTGLOutlineFont::~FTGLOutlineFont()
 
 bool FTGLOutlineFont::MakeGlyphList()
 {
-	int glyphIndex;
+//	int glyphIndex;
+	FT_Face* ftFace = face.Face();
 	
 	numGlyphs = 127; // FIXME hack
 	
 	for( int n = 0; n < numGlyphs; ++n)
 	{
-		FT_Face* ftFace = face.Face();
-
-		glyphIndex = FT_Get_Char_Index( *ftFace, n);
-		
-		err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+		err = FT_Load_Glyph( *ftFace, n, FT_LOAD_DEFAULT);
 		FT_Glyph ftGlyph;
 		
 		err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
 		
-		tempGlyph = new FTVectorGlyph( ftGlyph, glyphIndex);
+		tempGlyph = new FTVectorGlyph( ftGlyph, n);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index e222b8c..8364304 100755
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -18,25 +18,20 @@ FTGLPixmapFont::~FTGLPixmapFont()
 bool FTGLPixmapFont::MakeGlyphList()
 {
 //	if( preCache)
-
 	FT_Face* ftFace = face.Face();
-	long glyphIndex;
 	
-	numGlyphs = 256; // FIXME hack
+//	numGlyphs = 256; // FIXME hack
 	
 	for( int c = 0; c < numGlyphs; ++c)
 	{
-		glyphIndex = FT_Get_Char_Index( *ftFace, c );
-		
-		err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+		err = FT_Load_Glyph( *ftFace, c, FT_LOAD_DEFAULT);
 		FT_Glyph ftGlyph;
 		
 		err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
 
 //		FT_HAS_VERTICAL(face)
 
-		tempGlyph = new FTPixmapGlyph( ftGlyph, glyphIndex);
+		tempGlyph = new FTPixmapGlyph( ftGlyph, c);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index f4459c0..0b76401 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -17,21 +17,17 @@ FTGLPolygonFont::~FTGLPolygonFont()
 bool FTGLPolygonFont::MakeGlyphList()
 {
 	FT_Face* ftFace = face.Face();
-	int glyphIndex;
 	
 	numGlyphs = 127; // FIXME hack
 	
 	for( int n = 0; n < numGlyphs; ++n)
 	{
-		glyphIndex = FT_Get_Char_Index( *ftFace, n);
-		
-		err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+		err = FT_Load_Glyph( *ftFace, n, FT_LOAD_DEFAULT);
 		FT_Glyph ftGlyph;
 		
 		err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
 		
-		tempGlyph = new FTPolyGlyph( ftGlyph, glyphIndex);
+		tempGlyph = new FTPolyGlyph( ftGlyph, n);
 		glyphList->Add( tempGlyph);
 	}
 	
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index ccc4f8f..3dd6d64 100755
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -35,16 +35,19 @@ FT_Vector& FTGlyphContainer::render( int index, int next, FT_Vector pen)
 {
 	kernAdvance.x = 0; kernAdvance.y = 0;
 	
-	if( index > glyphs.size())
+	int left = FT_Get_Char_Index( *face, index);
+	int right = FT_Get_Char_Index( *face, next);
+	
+	if( left > glyphs.size())
 		return kernAdvance;
 	
-	if( 0 < next <=  glyphs.size())
+	if( 0 < right <=  glyphs.size())
 	{
 		// ft_kerning_unfitted
-		err = FT_Get_Kerning( *face, glyphs[index]->glyphIndex, glyphs[next]->glyphIndex, ft_kerning_default, &kernAdvance);
+		err = FT_Get_Kerning( *face, left, right, ft_kerning_default, &kernAdvance);
 	}
 	
-	advance = glyphs[index]->Render( pen);
+	advance = glyphs[left]->Render( pen);
 	
 	kernAdvance.x = advance + kernAdvance.x;
 //	kernAdvance.y = advance.y + kernAdvance.y;