Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Font Class Reference

#include <Font.hpp>

Public Member Functions

float lineHeight () const
 
 Font (TextRenderer *textRenderer, string const &fontName, const uint fontSize)
 
virtual ~Font ()
 
void draw (string const &text, vec4 const &color, vec2 position, HAlign hAlign=HAlign::Left, VAlign vAlign=VAlign::Bottom, vec2 const &scale=vec2(1, 1))
 
vec2 measure (string const &text)
 

Private Types

typedef map< char, Glyphglyph_map
 

Private Member Functions

void prepare (string const &text)
 

Private Attributes

TextRendererm_textRenderer
 
string m_name
 
uint m_size
 
uvec2 m_atlasSize
 
vector< char > m_atlasData
 
uint m_atlas
 
glyph_map m_glyphs
 
float m_lineHeight
 

Friends

class TextRenderer
 

Detailed Description

Font holds a font with a given name and a given size.

Definition at line 20 of file Font.hpp.

Member Typedef Documentation

typedef map<char, Glyph> glyph_map
private

Definition at line 22 of file Font.hpp.

Constructor & Destructor Documentation

Font ( TextRenderer textRenderer,
string const &  fontName,
const uint  fontSize 
)

Constructs a Font-object. Loads the necessary data from the given file.

Parameters
textRendererThe TextRenderer that holds this font.
fontNameThe name of the font
fontSizeThe size of the font

Definition at line 4 of file Font.cpp.

~Font ( )
virtual

Destructs the Font-object.

Definition at line 122 of file Font.cpp.

Member Function Documentation

void draw ( string const &  text,
vec4 const &  color,
vec2  position,
HAlign  hAlign = HAlign::Left,
VAlign  vAlign = VAlign::Bottom,
vec2 const &  scale = vec2(1,1) 
)

Draws the given text.

Parameters
textThe text to be drawn.
colorThe color of the text
positionThe position of the text
hAlignThe horizontal alignment of the text
vAlignThe vertical alignment of the text
scaleThe scale of the text

Definition at line 185 of file Font.cpp.

float lineHeight ( ) const
inline

Accessor to the line-height.

Returns
The line-height.

Definition at line 40 of file Font.hpp.

vec2 measure ( string const &  text)

Measures the size of the given text

Parameters
textThe text to be measured
Returns
The size of the given text.

Definition at line 126 of file Font.cpp.

void prepare ( string const &  text)
private

Sets up the vertices for rendering the given text.

Parameters
textThe text to be rendered

Definition at line 148 of file Font.cpp.

Friends And Related Function Documentation

friend class TextRenderer
friend

Definition at line 33 of file Font.hpp.

Member Data Documentation

uint m_atlas
private

The texture-id of the texture-atlas

Definition at line 29 of file Font.hpp.

vector<char> m_atlasData
private

The data in the texture-atlas

Definition at line 28 of file Font.hpp.

uvec2 m_atlasSize
private

The size of the texture-atlas

Definition at line 27 of file Font.hpp.

glyph_map m_glyphs
private

A map of all glyphs by their char-code

Definition at line 30 of file Font.hpp.

float m_lineHeight
private

The line-height of this font

Definition at line 31 of file Font.hpp.

string m_name
private

The name of the font

Definition at line 25 of file Font.hpp.

uint m_size
private

The size of the font

Definition at line 26 of file Font.hpp.

TextRenderer* m_textRenderer
private

The TextRenderer that holds this font.

Definition at line 24 of file Font.hpp.


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