Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7431 in orxonox.OLD for trunk


Ignore:
Timestamp:
Apr 29, 2006, 2:09:26 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Font is PERFECT :)

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

Legend:

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

    r7430 r7431  
    381381                     &adv) == -1)
    382382      return false;
    383 
    384383    glyph->minX = (float)miX / (float)this->renderSize;
    385384    glyph->maxX = (float)maX / (float)this->renderSize;
     
    393392    glyph->bearingX = (glyph->advance - glyph->width) / 2;
    394393    glyph->bearingY = glyph->maxY;
     394
     395    //printf("%c:: %d %d %d %d %d\n", character, miX, maX, miY, maY, adv);
     396
    395397    return true;
    396398  }
     
    471473      {
    472474        SDL_SetAlpha(glyphSurf, 0, 0);
    473         int tmp = tmpRect.y;
     475        int tmpY = tmpRect.y;
    474476        tmpRect.y += this->getMaxAscent()-(int)((float)tmpGlyph->bearingY*this->renderSize);
    475477        SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect);
    476         tmpRect.y = tmp;
    477 
    478         tmpGlyph->texCoord[0] = (float)((float)tmpRect.x + tmpGlyph->minX*(float)this->renderSize)/(float)tmpSurf->w;
    479         tmpGlyph->texCoord[1] = (float)((float)tmpRect.x + tmpGlyph->maxX*(float)this->renderSize)/(float)tmpSurf->w;
     478        tmpRect.y = tmpY;
     479
     480        tmpGlyph->texCoord[0] = (float)((float)tmpRect.x )/(float)tmpSurf->w;
     481        tmpGlyph->texCoord[1] = (float)((float)tmpRect.x + tmpGlyph->width*(float)this->renderSize)/(float)tmpSurf->w;
    480482        tmpGlyph->texCoord[2] = (float)(tmpRect.y)/(float)tmpSurf->w;
    481483        tmpGlyph->texCoord[3] = (float)((float)tmpRect.y+(float)this->getMaxHeight())/(float)tmpSurf->w;
    482484        SDL_FreeSurface(glyphSurf);
    483         tmpRect.x += glyphSurf->w+1; //(int)(tmpGlyph->advance * this->renderSize);
     485        tmpRect.x += (int)(tmpGlyph->width * this->renderSize) + 1;
    484486      }
    485487    }
    486488  }
    487489  // outputting the GLYPH-table
    488 //      char outName[1024];
    489 //      sprintf( outName, "%s-glyphs.bmp", this->getName());
    490 //      SDL_SaveBMP(tmpSurf, outName);
     490      char outName[1024];
     491      sprintf( outName, "%s-glyphs.bmp", this->getName());
     492      SDL_SaveBMP(tmpSurf, outName);
    491493
    492494  if (this->setSurface(tmpSurf))
  • trunk/src/lib/graphics/text_engine/text.cc

    r7429 r7431  
    164164      {
    165165        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
    166         glVertex2d(posX+tmpGlyph->advance*this->getSizeY2D(), 0);
     166        glVertex2d(posX+tmpGlyph->maxX*this->getSizeY2D(), 0);
    167167
    168168        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
    169         glVertex2d(posX+tmpGlyph->advance*this->getSizeY2D(), this->getSizeY2D());
     169        glVertex2d(posX+tmpGlyph->maxX*this->getSizeY2D(), this->getSizeY2D());
    170170
    171171        glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
Note: See TracChangeset for help on using the changeset viewer.