Index: trunk/src/lib/graphics/text_engine/text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text.cc	(revision 7431)
+++ trunk/src/lib/graphics/text_engine/text.cc	(revision 7448)
@@ -96,5 +96,5 @@
 
   // setting up the Text-Width if DYNAMIC
-//  if (this->type & TEXT_RENDER_DYNAMIC && this->getAlignment() != TEXT_ALIGN_LEFT && this->font != NULL)
+  //  if (this->type & TEXT_RENDER_DYNAMIC && this->getAlignment() != TEXT_ALIGN_LEFT && this->font != NULL)
   const Font* calcSizeFont = this->font;
   if (calcSizeFont != NULL || (calcSizeFont = Font::getDefaultFont()) != NULL)
@@ -122,4 +122,6 @@
 void Text::draw() const
 {
+  if (unlikely(this->text.empty()))
+    return;
   glPushMatrix();
   // transform for alignment.
@@ -135,50 +137,34 @@
   glEnable(GL_TEXTURE_2D);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE);
-
   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE );
 
-  Glyph** glyphArray;
-  if (likely (this->font != NULL))
-  {
-    glyphArray = this->font->getGlyphArray();
-    glBindTexture(GL_TEXTURE_2D, font->getTexture());
-  }
-  else
-  {
-    if (unlikely(Font::getDefaultFont() == NULL))
-      Font::initDefaultFont();
-    glyphArray = Font::getDefaultFont()->getGlyphArray();
-    glBindTexture(GL_TEXTURE_2D, Font::getDefaultFont()->getTexture());
-  }
-  if (likely(!this->text.empty()))
-  {
-    glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0);
-    glRotatef(this->getAbsDir2D(), 0, 0, 1);
-    Glyph* tmpGlyph;
-    float posX = 0.0f;
-
-    glBegin(GL_QUADS);
-    for (unsigned int i = 0; i < this->text.size(); i++)
+  Glyph** glyphArray = this->font->getGlyphArray();
+  glBindTexture(GL_TEXTURE_2D, font->getTexture());
+  glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0);
+  glRotatef(this->getAbsDir2D(), 0, 0, 1);
+
+  Glyph* tmpGlyph;
+  float posX = 0.0f;
+  glBegin(GL_QUADS);
+  for (unsigned int i = 0; i < this->text.size(); i++)
+  {
+    if(likely((tmpGlyph = glyphArray[this->text[i]]) != NULL))
     {
-      if(likely((tmpGlyph = glyphArray[this->text[i]]) != NULL))
-      {
-        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
-        glVertex2d(posX+tmpGlyph->maxX*this->getSizeY2D(), 0);
-
-        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
-        glVertex2d(posX+tmpGlyph->maxX*this->getSizeY2D(), this->getSizeY2D());
-
-        glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
-        glVertex2d(posX+tmpGlyph->minX*this->getSizeY2D(), this->getSizeY2D());
-
-        glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
-        glVertex2d(posX+tmpGlyph->minX*this->getSizeY2D(), 0);
-
-        posX += tmpGlyph->advance * this->getSizeY2D();
-      }
+      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
+      glVertex2d(posX+tmpGlyph->maxX*this->getSizeY2D(), 0);
+
+      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
+      glVertex2d(posX+tmpGlyph->maxX*this->getSizeY2D(), this->getSizeY2D());
+
+      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
+      glVertex2d(posX+tmpGlyph->minX*this->getSizeY2D(), this->getSizeY2D());
+
+      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
+      glVertex2d(posX+tmpGlyph->minX*this->getSizeY2D(), 0);
+
+      posX += tmpGlyph->advance * this->getSizeY2D();
     }
-    glEnd();
-  }
-
+  }
+  glEnd();
   glPopMatrix();
 }
@@ -231,5 +217,5 @@
                                0xFF000000
 #else
-                                   0xFF000000,
+                               0xFF000000,
                                0x00FF0000,
                                0x0000FF00,
@@ -237,5 +223,6 @@
 #endif
                               );
-  if ( image == NULL ) {
+  if ( image == NULL )
+  {
     return 0;
   }
@@ -244,5 +231,6 @@
   saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
   saved_alpha = surface->format->alpha;
-  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
+  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA )
+  {
     SDL_SetAlpha(surface, 0, 0);
   }
@@ -256,5 +244,6 @@
 
   /* Restore the alpha blending attributes */
-  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
+  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA )
+  {
     SDL_SetAlpha(surface, saved_flags, saved_alpha);
   }
