Changeset 7455 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Apr 29, 2006, 10:38:12 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/text_engine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/multi_line_text.cc
r7454 r7455 91 91 for (unsigned int i = 0; i < this->getText().size(); ++i) 92 92 { 93 if (unlikely( this->getText()[i] == '\n' ||i == this->lineEnds[lineNumber]))93 if (unlikely(!this->lineEnds.empty() && i == this->lineEnds[lineNumber])) 94 94 { 95 95 // go to the next Line. … … 140 140 width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance; 141 141 } 142 this->setSizeY2D(this->lineEnds.size() * (this->lineSpacing +this->getFont()->getMaxHeight()));142 this->setSizeY2D(this->lineEnds.size() * (this->lineSpacing + this->getFont()->getMaxHeight())); 143 143 } -
trunk/src/lib/graphics/text_engine/text.cc
r7453 r7455 35 35 // initialize this Text 36 36 this->font = NULL; 37 this->text = ""; 38 this->setAlignment(TEXT_DEFAULT_ALIGNMENT); 37 38 this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE); 39 39 40 this->blending = TEXT_DEFAULT_BLENDING; 40 41 this->color = TEXT_DEFAULT_COLOR; 41 42 if (!fontFile.empty()) 43 this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE); 44 42 this->setAlignment(TEXT_DEFAULT_ALIGNMENT); 45 43 this->setSize(TEXT_DEFAULT_SIZE); 46 44 } … … 63 61 void Text::setFont(const std::string& fontFile, unsigned int fontSize) 64 62 { 65 Font* newFont ;63 Font* newFont = NULL; 66 64 Font* oldFont = this->font; 67 65 … … 76 74 } 77 75 } 78 else76 if (newFont == NULL) 79 77 newFont = Font::getDefaultFont(); 78 assert(newFont != NULL); 80 79 81 80 // unloading the Font if we alrady have one loaded.
Note: See TracChangeset
for help on using the changeset viewer.