gui::gl::font Class Reference

A texture containing characters. More...

#include <gui_gl_font.hpp>

Inheritance diagram for gui::gl::font:
gui::font

List of all members.

Public Member Functions

 font (const std::string &sFontFile, uint uiSize)
 Constructor.
 ~font ()
 Destructor.
std::array< float, 4 > get_character_uvs (uint uiChar) const
 Returns the uv coordinates of a character on the texture.
float get_character_width (uint uiChar) const
 Returns the width of a character in pixels.
float get_character_kerning (uint uiChar1, uint uiChar2) const
 Return the kerning amount between two characters.
utils::wptr< gui::materialget_texture () const
 Returns the underlying material to use for rendering.

Detailed Description

A texture containing characters.

This is the OpenGL implementation of the gui::font. It uses the freetype library to read data from .ttf and .otf files and to render the characters on the font texture.

Definition at line 28 of file gui_gl_font.hpp.


Constructor & Destructor Documentation

gui::gl::font::font ( const std::string &  sFontFile,
uint  uiSize 
)

Constructor.

Parameters:
sFontFile The name of the font file to read
uiSize The requested size in pixels of the font

Definition at line 15 of file gui_gl_font.cpp.

gui::gl::font::~font (  )  [virtual]

Destructor.

Reimplemented from gui::font.

Definition at line 188 of file gui_gl_font.cpp.


Member Function Documentation

float gui::gl::font::get_character_kerning ( uint  uiChar1,
uint  uiChar2 
) const [virtual]

Return the kerning amount between two characters.

Parameters:
uiChar1 The first unicode character
uiChar2 The second unicode character
Returns:
The kerning amount between the two characters
Note:
Kerning is a font rendering adjustment that makes some letters closer, for example in 'VA', there is room for the two to be closer than with 'VW'. This has no effect for fixed width fonts (like Courrier, etc).

Implements gui::font.

Definition at line 204 of file gui_gl_font.cpp.

std::array< float, 4 > gui::gl::font::get_character_uvs ( uint  uiChar  )  const [virtual]

Returns the uv coordinates of a character on the texture.

Parameters:
uiChar The unicode character
Returns:
The uv coordinates of this character on the texture
Note:
The uv coordinates are normalisez, i.e. they range from 0 to 1. They are arranged as {u1, v1, u2, v2}.

Implements gui::font.

Definition at line 192 of file gui_gl_font.cpp.

float gui::gl::font::get_character_width ( uint  uiChar  )  const [virtual]

Returns the width of a character in pixels.

Parameters:
uiChar The unicode character
Returns:
The width of the character in pixels.

Implements gui::font.

Definition at line 198 of file gui_gl_font.cpp.

utils::wptr< gui::material > gui::gl::font::get_texture (  )  const [virtual]

Returns the underlying material to use for rendering.

Returns:
The underlying material to use for rendering

Implements gui::font.

Definition at line 212 of file gui_gl_font.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 1 21:58:12 2013 for gui by  doxygen 1.6.1