Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBFontFace Class Reference

TBFontFace represents a loaded font that can measure and render strings. More...

#include <tb_font_renderer.h>

Public Member Functions

 TBFontFace (TBFontGlyphCache *glyph_cache, TBFontRenderer *renderer, const TBFontDescription &font_desc)
 
bool RenderGlyphs (const char *glyph_str, int glyph_str_len=TB_ALL_TO_TERMINATION)
 Render all glyphs needed to display the string. More...
 
int GetAscent () const
 Get the vertical distance (positive) from the horizontal baseline to the highest character coordinate in a font face. More...
 
int GetDescent () const
 Get the vertical distance (positive) from the horizontal baseline to the lowest character coordinate in the font face. More...
 
int GetHeight () const
 Get height of the font in pixels. More...
 
TBFontDescription GetFontDescription () const
 Get the font description that was used to create this font. More...
 
TBFontEffectGetEffect ()
 Get the effect object, so the effect can be changed. More...
 
void DrawString (int x, int y, const TBColor &color, const char *str, int len=TB_ALL_TO_TERMINATION)
 Draw string at position x, y (marks the upper left corner of the text). More...
 
int GetStringWidth (const char *str, int len=TB_ALL_TO_TERMINATION)
 Measure the width of the given string. More...
 
void SetBackgroundFont (TBFontFace *font, const TBColor &col, int xofs, int yofs)
 Set a background font which will always be rendered behind this one when calling DrawString. More...
 

Detailed Description

TBFontFace represents a loaded font that can measure and render strings.

Member Function Documentation

void tb::TBFontFace::DrawString ( int  x,
int  y,
const TBColor color,
const char *  str,
int  len = TB_ALL_TO_TERMINATION 
)

Draw string at position x, y (marks the upper left corner of the text).

int tb::TBFontFace::GetAscent ( ) const
inline

Get the vertical distance (positive) from the horizontal baseline to the highest character coordinate in a font face.

int tb::TBFontFace::GetDescent ( ) const
inline

Get the vertical distance (positive) from the horizontal baseline to the lowest character coordinate in the font face.

TBFontEffect* tb::TBFontFace::GetEffect ( )
inline

Get the effect object, so the effect can be changed.

Note: No glyphs are re-rendered. Only new glyphs are affected.

TBFontDescription tb::TBFontFace::GetFontDescription ( ) const
inline

Get the font description that was used to create this font.

int tb::TBFontFace::GetHeight ( ) const
inline

Get height of the font in pixels.

int tb::TBFontFace::GetStringWidth ( const char *  str,
int  len = TB_ALL_TO_TERMINATION 
)

Measure the width of the given string.

Should measure len characters or to the null termination (whatever comes first).

bool tb::TBFontFace::RenderGlyphs ( const char *  glyph_str,
int  glyph_str_len = TB_ALL_TO_TERMINATION 
)

Render all glyphs needed to display the string.

void tb::TBFontFace::SetBackgroundFont ( TBFontFace font,
const TBColor col,
int  xofs,
int  yofs 
)

Set a background font which will always be rendered behind this one when calling DrawString.

Very usefull to add a shadow effect to a font.


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