Index: branches/gui/src/lib/graphics/Makefile.am
===================================================================
--- branches/gui/src/lib/graphics/Makefile.am	(revision 8529)
+++ branches/gui/src/lib/graphics/Makefile.am	(revision 8538)
@@ -15,4 +15,5 @@
 			   text_engine/text.cc \
 			   text_engine/multi_line_text.cc \
+			   text_engine/limited_width_text.cc \
 			   text_engine/font.cc \
 			   \
@@ -40,4 +41,5 @@
 		 text_engine/text.h \
 		 text_engine/multi_line_text.h \
+		 text_engine/limited_width_text.h \
 		 text_engine/font.h \
 		 text_engine/default_font.xpm \
Index: branches/gui/src/lib/graphics/text_engine/limited_width_text.cc
===================================================================
--- branches/gui/src/lib/graphics/text_engine/limited_width_text.cc	(revision 8538)
+++ branches/gui/src/lib/graphics/text_engine/limited_width_text.cc	(revision 8538)
@@ -0,0 +1,157 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "limited_width_text.h"
+#include "font.h"
+
+/**
+ * @brief creates a new Text Element
+ * @param fontFile the Font to render this text in
+ * @param type The renderType to display this font in
+ */
+LimitedWidthText::LimitedWidthText(const std::string& fontFile, unsigned int textSize, float lineWidth, DotsPosition dotsPosition)
+    : Text(fontFile, textSize)
+{
+  this->setClassID(CL_LIMITED_WIDTH_TEXT, "LimitedWidthText");
+
+  this->_dotsPosition = End;
+  this->setLineWidth(lineWidth);
+}
+
+/**
+ * @brief sets the maximum Line width
+ * @param lineWidth the maximum lineWidth.
+ */
+void LimitedWidthText::setLineWidth(float lineWidth)
+{
+  this->_lineWidth = lineWidth;
+  this->setSizeX2D(lineWidth);
+  this->setupTextWidth();
+}
+
+
+/**
+ * @brief draws the Text
+ */
+void LimitedWidthText::draw() const
+{
+  if (unlikely(this->_dotedText.empty()))
+    return;
+  glPushMatrix();
+  glPushAttrib(GL_ENABLE_BIT);
+  // transform for alignment.
+  if (this->getAlignment() == TEXT_ALIGN_RIGHT)
+    glTranslatef(-this->getSizeX2D(), 0, 0);
+  else if (this->getAlignment() == TEXT_ALIGN_CENTER || this->getAlignment() == TEXT_ALIGN_SCREEN_CENTER)
+    glTranslatef(-this->getSizeX2D()/2, 0, 0);
+
+  // drawing this Text.
+  // setting the Blending effects
+  glColor4fv(&this->getColor()[0]);
+
+
+  glActiveTexture(GL_TEXTURE0);
+
+  glEnable(GL_BLEND);
+  glEnable(GL_TEXTURE_2D);
+  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE );
+
+  glBindTexture(GL_TEXTURE_2D, this->getFont()->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->_dotedText.size(); i++)
+  {
+    if(likely((tmpGlyph = this->getFont()->getGlyphArray()[this->_dotedText[i]]) != NULL))
+    {
+      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
+      glVertex2d(posX+tmpGlyph->maxX*this->getSize(), 0);
+
+      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
+      glVertex2d(posX+tmpGlyph->maxX*this->getSize(), this->getSize());
+
+      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
+      glVertex2d(posX+tmpGlyph->minX*this->getSize(), this->getSize());
+
+      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
+      glVertex2d(posX+tmpGlyph->minX*this->getSize(), 0);
+
+      posX += tmpGlyph->advance * this->getSize();
+    }
+  }
+  glEnd();
+  glPopAttrib();
+  glPopMatrix();
+}
+
+
+/**
+ * @brief setting up the Text-Width if DYNAMIC
+ */
+void LimitedWidthText::setupTextWidth()
+{
+  float dotsSize = this->getFont()->getGlyphArray()[46]->advance * 3.0;
+
+  float width = 0.0f;
+  float maxWidth = this->_lineWidth / this->getSize();
+
+  switch (this->_dotsPosition)
+  {
+    case End:
+      for (unsigned int i = 0; i < this->getText().size(); i++)
+      {
+        if (width + dotsSize > maxWidth )
+        {
+          this->_dotedText = this->getText().substr(0, i) + "...";
+          width += dotsSize;
+          break;
+        }
+        // Advance the Text.
+        if(this->getFont()->getGlyphArray()[this->getText()[i]] != NULL)
+          width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
+      }
+      this->setSizeX2D(width);
+      break;
+    case Begin:
+      for (unsigned int i = this->getText().size() - 1; i < 0; i--)
+      {
+        if (width + dotsSize > maxWidth )
+        {
+          this->_dotedText = std::string("...") + this->getText().substr(i);
+          width += dotsSize;
+          break;
+        }
+        // Advance the Text.
+        if(this->getFont()->getGlyphArray()[this->getText()[i]] != NULL)
+          width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
+      }
+      this->setSizeX2D(width);
+      break;
+  }
+}
+
+/**
+ * @brief print out some nice debug output
+ */
+void LimitedWidthText::debug() const
+{
+  printf("Debug %s::%s \n", this->getClassName(), this->getName() );
+}
Index: branches/gui/src/lib/graphics/text_engine/limited_width_text.h
===================================================================
--- branches/gui/src/lib/graphics/text_engine/limited_width_text.h	(revision 8538)
+++ branches/gui/src/lib/graphics/text_engine/limited_width_text.h	(revision 8538)
@@ -0,0 +1,50 @@
+/*!
+ * @file limited_width_text.h
+ * @brief Definition of a text Class, that is able to render text.
+ */
+
+#ifndef _LIMITED_WIDTH_TEXT_H
+#define _LIMITED_WIDTH_TEXT_H
+
+#include "text.h"
+
+#include <vector>
+
+//! Represents one textElement.
+class LimitedWidthText : public Text
+{
+  public:
+    typedef enum {
+      Begin,
+      End,
+    } DotsPosition;
+
+
+  public:
+    LimitedWidthText(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE, float lineWidth = 100.0, DotsPosition dotsPosition = Begin);
+
+    // Setup:
+    void setLineWidth(float lineWidth);
+    void setDotsPosition(DotsPosition dotsPosition);
+
+    // Retrieve:
+    /** @returns the LineWidth (maximum distance from the left to the right */
+    inline float lineWidth() const { return this->_lineWidth; };
+    /** @returns the dots position. */
+    inline float dotsPosition() const { return this->_dotsPosition; };
+    virtual void draw() const;
+
+    void debug() const;
+
+  protected:
+    virtual void setupTextWidth();
+
+  private:
+    std::string                _dotedText;
+
+    DotsPosition               _dotsPosition;
+    float                      _lineWidth;
+    unsigned int               _lineEnds;
+};
+
+#endif /* _LIMITED_WIDTH_TEXT_H */
