Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5420 in orxonox.OLD for trunk/src/lib/graphics/text_engine/font.cc


Ignore:
Timestamp:
Oct 22, 2005, 1:57:29 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Font is now Right, and the Rendering 'should be' faster.

File:
1 edited

Legend:

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

    r5418 r5420  
    412412
    413413  this->initGlyphs(32, numberOfGlyphs);
    414   this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space
     414//  this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space
    415415
    416416  int rectSize = this->findOptimalFastTextureSize();
     
    437437  tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h;
    438438  SDL_SetClipRect(tmpSurf, &tmpRect);
    439   int maxLineHeight = 0;
     439  int maxLineHeight = this->getMaxHeight();
    440440
    441441  // all the interessting Glyphs
     
    453453      {
    454454        tmpRect.x = 0;
    455         tmpRect.y = tmpRect.y + maxLineHeight + 1;
    456         maxLineHeight = 0;
     455        tmpRect.y = tmpRect.y + maxLineHeight;
    457456      }
    458457      if (tmpRect.y + maxLineHeight > tmpSurf->h)
     
    470469      {
    471470        SDL_SetAlpha(glyphSurf, 0, 0);
    472 
     471        int tmp = tmpRect.y;
     472        tmpRect.y += this->getMaxAscent()-(int)((float)tmpGlyph->bearingY*this->renderSize);
    473473        SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect);
    474         tmpGlyph->texCoord[0] = (float)tmpRect.x/(float)tmpSurf->w;
    475         tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->advance*this->renderSize)/(float)tmpSurf->w;
     474        tmpRect.y = tmp;
     475
     476        tmpGlyph->texCoord[0] = (float)(tmpRect.x)/(float)tmpSurf->w;
     477        tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->width*(float)this->renderSize)/(float)tmpSurf->w;
    476478        tmpGlyph->texCoord[2] = (float)(tmpRect.y)/(float)tmpSurf->w;
    477         tmpGlyph->texCoord[3] = (float)(tmpRect.y+tmpGlyph->height*this->renderSize)/(float)tmpSurf->w;
     479        tmpGlyph->texCoord[3] = (float)(tmpRect.y+this->getMaxHeight())/(float)tmpSurf->w;
    478480        SDL_FreeSurface(glyphSurf);
    479 
    480         tmpRect.x += (int)(tmpGlyph->advance*this->renderSize)+1;
    481 
    482               // Outputting Glyphs to BMP-files.
     481        tmpRect.x += (int)(tmpGlyph->advance * this->renderSize)+1;
     482
    483483        /*
    484         char outname[512];
     484        // Outputting Glyphs to BMP-files.
     485        char outname[1024];
    485486        if (i < 10)
    486487        sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i );
     
    489490        else
    490491        sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i );
    491         SDL_SaveBMP(tmpSurf, outname);
    492         */
     492        SDL_SaveBMP(tmpSurf, outname);*/
    493493      }
    494494    }
    495495  }
     496  // outputting the GLYPH-table
     497  //   char outName[1024];
     498  //   sprintf( outName, "%s-glyphs.bmp", this->getName());
     499  //   SDL_SaveBMP(tmpSurf, outName);
    496500
    497501  GLuint texture;
Note: See TracChangeset for help on using the changeset viewer.