Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5418 in orxonox.OLD for trunk/src/lib/graphics/text_engine


Ignore:
Timestamp:
Oct 21, 2005, 1:13:58 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Text offers its Size to Element2D

Location:
trunk/src/lib/graphics/text_engine
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine/font.cc

    r5370 r5418  
    215215      tmpGlyph->texCoord[3] = cy+0.0625f;
    216216      tmpGlyph->width = 1;
     217      tmpGlyph->advance = 1;
    217218      tmpGlyph->bearingX = 1;
    218219      tmpGlyph->bearingY = 1;
  • trunk/src/lib/graphics/text_engine/text.cc

    r5376 r5418  
    3939    this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
    4040  this->setType(type);
    41   this->size = textSize;
     41  this->setSizeY2D(this->size = textSize);
    4242}
    4343
     
    147147
    148148  // setting up the Text-Width if DYNAMIC
    149   if (this->type & TEXT_RENDER_DYNAMIC && this->getAlignment() != TEXT_ALIGN_LEFT && this->font != NULL)
    150   {
    151     Glyph** glyphArray = this->font->getGlyphArray();
     149//  if (this->type & TEXT_RENDER_DYNAMIC && this->getAlignment() != TEXT_ALIGN_LEFT && this->font != NULL)
     150  const Font* calcSizeFont = this->font;
     151  if (calcSizeFont != NULL || (calcSizeFont = Font::getDefaultFont()) != NULL)
     152  {
     153    Glyph** glyphArray = calcSizeFont->getGlyphArray();
    152154
    153155    float width = 0;
     
    159161      while (*tmpText != '\0')
    160162      {
    161         if(glyphArray[*tmpText])
     163        if(glyphArray[*tmpText] != NULL)
    162164        {
    163           width += glyphArray[*tmpText]->width;
     165          width += glyphArray[*tmpText]->advance;
    164166        }
    165167        tmpText++;
    166168      }
    167       this->width = width;
     169      this->setSizeX2D(this->width = width *this->getSizeY2D());
    168170    }
    169171  }
  • trunk/src/lib/graphics/text_engine/text.h

    r5395 r5418  
    6969    void setColor(float r, float g, float b) { this->color = Vector(r, g, b); };
    7070    /** sets the Size of the Font */
    71     void setSize(float size) { this->size = size; };
     71    void setSize(float size) { this->setSizeY2D(this->size = size); };
    7272    /** @returns the Size of the Text */
    7373//    void getSize(float &x, float& y) const { return this->size; };
Note: See TracChangeset for help on using the changeset viewer.