Changeset 5420 in orxonox.OLD for trunk/src/lib/graphics/text_engine/font.cc
- Timestamp:
- Oct 22, 2005, 1:57:29 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/font.cc
r5418 r5420 412 412 413 413 this->initGlyphs(32, numberOfGlyphs); 414 this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space414 // this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space 415 415 416 416 int rectSize = this->findOptimalFastTextureSize(); … … 437 437 tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h; 438 438 SDL_SetClipRect(tmpSurf, &tmpRect); 439 int maxLineHeight = 0;439 int maxLineHeight = this->getMaxHeight(); 440 440 441 441 // all the interessting Glyphs … … 453 453 { 454 454 tmpRect.x = 0; 455 tmpRect.y = tmpRect.y + maxLineHeight + 1; 456 maxLineHeight = 0; 455 tmpRect.y = tmpRect.y + maxLineHeight; 457 456 } 458 457 if (tmpRect.y + maxLineHeight > tmpSurf->h) … … 470 469 { 471 470 SDL_SetAlpha(glyphSurf, 0, 0); 472 471 int tmp = tmpRect.y; 472 tmpRect.y += this->getMaxAscent()-(int)((float)tmpGlyph->bearingY*this->renderSize); 473 473 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; 476 478 tmpGlyph->texCoord[2] = (float)(tmpRect.y)/(float)tmpSurf->w; 477 tmpGlyph->texCoord[3] = (float)(tmpRect.y+t mpGlyph->height*this->renderSize)/(float)tmpSurf->w;479 tmpGlyph->texCoord[3] = (float)(tmpRect.y+this->getMaxHeight())/(float)tmpSurf->w; 478 480 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 483 483 /* 484 char outname[512]; 484 // Outputting Glyphs to BMP-files. 485 char outname[1024]; 485 486 if (i < 10) 486 487 sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i ); … … 489 490 else 490 491 sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i ); 491 SDL_SaveBMP(tmpSurf, outname); 492 */ 492 SDL_SaveBMP(tmpSurf, outname);*/ 493 493 } 494 494 } 495 495 } 496 // outputting the GLYPH-table 497 // char outName[1024]; 498 // sprintf( outName, "%s-glyphs.bmp", this->getName()); 499 // SDL_SaveBMP(tmpSurf, outName); 496 500 497 501 GLuint texture;
Note: See TracChangeset
for help on using the changeset viewer.