Changeset 8761 in orxonox.OLD for trunk/src/lib/graphics/text_engine/font.h
- Timestamp:
- Jun 24, 2006, 2:16:12 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/font.h
r8751 r8761 11 11 #define _FONT_H 12 12 13 #include " texture.h"13 #include "material.h" 14 14 15 15 #include "font_data.h" … … 17 17 18 18 //! A class to handle a Font of a certain ttf-File/image-file, Size. 19 class Font : public Texture19 class Font : public Material /* TODO Material it should be */ 20 20 { 21 21 22 22 public: 23 Font( const std::string& fontFile,24 23 Font(); 24 Font(const std::string& fontFile, unsigned int renderSize); 25 25 Font(const std::string& imageFile); 26 26 Font(char** xpmArray); 27 27 virtual ~Font(); 28 28 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); 31 36 bool loadFontFromSDL_Surface(SDL_Surface* surface); 32 37 … … 42 47 int getMaxDescent() const; 43 48 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; 46 50 47 void createAsciiImage(const std::string& fileName, unsigned int size) const; 51 void debug() const; 52 53 private: 54 void init(); 55 void initGlyphs(Uint16 from, Uint16 count); 56 bool getGlyphMetrics(Glyph* glyph, Uint16 character); 48 57 static void initDefaultFont(); 49 static void removeDefaultFont(); 58 59 int findOptimalFastTextureSize(); 60 bool createFastTexture(); 61 62 bool setTexture(GLuint texture); 50 63 51 64 52 65 private: 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. 55 67 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. 67 69 }; 68 70
Note: See TracChangeset
for help on using the changeset viewer.