xoreos  0.0.5
Public Member Functions | Private Member Functions | List of all members
Graphics::Font Class Referenceabstract

An abstract font. More...

#include <font.h>

Inheritance diagram for Graphics::Font:
Inheritance graph
[legend]

Public Member Functions

 Font ()
 
virtual ~Font ()
 
virtual float getWidth (uint32 c) const =0
 Return the width of a character. More...
 
virtual float getHeight () const =0
 Return the height of a character. More...
 
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 buildChars (const Common::UString &str)
 Build all necessary characters to display this string. More...
 
virtual void draw (uint32 c) const =0
 Draw this character. 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

bool addLine (std::vector< Common::UString > &lines, const Common::UString &newLine, float maxHeight) const
 

Detailed Description

An abstract font.

Definition at line 39 of file font.h.

Constructor & Destructor Documentation

◆ Font()

Graphics::Font::Font ( )

Definition at line 33 of file font.cpp.

◆ ~Font()

Graphics::Font::~Font ( )
virtual

Definition at line 36 of file font.cpp.

Member Function Documentation

◆ addLine()

bool Graphics::Font::addLine ( std::vector< Common::UString > &  lines,
const Common::UString newLine,
float  maxHeight 
) const
private

Definition at line 266 of file font.cpp.

References getHeight().

Referenced by split().

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

◆ buildChars()

void Graphics::Font::buildChars ( const Common::UString str)
virtual

Build all necessary characters to display this string.

Reimplemented in Graphics::Aurora::TTFFont.

Definition at line 66 of file font.cpp.

Referenced by Graphics::Aurora::Text::set(), and Graphics::Aurora::Text::setText().

Here is the caller graph for this function:

◆ draw()

virtual void Graphics::Font::draw ( uint32  c) const
pure virtual

Draw this character.

Implemented in Graphics::Aurora::TextureFont, Graphics::Aurora::TTFFont, Graphics::Aurora::ABCFont, and Graphics::Aurora::NFTRFont.

Referenced by Graphics::Aurora::Text::drawLine().

Here is the caller graph for this function:

◆ getHeight() [1/2]

virtual float Graphics::Font::getHeight ( ) const
pure virtual

◆ getHeight() [2/2]

float Graphics::Font::getHeight ( const Common::UString text,
float  maxWidth = 0.0f,
float  maxHeight = 0.0f 
) const

Return the height this string would take.

Definition at line 57 of file font.cpp.

References getHeight(), getLineCount(), and getLineSpacing().

Here is the call graph for this function:

◆ getLineCount()

size_t Graphics::Font::getLineCount ( const Common::UString text,
float  maxWidth = 0.0f,
float  maxHeight = 0.0f 
) const

Return the number of lines this text spans.

Definition at line 43 of file font.cpp.

References split().

Referenced by getHeight(), Graphics::Aurora::Text::set(), Graphics::Aurora::Text::setSize(), and Graphics::Aurora::Text::setText().

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

◆ getLineSpacing()

float Graphics::Font::getLineSpacing ( ) const
virtual

◆ getLineWidth()

float Graphics::Font::getLineWidth ( const Common::UString text) const

Return the width of this string.

Definition at line 257 of file font.cpp.

References Common::UString::begin(), Common::UString::end(), and getWidth().

Referenced by Engines::ConsoleWindow::ConsoleWindow(), Graphics::Aurora::Text::drawLine(), and Graphics::Aurora::Text::drawLineImmediate().

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

◆ getWidth() [1/2]

virtual float Graphics::Font::getWidth ( uint32  c) const
pure virtual

◆ getWidth() [2/2]

float Graphics::Font::getWidth ( const Common::UString text,
float  maxWidth = 0.0f 
) const

Return the width this string would take.

Definition at line 51 of file font.cpp.

References split().

Here is the call graph for this function:

◆ render()

virtual void Graphics::Font::render ( uint32  c,
float &  x,
float &  y,
float *  rgba 
) const
inlinevirtual

Reimplemented in Graphics::Aurora::TextureFont, and Graphics::Aurora::ABCFont.

Definition at line 69 of file font.h.

Referenced by Graphics::Aurora::Text::drawLineImmediate().

Here is the caller graph for this function:

◆ renderBind()

virtual void Graphics::Font::renderBind ( const glm::mat4 &  transform) const
inlinevirtual

Reimplemented in Graphics::Aurora::TextureFont, and Graphics::Aurora::ABCFont.

Definition at line 68 of file font.h.

Referenced by Graphics::Aurora::Text::renderImmediate().

Here is the caller graph for this function:

◆ renderUnbind()

virtual void Graphics::Font::renderUnbind ( ) const
inlinevirtual

Reimplemented in Graphics::Aurora::TextureFont, and Graphics::Aurora::ABCFont.

Definition at line 70 of file font.h.

Referenced by Graphics::Aurora::Text::renderImmediate().

Here is the caller graph for this function:

◆ split() [1/3]

float Graphics::Font::split ( const Common::UString line,
std::vector< Common::UString > &  lines,
float  maxWidth = 0.0f,
float  maxHeight = 0.0f,
bool  trim = true 
) const

◆ split() [2/3]

float Graphics::Font::split ( Common::UString line,
float  maxWidth,
float  maxHeight = 0.0f,
bool  trim = true 
) const

Definition at line 237 of file font.cpp.

References split().

Here is the call graph for this function:

◆ split() [3/3]

float Graphics::Font::split ( const Common::UString line,
Common::UString lines,
float  maxWidth,
float  maxHeight = 0.0f,
bool  trim = true 
) const

Definition at line 241 of file font.cpp.

References Common::UString::clear(), Common::UString::empty(), and split().

Here is the call graph for this function:

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