Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 23, 2006, 6:38:05 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: non-compiling new Version of the Data-Font

File:
1 edited

Legend:

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

    r8751 r8753  
    2727
    2828#include "debug.h"
    29 #include "stdlibincl.h"
    3029#include "compiler.h"
    31 using namespace std;
     30
    3231
    3332/**
     
    3736 */
    3837Font::Font(const std::string& fontFile, unsigned int renderSize)
    39   : data(new FontData())
     38  : data(Font::defaultFontData)
    4039{
    4140  this->init();
     
    5453 */
    5554Font::Font(const std::string& imageFile)
    56   : data(new FontData())
     55  : data(Font::defaultFontData)
    5756{
    5857  this->init();
     58
    5959  this->setName(imageFile);
    6060  //  this->setSize(fontSize);
     
    7878 */
    7979Font::Font(char** xpmArray)
    80   : data(new FontData())
     80  : data(Font::defaultFontData)
    8181{
    8282  this->init();
     
    111111{
    112112  this->setClassID(CL_FONT, "Font");
    113 }
     113  if (Font::defaultFontData.get() == NULL)
     114    Font::defaultFontData = initDefaultFont();
     115}
     116
     117FontDataPointer Font::defaultFontData = FontDataPointer(NULL); //initDefaultFont();
    114118
    115119
     
    121125bool Font::loadFontFromTTF(const std::string& fontFile)
    122126{
    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());
    130128
    131129  this->setName(fontFile);
     
    223221  //    PRINTF(2)("Font was not initialized, please do so before setting the Font-Style.\n");
    224222}
    225 
    226 Font* Font::defaultFont = NULL;
    227223
    228224/**
     
    288284 * @brief initializes the default font
    289285 */
    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 
     286FontDataPointer Font::initDefaultFont()
     287{
     288  return Font(font_xpm).data;
     289}
    306290
    307291/**
     
    569553 * @brief a simple function to get some interesting information about this class
    570554 */
    571 void Font::debug()
     555void Font::debug() const
    572556{
    573557  // print the loaded font's style
Note: See TracChangeset for help on using the changeset viewer.