Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# Keos::CFontManager Class Reference

Font manager. More...

`#include <KeosFontManager.h>`

Inheritance diagram for Keos::CFontManager:

List of all members.

## Public Member Functions

void | LoadFont (const String &strFontFile, const String &strFontName, int nQuality=16)
| Load a font.
void | UnloadFonts ()
| Unload all the fonts.
void | DrawString (const CGraphicString &String)
| Draw a string on the screen.
TVector2I | GetStringPixelSize (const CGraphicString &String)
| Return the size of a graphic string in pixels.
size_t | GetFontHeight (const String &strFontName)
| Return the height (pixels) of the font.

## Private Types

typedef ushort | TIndex
| Indices type.
typedef std::map< String, TFont > | TFontsMap

## Private Member Functions

| CFontManager ()
| Default constructor.
| ~CFontManager ()
| Destructor.
void | Initialize ()
| Initialize data.

## Private Attributes

TFontsMap | m_Fonts
CBuffer< TVertex > | m_VertexBuffer
| Map containing the textures of fonts, associated to their name.
CBuffer< TIndex > | m_IndexBuffer
| Vertex buffer.
CDeclarationPtr | m_Declaration
| Index buffer.

## Static Private Attributes

static const unsigned int | NbCharMax = 512

## Friends

class | CSingleton<CFontManager>

## Classes

struct | Glyph
| Glyph structure. More...
struct | TFont
| Font structure. More...
struct | TVertex
| Structure of the vertices. More...

## Detailed Description

Font manager.

Definition at line 35 of file KeosFontManager.h.

## Member Typedef Documentation

typedef std::map<String, TFont> Keos::CFontManager::TFontsMap`[private]`

| Definition at line 114 of file KeosFontManager.h.

typedef ushort Keos::CFontManager::TIndex`[private]`

| Indices type. Definition at line 90 of file KeosFontManager.h.

## Constructor & Destructor Documentation

Keos::CFontManager::CFontManager | ( |  | ) | `[private]`

| Default constructor. Definition at line 39 of file KeosFontManager.cpp.

Keos::CFontManager::~CFontManager | ( |  | ) | `[private]`

| Destructor. Definition at line 45 of file KeosFontManager.cpp. References UnloadFonts().

## Member Function Documentation

void Keos::CFontManager::DrawString | ( | const CGraphicString & | String | ) |

| Draw a string on the screen.

Parameters:

  | String | Graphic string to be displayed.

Definition at line 261 of file KeosFontManager.cpp.

References Keos::CFontManager::Glyph::Advance, Keos::BLEND_INVSRCALPHA, Keos::BLEND_SRCALPHA, Keos::CFontManager::TVertex::Diffuse, Keos::CTexture::GetTexture(), Keos::CFontManager::TFont::GlyphsTable, Initialize(), Keos::CFontManager::TFont::LineHeight, LOADINGFAILED_EXCEPT, Keos::CBuffer< T >::Lock(), Keos::LOCK_WRITEONLY, m_Declaration, m_Fonts, m_IndexBuffer, m_VertexBuffer, NbCharMax, Keos::CFontManager::TVertex::Position, Keos::PT_TRIANGLELIST, Keos::RENDER_ALPHABLEND, Keos::RENDER_ZWRITE, Renderer, Keos::CVector2< T >::Set(), Keos::CVector3< T >::Set(), Keos::CFontManager::Glyph::Tex_x1, Keos::CFontManager::Glyph::Tex_x2, Keos::CFontManager::Glyph::Tex_y1, Keos::CFontManager::TVertex::TexCoords, Keos::CFontManager::TFont::Texture, Keos::CFontManager::TFont::TextureLineHeight, Keos::TXA_DIFFUSE, Keos::TXA_TEXTURE, Keos::TXO_ALPHA_MODULATE, Keos::TXO_COLOR_MODULATE, and Keos::CBuffer< T >::Unlock().

size_t Keos::CFontManager::GetFontHeight | ( | const String & | strFontName | ) |

| Return the height (pixels) of the font. Definition at line 428 of file KeosFontManager.cpp. References LOADINGFAILED_EXCEPT, m_Fonts, and size_t.

TVector2I Keos::CFontManager::GetStringPixelSize | ( | const CGraphicString & | String | ) |

| Return the size of a graphic string in pixels.

Parameters:

  | String | Graphic string.

Returns:
  Size of the string in pixels.

Definition at line 365 of file KeosFontManager.cpp.

References Keos::CFontManager::Glyph::Advance, Keos::CFontManager::TFont::GlyphsTable, int(), Keos::CFontManager::TFont::LineHeight, LOADINGFAILED_EXCEPT, m_Fonts, Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

void Keos::CFontManager::Initialize | ( |  | ) | `[private]`

| Initialize data. Definition at line 51 of file KeosFontManager.cpp. References Keos::BUF_DYNAMIC, Keos::ELT_TYPE_COLOR, Keos::ELT_TYPE_FLOAT2, Keos::ELT_TYPE_FLOAT3, Keos::ELT_USAGE_DIFFUSE, Keos::ELT_USAGE_POSITION, Keos::ELT_USAGE_TEXCOORD0, m_Declaration, m_IndexBuffer, m_VertexBuffer, NbCharMax, and Renderer.

Referenced by DrawString().

void Keos::CFontManager::LoadFont | ( | const String & | strFontFile,
|  | const String & | strFontName,
|  | int | nQuality = `16`
| ) |

| Load a font.

Parameters:

  | strFontFile | Name of the file with the font.
  | strFontName | Name of the font.
  | nQuality | Size of the font.

Definition at line 80 of file KeosFontManager.cpp.

References Keos::CFile::Fullname(), Keos::CImage::GetPixel(), LOADINGFAILED_EXCEPT, m_Fonts, Keos::PXF_A8L8, Keos::PXF_L8, Keos::CImage::SetPixel(), and Keos::TEX_NOMIPMAP.

void Keos::CFontManager::UnloadFonts | ( |  | ) |

| Unload all the fonts. Definition at line 248 of file KeosFontManager.cpp. References m_Fonts. Referenced by ~CFontManager().

## Friends And Related Function Documentation

friend class CSingleton<CFontManager>`[friend]`

| Definition at line 37 of file KeosFontManager.h.

## Member Data Documentation

CDeclarationPtr Keos::CFontManager::m_Declaration`[private]`

| Index buffer. Definition at line 121 of file KeosFontManager.h. Referenced by DrawString(), and Initialize().

TFontsMap Keos::CFontManager::m_Fonts`[private]`

| Definition at line 118 of file KeosFontManager.h. Referenced by DrawString(), GetFontHeight(), GetStringPixelSize(), LoadFont(), and UnloadFonts().

CBuffer<TIndex> Keos::CFontManager::m_IndexBuffer`[private]`

| Vertex buffer. Definition at line 120 of file KeosFontManager.h. Referenced by DrawString(), and Initialize().

CBuffer<TVertex> Keos::CFontManager::m_VertexBuffer`[private]`

| Map containing the textures of fonts, associated to their name. Definition at line 119 of file KeosFontManager.h. Referenced by DrawString(), and Initialize().

const unsigned int Keos::CFontManager::NbCharMax = 512`[static, private]`

| Definition at line 116 of file KeosFontManager.h. Referenced by DrawString(), and Initialize().

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

- KeosEngine/KeosFontManager.h
- KeosEngine/KeosFontManager.cpp