Hasty Badger
Small UI library (a branch of Turbo Badger)
|
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... | |
TBFontEffect * | GetEffect () |
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... | |
TBFontFace represents a loaded font that can measure and render strings.
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).
|
inline |
Get the vertical distance (positive) from the horizontal baseline to the highest character coordinate in a font face.
|
inline |
Get the vertical distance (positive) from the horizontal baseline to the lowest character coordinate in the font face.
|
inline |
Get the effect object, so the effect can be changed.
Note: No glyphs are re-rendered. Only new glyphs are affected.
|
inline |
Get the font description that was used to create this font.
|
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.