Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8761 in orxonox.OLD for trunk/src/lib/graphics/text_engine/font.h


Ignore:
Timestamp:
Jun 24, 2006, 2:16:12 AM (18 years ago)
Author:
bensch
Message:

merged the new Font-Implementation back here
merged with svn merge https://svn.orxonox.net/orxonox/branches/fontdata . -r8752:HEAD
no conflicts, naturally

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine/font.h

    r8751 r8761  
    1111#define _FONT_H
    1212
    13 #include "texture.h"
     13#include "material.h"
    1414
    1515#include "font_data.h"
     
    1717
    1818//! A class to handle a Font of a certain ttf-File/image-file, Size.
    19 class Font : public Texture
     19class Font : public Material /* TODO Material it should be */
    2020{
    2121
    2222public:
    23   Font(const std::string& fontFile,
    24       unsigned int renderSize);
     23  Font();
     24  Font(const std::string& fontFile, unsigned int renderSize);
    2525  Font(const std::string& imageFile);
    2626  Font(char** xpmArray);
    2727  virtual ~Font();
    2828
    29   //  font
    30   bool loadFontFromTTF(const std::string& fontFile);
     29  Font& operator=(const Font& font);
     30  /** @brief compare two fonts @param font the comparator, @returns true if they match */
     31  bool operator==(const Font& font) const { return this->data == font.data; };
     32
     33
     34  /// LOADING new Fonts
     35  bool loadFontFromTTF(const std::string& fontFile, unsigned int renderSize);
    3136  bool loadFontFromSDL_Surface(SDL_Surface* surface);
    3237
     
    4247  int getMaxDescent() const;
    4348
    44   /** @returns the default Font */
    45   inline static Font* getDefaultFont() { if (Font::defaultFont == NULL) initDefaultFont(); return Font::defaultFont; };
     49  void createAsciiImage(const std::string& fileName, unsigned int size) const;
    4650
    47   void createAsciiImage(const std::string& fileName, unsigned int size) const;
     51  void debug() const;
     52
     53private:
     54  void init();
     55  void initGlyphs(Uint16 from, Uint16 count);
     56  bool getGlyphMetrics(Glyph* glyph, Uint16 character);
    4857  static void initDefaultFont();
    49   static void removeDefaultFont();
     58
     59  int findOptimalFastTextureSize();
     60  bool createFastTexture();
     61
     62  bool setTexture(GLuint texture);
    5063
    5164
    5265private:
    53   void init();
    54   bool getGlyphMetrics(Glyph* glyph, Uint16 character);
     66  static FontDataPointer    defaultFontData;     //!< a default font, that is used, if other fonts were unable to be loaded.
    5567
    56   bool createFastTexture();
    57 
    58   void initGlyphs(Uint16 from, Uint16 count);
    59   int findOptimalFastTextureSize();
    60 
    61   void debug();
    62 
    63 private:
    64   static Font*  defaultFont;         //!< a default font, that is used, if other fonts were unable to be loaded.
    65 
    66   fontDataPointer data;
     68  FontDataPointer           data;                //!< A Data-Pointer to a Font.
    6769};
    6870
Note: See TracChangeset for help on using the changeset viewer.