Commit 8e8eb8daf940d4d2b79682da452dbb8ca39a234d

henry 2002-12-12T21:47:14

Added CheckGlyph function

diff --git a/include/FTFont.h b/include/FTFont.h
index 826e8a3..c135ea6 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -249,6 +249,11 @@ class FTGL_EXPORT FTFont
          * @param nextChr   next character
          */
         inline void doRender( const unsigned int chr, const unsigned int nextChr);
+        
+        /**
+         *
+         */
+        inline void CheckGlyph( const unsigned int chr);
 
 };
 
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index 06af6e9..0f5d142 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -130,12 +130,8 @@ void FTFont::BBox( const char* string,
  
     while( *c)
     {
-        if( !glyphList->Glyph( static_cast<unsigned int>(*c)))
-        {
-            unsigned int g = face.CharIndex( static_cast<unsigned int>(*c));
-            glyphList->Add( MakeGlyph( g), g);
-        }
-        
+        CheckGlyph( *c);
+
         bbox = glyphList->BBox( *c);
         
         // Lower extent
@@ -172,12 +168,8 @@ void FTFont::BBox( const wchar_t* string,
  
     while( *c)
     {
-        if( !glyphList->Glyph( static_cast<unsigned int>(*c)))
-        {
-            unsigned int g = face.CharIndex( static_cast<unsigned int>(*c));
-            glyphList->Add( MakeGlyph( g), g);
-        }
-        
+        CheckGlyph( *c);
+
         bbox = glyphList->BBox( *c);
         
         // Lower extent
@@ -232,11 +224,7 @@ float FTFont::Advance( const char* string)
 
 float FTFont::doAdvance( const unsigned int chr, const unsigned int nextChr)
 {
-    if( !glyphList->Glyph( chr))
-    {
-        unsigned int g = face.CharIndex( chr);
-        glyphList->Add( MakeGlyph( g), g);
-    }
+    CheckGlyph( chr);
 
     return glyphList->Advance( chr, nextChr);
 }
@@ -270,11 +258,7 @@ void FTFont::render( const wchar_t* string )
 
 void FTFont::doRender( const unsigned int chr, const unsigned int nextChr)
 {
-    if( !glyphList->Glyph( chr))
-    {
-        unsigned int g = face.CharIndex( chr);
-        glyphList->Add( MakeGlyph( g), g);
-    }
+    CheckGlyph( chr);
 
     FTPoint kernAdvance = glyphList->render( chr, nextChr, pen);
     
@@ -282,3 +266,13 @@ void FTFont::doRender( const unsigned int chr, const unsigned int nextChr)
     pen.y += kernAdvance.y;
 }
 
+
+void FTFont::CheckGlyph( const unsigned int chr)
+{
+    if( !glyphList->Glyph( chr))
+    {
+        unsigned int g = face.CharIndex( chr);
+        glyphList->Add( MakeGlyph( g), g);
+    }
+}
+