OpenGUI::FontSet Class Reference

#include <OpenGUI_FontSet.h>

Inheritance diagram for OpenGUI::FontSet:

OpenGUI::RefObject List of all members.

Detailed Description

Used to load fonts and render glyphs from those fonts into memory segments.


Public Member Functions

const StringgetFilename ()
 Returns the filename used to load the font.
const StringgetName ()
 Returns the name of this font.
bool getGlyph (const Char glyph_charCode, const IVector2 &pixelSize, FontGlyph &outFontGlyph)
 Retrieves the FontGlyph struct for a glyph glyph_charCode at the given pixelSize.
unsigned int getLineSpacing (unsigned int pointSize)
 Returns the line height in pixels for a given pixelSizeY.
int getAscender (unsigned int pointSize)
 Returns the font wide ascender in pixels for a given pointSize.
int getDescender (unsigned int pointSize)
 Returns the font wide descender in pixels for a given pointSize.
int getMaxAdvance (unsigned int pointSize)
 Returns the maximum horizontal advance for all characters at the given pointSize.
int getTextWidth (const IVector2 &pixelSize, const String &text)
 Returns the true width for the given text at the given pointSize.
void renderGlyph (const Char glyph_charCode, const IVector2 &pixelSize, TextureDataRect *destTDR, FontGlyphMetrics &destGlyphMetrics)
 Renders the requested glyph to the given TextureDataRect in the size specified.

Protected Member Functions

 FontSet (const String &sourceFilename, const String &fontName)
 Font creation implies loading of the font via FreeType.
 ~FontSet ()
 Destruction also unloads the font from FreeType.
virtual void finalize ()
 This is called when the last handle to this object is destroyed.


Constructor & Destructor Documentation

OpenGUI::FontSet::FontSet const String sourceFilename,
const String fontName
[protected]
 

Font creation implies loading of the font via FreeType.

Parameters:
sourceFilename filename of the font to load
fontName the friendly name for this FontSet

OpenGUI::FontSet::~FontSet  )  [protected]
 

Destruction also unloads the font from FreeType.


Member Function Documentation

void OpenGUI::FontSet::finalize  )  [protected, virtual]
 

This is called when the last handle to this object is destroyed.

Implements OpenGUI::RefObject.

int OpenGUI::FontSet::getAscender unsigned int  pointSize  ) 
 

Returns the font wide ascender in pixels for a given pointSize.

int OpenGUI::FontSet::getDescender unsigned int  pointSize  ) 
 

Returns the font wide descender in pixels for a given pointSize.

const String& OpenGUI::FontSet::getFilename  )  [inline]
 

Returns the filename used to load the font.

bool OpenGUI::FontSet::getGlyph const Char  glyph_charCode,
const IVector2 pixelSize,
FontGlyph &  outFontGlyph
 

Retrieves the FontGlyph struct for a glyph glyph_charCode at the given pixelSize.

Returns:
true on success, false if the glyph cannot be generated because of some FreeType error
Parameters:
[in] glyph_charCode The Unicode character code of the glyph you are requesting
[in] pixelSize The size of the glyph you'd like, in pixels. Translation to/from pixels is up to the user. (See: Screen::getPPU(), Screen::getUPI())
[out] outFontGlyph On success, this is initialized with information about the glyph.

unsigned int OpenGUI::FontSet::getLineSpacing unsigned int  pointSize  ) 
 

Returns the line height in pixels for a given pixelSizeY.

int OpenGUI::FontSet::getMaxAdvance unsigned int  pointSize  ) 
 

Returns the maximum horizontal advance for all characters at the given pointSize.

const String& OpenGUI::FontSet::getName  )  [inline]
 

Returns the name of this font.

int OpenGUI::FontSet::getTextWidth const IVector2 pixelSize,
const String text
 

Returns the true width for the given text at the given pointSize.

void OpenGUI::FontSet::renderGlyph const Char  glyph_charCode,
const IVector2 pixelSize,
TextureDataRect destTDR,
FontGlyphMetrics &  destGlyphMetrics
 

Renders the requested glyph to the given TextureDataRect in the size specified.

Note:
The TextureDataRect will be resized to exactly hold the glyph. destGlyphMetrics will contain the glyph metrics in pixels for the glyph at the requested size
Remarks:
This function is used by the FontCache to generate glyphs for storage in FontAtlases so that they can be renderer to the screen.
See also:
Most users are probably looking for BrushText, or at the most getGlyph().


The documentation for this class was generated from the following files:
Copyright © 2006 OpenGUI | OpenGUI.SF.net
Generated: Sun Sep 9 02:00:21 2007