Changeset 8753 in orxonox.OLD for branches/fontdata/src/lib/graphics/text_engine/font.cc
- Timestamp:
- Jun 23, 2006, 6:38:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/fontdata/src/lib/graphics/text_engine/font.cc
r8751 r8753 27 27 28 28 #include "debug.h" 29 #include "stdlibincl.h"30 29 #include "compiler.h" 31 using namespace std; 30 32 31 33 32 /** … … 37 36 */ 38 37 Font::Font(const std::string& fontFile, unsigned int renderSize) 39 : data( new FontData())38 : data(Font::defaultFontData) 40 39 { 41 40 this->init(); … … 54 53 */ 55 54 Font::Font(const std::string& imageFile) 56 : data( new FontData())55 : data(Font::defaultFontData) 57 56 { 58 57 this->init(); 58 59 59 this->setName(imageFile); 60 60 // this->setSize(fontSize); … … 78 78 */ 79 79 Font::Font(char** xpmArray) 80 : data( new FontData())80 : data(Font::defaultFontData) 81 81 { 82 82 this->init(); … … 111 111 { 112 112 this->setClassID(CL_FONT, "Font"); 113 } 113 if (Font::defaultFontData.get() == NULL) 114 Font::defaultFontData = initDefaultFont(); 115 } 116 117 FontDataPointer Font::defaultFontData = FontDataPointer(NULL); //initDefaultFont(); 114 118 115 119 … … 121 125 bool Font::loadFontFromTTF(const std::string& fontFile) 122 126 { 123 // checking for existent Font. 124 if (this->data->fontTTF != NULL) 125 { 126 TTF_CloseFont(this->data->fontTTF); 127 this->data->fontTTF = NULL; 128 } 129 127 this->data = FontDataPointer (new FontData()); 130 128 131 129 this->setName(fontFile); … … 223 221 // PRINTF(2)("Font was not initialized, please do so before setting the Font-Style.\n"); 224 222 } 225 226 Font* Font::defaultFont = NULL;227 223 228 224 /** … … 288 284 * @brief initializes the default font 289 285 */ 290 void Font::initDefaultFont() 291 { 292 if (Font::defaultFont == NULL) 293 Font::defaultFont = new Font(font_xpm); 294 } 295 296 /** 297 * @brief deletes the default font 298 */ 299 void Font::removeDefaultFont() 300 { 301 if (Font::defaultFont != NULL) 302 delete Font::defaultFont; 303 Font::defaultFont = NULL; 304 } 305 286 FontDataPointer Font::initDefaultFont() 287 { 288 return Font(font_xpm).data; 289 } 306 290 307 291 /** … … 569 553 * @brief a simple function to get some interesting information about this class 570 554 */ 571 void Font::debug() 555 void Font::debug() const 572 556 { 573 557 // print the loaded font's style
Note: See TracChangeset
for help on using the changeset viewer.