xoreos  0.0.5
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Graphics::Aurora::TTFFont Class Reference

#include <ttffont.h>

Inheritance diagram for Graphics::Aurora::TTFFont:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Aurora::TTFFont:
Collaboration graph
[legend]

Classes

struct  Char
 A font character. More...
 
struct  Page
 A texture page filled with characters. More...
 

Public Member Functions

 TTFFont (Common::SeekableReadStream *ttf, int height)
 
 TTFFont (const Common::UString &name, int height)
 
 ~TTFFont ()
 
float getWidth (uint32 c) const
 Return the width of a character. More...
 
float getHeight () const
 Return the height of a character. More...
 
void draw (uint32 c) const
 Draw this character. More...
 
void buildChars (const Common::UString &str)
 Build all necessary characters to display this string. More...
 
- Public Member Functions inherited from Graphics::Font
 Font ()
 
virtual ~Font ()
 
virtual float getLineSpacing () const
 Return the size of space between lines. More...
 
size_t getLineCount (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const
 Return the number of lines this text spans. More...
 
float getWidth (const Common::UString &text, float maxWidth=0.0f) const
 Return the width this string would take. More...
 
float getHeight (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const
 Return the height this string would take. More...
 
float getLineWidth (const Common::UString &text) const
 Return the width of this string. More...
 
virtual void renderBind (const glm::mat4 &transform) const
 
virtual void render (uint32 c, float &x, float &y, float *rgba) const
 
virtual void renderUnbind () const
 
float split (const Common::UString &line, std::vector< Common::UString > &lines, float maxWidth=0.0f, float maxHeight=0.0f, bool trim=true) const
 
float split (Common::UString &line, float maxWidth, float maxHeight=0.0f, bool trim=true) const
 
float split (const Common::UString &line, Common::UString &lines, float maxWidth, float maxHeight=0.0f, bool trim=true) const
 

Private Member Functions

void load (Common::SeekableReadStream *ttf, int height)
 
void rebuildPages ()
 
void addChar (uint32 c)
 
void drawMissing () const
 

Private Attributes

Common::ScopedPtr< TTFRenderer_ttf
 
Common::PtrVector< Page_pages
 
std::map< uint32, Char_chars
 
std::map< uint32, Char >::const_iterator _missingChar
 
float _missingWidth
 
uint32 _height
 

Detailed Description

Definition at line 50 of file ttffont.h.

Constructor & Destructor Documentation

◆ TTFFont() [1/2]

Graphics::Aurora::TTFFont::TTFFont ( Common::SeekableReadStream ttf,
int  height 
)

Definition at line 67 of file ttffont.cpp.

References load().

Here is the call graph for this function:

◆ TTFFont() [2/2]

Graphics::Aurora::TTFFont::TTFFont ( const Common::UString name,
int  height 
)

Definition at line 71 of file ttffont.cpp.

References Common::UString::c_str(), Aurora::kFileTypeTTF, load(), and ResMan.

Here is the call graph for this function:

◆ ~TTFFont()

Graphics::Aurora::TTFFont::~TTFFont ( )

Definition at line 79 of file ttffont.cpp.

Member Function Documentation

◆ addChar()

void Graphics::Aurora::TTFFont::addChar ( uint32  c)
private

◆ buildChars()

void Graphics::Aurora::TTFFont::buildChars ( const Common::UString str)
virtual

Build all necessary characters to display this string.

Reimplemented from Graphics::Font.

Definition at line 169 of file ttffont.cpp.

References addChar(), Common::UString::begin(), Common::UString::end(), and rebuildPages().

Here is the call graph for this function:

◆ draw()

void Graphics::Aurora::TTFFont::draw ( uint32  c) const
virtual

Draw this character.

Implements Graphics::Font.

Definition at line 143 of file ttffont.cpp.

References _chars, _missingChar, _pages, drawMissing(), and TextureMan.

Here is the call graph for this function:

◆ drawMissing()

void Graphics::Aurora::TTFFont::drawMissing ( ) const
private

Definition at line 128 of file ttffont.cpp.

References _height, _missingWidth, and TextureMan.

Referenced by draw().

Here is the caller graph for this function:

◆ getHeight()

float Graphics::Aurora::TTFFont::getHeight ( ) const
virtual

Return the height of a character.

Implements Graphics::Font.

Definition at line 124 of file ttffont.cpp.

References _height.

◆ getWidth()

float Graphics::Aurora::TTFFont::getWidth ( uint32  c) const
virtual

Return the width of a character.

Implements Graphics::Font.

Definition at line 116 of file ttffont.cpp.

References _chars, and _missingWidth.

◆ load()

void Graphics::Aurora::TTFFont::load ( Common::SeekableReadStream ttf,
int  height 
)
private

Definition at line 82 of file ttffont.cpp.

References _chars, _height, _missingChar, _missingWidth, _ttf, addChar(), kPageHeight, and rebuildPages().

Referenced by TTFFont().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rebuildPages()

void Graphics::Aurora::TTFFont::rebuildPages ( )
private

Definition at line 176 of file ttffont.cpp.

References _pages.

Referenced by buildChars(), and load().

Here is the caller graph for this function:

Member Data Documentation

◆ _chars

std::map<uint32, Char> Graphics::Aurora::TTFFont::_chars
private

Definition at line 96 of file ttffont.h.

Referenced by addChar(), draw(), getWidth(), and load().

◆ _height

uint32 Graphics::Aurora::TTFFont::_height
private

Definition at line 101 of file ttffont.h.

Referenced by addChar(), drawMissing(), getHeight(), and load().

◆ _missingChar

std::map<uint32, Char>::const_iterator Graphics::Aurora::TTFFont::_missingChar
private

Definition at line 98 of file ttffont.h.

Referenced by draw(), and load().

◆ _missingWidth

float Graphics::Aurora::TTFFont::_missingWidth
private

Definition at line 99 of file ttffont.h.

Referenced by drawMissing(), getWidth(), and load().

◆ _pages

Common::PtrVector<Page> Graphics::Aurora::TTFFont::_pages
private

Definition at line 95 of file ttffont.h.

Referenced by addChar(), draw(), and rebuildPages().

◆ _ttf

Common::ScopedPtr<TTFRenderer> Graphics::Aurora::TTFFont::_ttf
private

Definition at line 93 of file ttffont.h.

Referenced by addChar(), and load().


The documentation for this class was generated from the following files: