- Timestamp:
- Dec 30, 2005, 5:32:59 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/text_engine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/font.cc
r5859 r6349 247 247 * @param fileName the File to write the image into. 248 248 */ 249 void Font::createAsciiImage(const char* fileName )249 void Font::createAsciiImage(const char* fileName, uint size) const 250 250 { 251 251 if (this->fontTTF == NULL) … … 258 258 SDL_Rect tmpRect; // this represents a Rectangle for blitting. 259 259 SDL_Surface* tmpSurf = SDL_CreateRGBSurface(SDL_SWSURFACE, 260 height* 16, height*16,260 height*size, height*size, 261 261 32, 262 262 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ … … 286 286 { 287 287 SDL_Color white = {255, 255, 255}; 288 glyphSurf = TTF_RenderGlyph_Blended(this->fontTTF, posX+ 16*posY, white);288 glyphSurf = TTF_RenderGlyph_Blended(this->fontTTF, posX+size*posY, white); 289 289 } 290 290 if( glyphSurf != NULL ) … … 326 326 * @returns the maximum height of the Font, if the font was initialized, 0 otherwise 327 327 */ 328 int Font::getMaxHeight() 328 int Font::getMaxHeight() const 329 329 { 330 330 if (likely (this->fontTTF != NULL)) … … 339 339 the ascent is the pixels of the font above the baseline 340 340 */ 341 int Font::getMaxAscent() 341 int Font::getMaxAscent() const 342 342 { 343 343 if (likely(this->fontTTF != NULL)) … … 352 352 the descent is the pixels of the font below the baseline 353 353 */ 354 int Font::getMaxDescent() 354 int Font::getMaxDescent() const 355 355 { 356 356 if (likely(this->fontTTF != NULL)) -
trunk/src/lib/graphics/text_engine/font.h
r5768 r6349 78 78 inline static Font* getDefaultFont() { if (Font::defaultFont == NULL) initDefaultFont(); return Font::defaultFont; }; 79 79 80 void createAsciiImage(const char* fileName );80 void createAsciiImage(const char* fileName, uint size) const; 81 81 static void initDefaultFont(); 82 82 static void removeDefaultFont(); 83 83 84 84 private: 85 int getMaxHeight() ;86 int getMaxAscent() ;87 int getMaxDescent() ;85 int getMaxHeight() const; 86 int getMaxAscent() const; 87 int getMaxDescent() const; 88 88 Glyph* getGlyphMetrics(Uint16 character); 89 89 -
trunk/src/lib/graphics/text_engine/text.cc
r5768 r6349 199 199 Glyph* tmpGlyph; 200 200 float posX = 0.0f; 201 202 glBegin(GL_QUADS); 201 203 while (likely(*tmpText != '\0')) 202 204 { 203 205 if(likely((tmpGlyph = glyphArray[*tmpText]) != NULL)) 204 206 { 205 glBegin(GL_QUADS); 207 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]); 208 glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), 0); 209 210 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]); 211 glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), this->getSizeY2D()); 212 213 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]); 214 glVertex2d(posX, this->getSizeY2D()); 206 215 207 216 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]); 208 217 glVertex2d(posX, 0); 209 218 210 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);211 glVertex2d(posX, this->getSizeY2D());212 213 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);214 glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), this->getSizeY2D());215 216 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);217 glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), 0);218 219 glEnd();220 glEndList();221 219 posX += tmpGlyph->advance * this->getSizeY2D(); 222 220 } 223 221 ++tmpText; 224 222 } 223 glEnd(); 225 224 } 226 225
Note: See TracChangeset
for help on using the changeset viewer.