Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 29, 2006, 1:21:47 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Font Renders nicer now

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

Legend:

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

    r7428 r7429  
    380380                     &miY, &maY,
    381381                     &adv);
     382    printf("%c:: %d %d %d %d %d\n", rg->character, miX, maX, miY, maY, adv);
    382383    rg->minX = (float)miX / (float)this->renderSize;
    383384    rg->maxX = (float)maX / (float)this->renderSize;
     
    471472        tmpRect.y = tmp;
    472473
    473         tmpGlyph->texCoord[0] = (float)(tmpRect.x)/(float)tmpSurf->w;
    474         tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->width*(float)this->renderSize)/(float)tmpSurf->w;
     474        tmpGlyph->texCoord[0] = (float)((float)tmpRect.x + tmpGlyph->minX*(float)this->renderSize)/(float)tmpSurf->w;
     475        tmpGlyph->texCoord[1] = (float)((float)tmpRect.x + tmpGlyph->maxX*(float)this->renderSize)/(float)tmpSurf->w;
    475476        tmpGlyph->texCoord[2] = (float)(tmpRect.y)/(float)tmpSurf->w;
    476         tmpGlyph->texCoord[3] = (float)(tmpRect.y+this->getMaxHeight())/(float)tmpSurf->w;
     477        tmpGlyph->texCoord[3] = (float)((float)tmpRect.y+(float)this->getMaxHeight())/(float)tmpSurf->w;
    477478        SDL_FreeSurface(glyphSurf);
    478         tmpRect.x += (int)(tmpGlyph->advance * this->renderSize)+1;
     479        tmpRect.x += glyphSurf->w+1; //(int)(tmpGlyph->advance * this->renderSize);
    479480
    480481        /*
     
    492493  }
    493494  // outputting the GLYPH-table
    494   //   char outName[1024];
    495   //   sprintf( outName, "%s-glyphs.bmp", this->getName());
    496   //   SDL_SaveBMP(tmpSurf, outName);
     495     char outName[1024];
     496     sprintf( outName, "%s-glyphs.bmp", this->getName());
     497     SDL_SaveBMP(tmpSurf, outName);
    497498
    498499  if (this->setSurface(tmpSurf))
  • trunk/src/lib/graphics/text_engine/text.cc

    r7426 r7429  
    164164      {
    165165        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
    166         glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), 0);
     166        glVertex2d(posX+tmpGlyph->advance*this->getSizeY2D(), 0);
    167167
    168168        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
    169         glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), this->getSizeY2D());
     169        glVertex2d(posX+tmpGlyph->advance*this->getSizeY2D(), this->getSizeY2D());
    170170
    171171        glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
    172         glVertex2d(posX, this->getSizeY2D());
     172        glVertex2d(posX+tmpGlyph->minX*this->getSizeY2D(), this->getSizeY2D());
    173173
    174174        glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
    175         glVertex2d(posX, 0);
     175        glVertex2d(posX+tmpGlyph->minX*this->getSizeY2D(), 0);
    176176
    177177        posX += tmpGlyph->advance * this->getSizeY2D();
Note: See TracChangeset for help on using the changeset viewer.