Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/text_engine/font.h @ 9217

Last change on this file since 9217 was 8766, checked in by bensch, 18 years ago

font: no more friends

File size: 1.8 KB
RevLine 
[4838]1/*!
[5343]2 * @file font.h
3 * brief Definition of the FONT-loading class
[5344]4 *
5 * !! IMPORTANT !! When using ttf fonts clear the license issues prior to
6 * adding them to orxonox. This is really important, because we do not want
7 * to offend anyone.
[5343]8 */
[1853]9
[5343]10#ifndef _FONT_H
11#define _FONT_H
[1853]12
[8761]13#include "material.h"
[1853]14
[8751]15#include "font_data.h"
[5343]16
17
[5347]18//! A class to handle a Font of a certain ttf-File/image-file, Size.
[8766]19class Font : public Material
[5343]20{
[3245]21
[8751]22public:
[8761]23  Font();
24  Font(const std::string& fontFile, unsigned int renderSize);
[8751]25  Font(const std::string& imageFile);
26  Font(char** xpmArray);
[8763]27  Font(const Font& font);
[8751]28  virtual ~Font();
29
[8761]30  Font& operator=(const Font& font);
31  /** @brief compare two fonts @param font the comparator, @returns true if they match */
32  bool operator==(const Font& font) const { return this->data == font.data; };
33
34  /// LOADING new Fonts
35  bool loadFontFromTTF(const std::string& fontFile, unsigned int renderSize);
[8751]36  bool loadFontFromSDL_Surface(SDL_Surface* surface);
[5343]37
[8751]38  void setStyle(const std::string& renderStyle);
[5343]39
[8751]40  /** @returns a Pointer to the Array of Glyphs */
41  inline Glyph** getGlyphArray() const { return this->data->getGlyphArray(); };
[5343]42
[8764]43  inline int getMaxHeight() const { return data->getMaxHeight(); };
44  inline int getMaxAscent() const { return data->getMaxAscent(); };
45  inline int getMaxDescent() const { return data->getMaxDescent(); };
[7450]46
[8764]47
[8765]48  static void createAsciiImage(const std::string& ttfFile, const std::string& fileName, unsigned int size);
[5343]49
[8761]50  void debug() const;
[5343]51
[8751]52private:
53  void init();
[8761]54  static void initDefaultFont();
[5343]55
[8764]56  void setTexture(const TextureDataPointer& texDataPointer);
[5343]57
[8751]58private:
[8763]59  FontDataPointer           data;                //!< A Data-Pointer to a Font.
60
[8761]61  static FontDataPointer    defaultFontData;     //!< a default font, that is used, if other fonts were unable to be loaded.
[1853]62};
63
[5343]64#endif /* _FONT_H */
Note: See TracBrowser for help on using the repository browser.