Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10755 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.0 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{
[9869]21  ObjectListDeclaration(Font);
[8751]22public:
[9869]23  typedef FontData::Glyph Glyph;
24public:
[8761]25  Font();
26  Font(const std::string& fontFile, unsigned int renderSize);
[8751]27  Font(const std::string& imageFile);
28  Font(char** xpmArray);
[8763]29  Font(const Font& font);
[8751]30  virtual ~Font();
31
[8761]32  Font& operator=(const Font& font);
33  /** @brief compare two fonts @param font the comparator, @returns true if they match */
34  bool operator==(const Font& font) const { return this->data == font.data; };
35
36  /// LOADING new Fonts
37  bool loadFontFromTTF(const std::string& fontFile, unsigned int renderSize);
[8751]38  bool loadFontFromSDL_Surface(SDL_Surface* surface);
[5343]39
[8751]40  void setStyle(const std::string& renderStyle);
[5343]41
[8751]42  /** @returns a Pointer to the Array of Glyphs */
[9869]43  inline const Glyph* const * const getGlyphArray() const { return this->data->getGlyphArray(); };
[5343]44
[8764]45  inline int getMaxHeight() const { return data->getMaxHeight(); };
46  inline int getMaxAscent() const { return data->getMaxAscent(); };
47  inline int getMaxDescent() const { return data->getMaxDescent(); };
[7450]48
[8764]49
[8765]50  static void createAsciiImage(const std::string& ttfFile, const std::string& fileName, unsigned int size);
[5343]51
[8761]52  void debug() const;
[5343]53
[9869]54  void acquireData(const FontData::Pointer& data) { this->data = data; };
55  const FontData::Pointer& dataPointer() const { return data; };
[8751]56private:
57  void init();
[8761]58  static void initDefaultFont();
[5343]59
[9869]60  void setTexture(const TextureData::Pointer& texDataPointer);
[5343]61
[8751]62private:
[9869]63  FontData::Pointer         data;                //!< A Data-Pointer to a Font.
[8763]64
[9869]65  static FontData::Pointer  defaultFontData;     //!< a default font, that is used, if other fonts were unable to be loaded.
[1853]66};
67
[5343]68#endif /* _FONT_H */
Note: See TracBrowser for help on using the repository browser.