Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 5767)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 5768)
@@ -66,13 +66,13 @@
     {
       if (this->image != NULL)
-	{
-	  SDL_FreeSurface(this->image);
-	  this->image = NULL;
-	}
+        {
+          SDL_FreeSurface(this->image);
+          this->image = NULL;
+        }
       if (this->texture != 0)
-	{
-	  glDeleteTextures(1, &this->texture);
-	  this->texture = 0;
-	}
+        {
+          glDeleteTextures(1, &this->texture);
+          this->texture = 0;
+        }
       if (imageName != NULL)
         {
@@ -85,6 +85,6 @@
           {
             PRINTF(4)("loading Image %s\n", imageName);
-	    this->image = this->prepareSurface(tmpSurf);
-            this->texture = loadTexToGL(this->image);
+            if (this->prepareSurface(tmpSurf))
+              loadTexToGL();
             SDL_FreeSurface(tmpSurf);
             return true;
@@ -99,5 +99,5 @@
       else
         {
-	  PRINTF(2)("Image-Name not specified\n");
+          PRINTF(2)("Image-Name not specified\n");
           return false;
         }
@@ -117,7 +117,7 @@
     {
       PRINTF(4)("Reloading Texture %s\n", this->getName());
-      this->texture = this->loadTexToGL(this->image);
+      this->loadTexToGL();
     }
-  
+
 }
 
@@ -127,31 +127,34 @@
  * @returns a !!new!! Surface, that is loadable by openGL.
  */
-SDL_Surface* Texture::prepareSurface(SDL_Surface* surface)
+bool Texture::prepareSurface(SDL_Surface* surface)
 {
   PRINTF(4)("Loading texture to OpenGL-Environment.\n");
-  
-  SDL_Surface *image;
+
+  SDL_Surface* putSurface;
   SDL_Rect area;
   Uint32 saved_flags;
   Uint8  saved_alpha;
-  
-  image = SDL_CreateRGBSurface(SDL_SWSURFACE,
-			       surface->w, surface->h,
-			       32,
+
+  putSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
+                               surface->w, surface->h,
+                               32,
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
-			       0x000000FF,
-			       0x0000FF00,
-			       0x00FF0000,
-			       0xFF000000
+                               0x000000FF,
+                               0x0000FF00,
+                               0x00FF0000,
+                               0xFF000000
 #else
-			       0xFF000000,
-			       0x00FF0000,
-			       0x0000FF00,
-			       0x000000FF
+                               0xFF000000,
+                               0x00FF0000,
+                               0x0000FF00,
+                               0x000000FF
 #endif
-			       );
-  if ( image == NULL )
-    return NULL;
-  
+                               );
+  if ( putSurface == NULL )
+  {
+    this->setSurface(NULL);
+    return false;
+  }
+
   /* Save the alpha blending attributes */
   saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
@@ -160,5 +163,5 @@
     SDL_SetAlpha(surface, 0, 0);
   }
-  
+
   /* Copy the surface into the GL texture image */
   area.x = 0;
@@ -166,13 +169,24 @@
   area.w = surface->w;
   area.h = surface->h;
-  SDL_BlitSurface(surface, &area, image, &area);
-  
+  SDL_BlitSurface(surface, &area, putSurface, &area);
+
   /* Restore the alpha blending attributes */
-  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) 
-    {
-      SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha);
-      this->bAlpha = true;
-    }
-  return image;
+  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA )
+  {
+    SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha);
+    this->bAlpha = true;
+  }
+
+  return (this->setSurface(putSurface));
+}
+
+bool Texture::setSurface(SDL_Surface* newSurface)
+{
+  if (this->image != NULL)
+    SDL_FreeSurface(this->image);
+
+  this->image = newSurface;
+
+  return (this->image != NULL);
 }
 
@@ -183,30 +197,36 @@
  * @returns The ID of the texture.
  */
-GLuint Texture::loadTexToGL (SDL_Surface* surface) const
-{
-  GLuint texture = 0;
+GLuint Texture::loadTexToGL ()
+{
+  if (this->texture != 0 && glIsTexture(this->texture))
+    glDeleteTextures(1, &this->texture);
+  this->texture = 0;
+
+  if (this->image == NULL)
+    return 0;
+
   /* Create an OpenGL texture for the image */
-  glGenTextures(1, &texture);
-  glBindTexture(GL_TEXTURE_2D, texture);
+  glGenTextures(1, &this->texture);
+  glBindTexture(GL_TEXTURE_2D, this->texture);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
   // build the Texture
   glTexImage2D(GL_TEXTURE_2D,
-	       0,
-	       GL_RGBA,
-	       surface->w, surface->h,
-	       0,
-	       GL_RGBA,
-	       GL_UNSIGNED_BYTE,
-	       surface->pixels);
+               0,
+               GL_RGBA,
+               this->image->w, this->image->h,
+               0,
+               GL_RGBA,
+               GL_UNSIGNED_BYTE,
+               this->image->pixels);
   // build the MipMaps
   gluBuild2DMipmaps(GL_TEXTURE_2D,
-		    GL_RGBA,
-		    surface->w,
-		    surface->h,
-		    GL_RGBA,
-		    GL_UNSIGNED_BYTE,
-		    surface->pixels);
+                    GL_RGBA,
+                    this->image->w,
+                    this->image->h,
+                    GL_RGBA,
+                    GL_UNSIGNED_BYTE,
+                    this->image->pixels);
   glBindTexture(GL_TEXTURE_2D, 0);
-  return texture;
-}
+  return this->texture;
+}
Index: trunk/src/lib/graphics/importer/texture.h
===================================================================
--- trunk/src/lib/graphics/importer/texture.h	(revision 5767)
+++ trunk/src/lib/graphics/importer/texture.h	(revision 5768)
@@ -1,48 +1,48 @@
 /*!
-  \file texture.h
-  \brief Contains the texture class, that handles the reading of Images into Texutre-files.
-
-  @todo procedural textures
-*/
+ * @file texture.h
+ * @brief Contains the texture class, that handles the reading of Images into Texutre-files.
+ */
 
 #ifndef _TEXTURE_H
 #define _TEXTURE_H
 
-#include "glincl.h"
 #include "base_object.h"
 
-#include "debug.h"
+#include "glincl.h"
 
+/* Forward Declaration */
 struct SDL_Surface;
 
 //! an enumerator for different procedural texture-types
 typedef enum TEXTURE_TYPE { TEXTURE_RADIAL_ALIAS,
-                            TEXTURE_NOISE };
+  TEXTURE_NOISE };
 
 //! A Class, that reads in Textures from different fileformats.
-class Texture : public BaseObject
-{
- public:
-  Texture(const char* imageName = NULL);
+  class Texture : public BaseObject
+  {
+    public:
+      Texture(const char* imageName = NULL);
   //  Texture(TEXTURE_TYPE type, int resolution);
-  ~Texture();
+      ~Texture();
 
-  bool loadImage(const char* imageName);
-  bool rebuild();
+      bool loadImage(const char* imageName);
+      bool rebuild();
 
-  /** @returns The textureID of this texture.  */
-  inline GLuint getTexture() const { return this->texture; };
-  /** @returns true if texture has alpha, false otherwise */
-  inline bool hasAlpha() const {return bAlpha;}
+      /** @returns The textureID of this texture.  */
+      inline GLuint getTexture() const { return this->texture; };
+      /** @returns true if texture has alpha, false otherwise */
+      inline bool hasAlpha() const {return bAlpha;}
 
- private:
-  SDL_Surface* prepareSurface(SDL_Surface* input);
-  GLuint loadTexToGL (SDL_Surface* surface) const;
+    protected:
+      bool prepareSurface(SDL_Surface* input);
+      bool setSurface(SDL_Surface* newSurface);
 
- private:
-  GLuint        texture;            //!< The Texture-ID of opengl from this Texture.
-  bool          bAlpha;             //!< if the texture has an alpha channel.
-  SDL_Surface*  image;   
-};
+      GLuint loadTexToGL ();
+
+    private:
+      GLuint        texture;            //!< The Texture-ID of opengl from this Texture.
+      bool          bAlpha;             //!< if the texture has an alpha channel.
+      SDL_Surface*  image;              //!< The SDL_Surfce that stores the Texture on it.
+  };
 
 #endif /* _TEXTURE_H */
Index: trunk/src/lib/graphics/text_engine/font.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/font.cc	(revision 5767)
+++ trunk/src/lib/graphics/text_engine/font.cc	(revision 5768)
@@ -132,5 +132,4 @@
   this->fontTTF = NULL;
   this->glyphArray = NULL;
-  this->fastTextureID = 0;
 }
 
@@ -149,10 +148,5 @@
     this->fontTTF = NULL;
   }
-  if (this->fastTextureID != 0)
-  {
-    if(glIsTexture(this->fastTextureID))
-      glDeleteTextures(1, &this->fastTextureID);
-    this->fastTextureID = 0;
-  }
+
 
   this->setName(fontFile);
@@ -161,9 +155,6 @@
   if(this->fontTTF != NULL)
   {
-    this->fastTextureID = this->createFastTexture();
-    if (this->fastTextureID != 0)
-      return true;
-    else
-      return false;
+    this->createFastTexture();
+    return (this->getTexture() != 0);
   }
   else
@@ -190,12 +181,6 @@
     this->fontTTF = NULL;
   }
-  if (this->fastTextureID != 0)
-  {
-    if(glIsTexture(this->fastTextureID))
-      glDeleteTextures(1, &this->fastTextureID);
-    this->fastTextureID = 0;
-  }
-
-  this->fastTextureID = Text::loadTexture(surface, NULL);
+  if (this->prepareSurface(surface))
+    this->loadTexToGL( );
 
   // initializing the Glyphs.
@@ -251,4 +236,9 @@
 Font* Font::defaultFont = NULL;
 
+/**
+ * creates and exports an Image, that has all the characters
+ * stored in a Array (as an image)
+ * @param fileName the File to write the image into.
+ */
 void Font::createAsciiImage(const char* fileName)
 {
@@ -400,5 +390,5 @@
  * creates a Fast-Texture of this Font
  */
-GLuint Font::createFastTexture()
+bool Font::createFastTexture()
 {
   /* interesting GLYPHS:
@@ -500,19 +490,6 @@
   //   SDL_SaveBMP(tmpSurf, outName);
 
-  GLuint texture;
-  glGenTextures(1, &texture);
-  glBindTexture(GL_TEXTURE_2D, texture);
-  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-  glTexImage2D(GL_TEXTURE_2D,
-               0,
-               GL_RGBA,
-               tmpSurf->w, tmpSurf->h,
-               0,
-               GL_RGBA,
-               GL_UNSIGNED_BYTE,
-               tmpSurf->pixels);
-  SDL_FreeSurface(tmpSurf);
-  return texture;
+  if (this->setSurface(tmpSurf))
+    loadTexToGL();
 }
 
Index: trunk/src/lib/graphics/text_engine/font.h
===================================================================
--- trunk/src/lib/graphics/text_engine/font.h	(revision 5767)
+++ trunk/src/lib/graphics/text_engine/font.h	(revision 5768)
@@ -11,5 +11,5 @@
 #define _FONT_H
 
-#include "base_object.h"
+#include "texture.h"
 
 #include "glincl.h"
@@ -52,5 +52,5 @@
 
 //! A class to handle a Font of a certain ttf-File/image-file, Size.
-class Font : public BaseObject
+class Font : public Texture
 {
   public:
@@ -63,5 +63,5 @@
     void init();
 
-  // font
+  //  font
     bool loadFontFromTTF(const char* fontFile);
     bool loadFontFromSDL_Surface(SDL_Surface* surface);
@@ -71,15 +71,14 @@
     /** @returns a Pointer to the Array of Glyphs */
     inline Glyph** getGlyphArray() const { return this->glyphArray; };
-    /** @returns the texture to the fast-texture */
-    inline GLuint getFastTextureID() const { return this->fastTextureID; };
+    /** @returns the a pointer to the TTF */
+    inline TTF_Font* getTTF() const { return this->fontTTF; };
+
+
     /** @returns the default Font */
     inline static Font* getDefaultFont() { if (Font::defaultFont == NULL) initDefaultFont(); return Font::defaultFont; };
-    /** @returns the a pointer to the TTF */
-    inline TTF_Font* getTTF() const { return this->fontTTF; };
 
     void createAsciiImage(const char* fileName);
     static void initDefaultFont();
     static void removeDefaultFont();
-
 
   private:
@@ -89,5 +88,5 @@
     Glyph* getGlyphMetrics(Uint16 character);
 
-    GLuint createFastTexture();
+    bool createFastTexture();
 
     void initGlyphs(Uint16 from, Uint16 count);
@@ -104,5 +103,4 @@
 
     Glyph**       glyphArray;          //!< An Array of all the Glyphs stored in the Array of Glyphs.
-    GLuint        fastTextureID;       //!< The fast textureID.
 };
 
Index: trunk/src/lib/graphics/text_engine/text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text.cc	(revision 5767)
+++ trunk/src/lib/graphics/text_engine/text.cc	(revision 5768)
@@ -38,5 +38,5 @@
   if (fontFile != NULL)
     this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
-  this->setSizeY2D(this->size = textSize);
+  this->setSizeY2D(textSize);
 }
 
@@ -69,6 +69,5 @@
   this->blending = TEXT_DEFAULT_BLENDING;
   this->color = TEXT_DEFAULT_COLOR;
-  this->size = TEXT_DEFAULT_SIZE;
-
+  this->setSize(TEXT_DEFAULT_SIZE);
   this->setText(NULL);
 }
@@ -182,5 +181,5 @@
   {
     glyphArray = this->font->getGlyphArray();
-    glBindTexture(GL_TEXTURE_2D, font->getFastTextureID());
+    glBindTexture(GL_TEXTURE_2D, font->getTexture());
   }
   else
@@ -189,5 +188,5 @@
       Font::initDefaultFont();
     glyphArray = Font::getDefaultFont()->getGlyphArray();
-    glBindTexture(GL_TEXTURE_2D, Font::getDefaultFont()->getFastTextureID());
+    glBindTexture(GL_TEXTURE_2D, Font::getDefaultFont()->getTexture());
   }
   const char* tmpText = this->externText;
@@ -210,15 +209,15 @@
 
         glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
-        glVertex2d(posX, this->size);
+        glVertex2d(posX, this->getSizeY2D());
 
         glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
-        glVertex2d(posX+tmpGlyph->width*this->size, this->size);
+        glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), this->getSizeY2D());
 
         glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
-        glVertex2d(posX+tmpGlyph->width*this->size, 0);
+        glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), 0);
 
         glEnd();
         glEndList();
-        posX += tmpGlyph->advance * this->size;
+        posX += tmpGlyph->advance * this->getSizeY2D();
       }
       ++tmpText;
Index: trunk/src/lib/graphics/text_engine/text.h
===================================================================
--- trunk/src/lib/graphics/text_engine/text.h	(revision 5767)
+++ trunk/src/lib/graphics/text_engine/text.h	(revision 5768)
@@ -54,5 +54,5 @@
     void setColor(float r, float g, float b) { this->color = Vector(r, g, b); };
     /** sets the Size of the Font */
-    void setSize(float size) { this->setSizeY2D(this->size = size); };
+    void setSize(float size) { this->setSizeY2D(size); };
     /** @returns the Size of the Text */
 //    void getSize(float &x, float& y) const { return this->size; };
@@ -73,5 +73,4 @@
     Vector            color;          //!< The color of the font.
     float             blending;       //!< The blending intensity.
-    float             size;           //!< The size of the Font.
 };
 
