#include <View2DFont.h>
Public Types | |
| enum | AlignXMode { ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER } |
| align mode of multi-line text More... | |
Public Member Functions | |
| View2DFont () | |
| ~View2DFont () | |
| bool | init (const char *fontname) |
| init with given font (either just a font name without .ttf or an absolute path) requires a valid GL context! | |
| bool | init (const char *fontname, int numFonts, int *sizes) |
| init with given font (either just a font name without .ttf or an absolute path) additionally you can select how many fonts are created internally and in which sizes requires a valid GL context! | |
| int | getFontHeight (const float fontSize) const |
| get height of font (ascender + descender) | |
| int | getFontAscender (const float fontSize) const |
| get ascender of font | |
| int | getFontDescender (const float fontSize) const |
| get descender of font | |
| int | getStringWidth (const float fontSize, const char *string, const int len) const |
| get width of simple string | |
| void | getTextSize (const float fontSize, const char *text, int &width, int &height, float lineSpacing=0.0f) const |
| returns size of the box spanned by text box | |
| void | drawString (const float dx, const float dy, const float fontSize, const float *color, const char *string, const int length, const bool shadow=true) |
| draws a simple string with no linefeeds, the drawing starts at the top-left corner | |
| void | drawText (const float dx, const float dy, const float fontSize, const float *color, const char *text, const AlignXMode mode, const bool shadow=true, float lineSpacing=0.0f) |
| draws a multi-line text, lines are separated by , the drawing starts at the top-left corner | |
Most calls are bridged towards mlGL2DFont, but it additionally features rendering of larger text blocks including line feeds. All strings are expected to be in UTF8 encoding.
Font rendering of all draw methods starts at top-left (x,y).
Definition at line 32 of file View2DFont.h.
| View2DFont::View2DFont | ( | ) |
| View2DFont::~View2DFont | ( | ) |
| void View2DFont::drawString | ( | const float | dx, | |
| const float | dy, | |||
| const float | fontSize, | |||
| const float * | color, | |||
| const char * | string, | |||
| const int | length, | |||
| const bool | shadow = true | |||
| ) |
draws a simple string with no linefeeds, the drawing starts at the top-left corner
| void View2DFont::drawText | ( | const float | dx, | |
| const float | dy, | |||
| const float | fontSize, | |||
| const float * | color, | |||
| const char * | text, | |||
| const AlignXMode | mode, | |||
| const bool | shadow = true, |
|||
| float | lineSpacing = 0.0f | |||
| ) |
draws a multi-line text, lines are separated by
, the drawing starts at the top-left corner
| int View2DFont::getFontAscender | ( | const float | fontSize | ) | const |
get ascender of font
| int View2DFont::getFontDescender | ( | const float | fontSize | ) | const |
get descender of font
| int View2DFont::getFontHeight | ( | const float | fontSize | ) | const |
get height of font (ascender + descender)
| int View2DFont::getStringWidth | ( | const float | fontSize, | |
| const char * | string, | |||
| const int | len | |||
| ) | const |
get width of simple string
| void View2DFont::getTextSize | ( | const float | fontSize, | |
| const char * | text, | |||
| int & | width, | |||
| int & | height, | |||
| float | lineSpacing = 0.0f | |||
| ) | const |
returns size of the box spanned by text box
| bool View2DFont::init | ( | const char * | fontname, | |
| int | numFonts, | |||
| int * | sizes | |||
| ) |
init with given font (either just a font name without .ttf or an absolute path) additionally you can select how many fonts are created internally and in which sizes requires a valid GL context!
| bool View2DFont::init | ( | const char * | fontname | ) |
init with given font (either just a font name without .ttf or an absolute path) requires a valid GL context!
1.5.8