This file manages font output. Fonts are managed inside a font list, and for each font a render function, a size function and optionally a 'font' parameter that would be passed to the render and size functions. Two versions of size and render functions are supported, one that specifies the size and the other that does not do such a thing. Only one shall be active. When the funt is used, correct function is determined, and font size may be adjusted by code in this file in case the font renderer does not support it. If a bitmap font is being rendered then this file cannot do much to resize it.
Definition in file fonts.cpp.
#include <vector>
#include <GL/gl.h>
#include "fonts.h"
Go to the source code of this file.
Functions | |
glictFont * | glictCreateFont (const char *name) |
Creates the font for further use. | |
bool | glictDeleteFont (const char *name) |
glictFont * | glictFindFont (const char *name) |
int | glictFontNumberOfLines (const char *txt) |
bool | glictFontRender (const char *text, const char *fontname, float fontsize, float x, float y) |
Renders the font using specified size. | |
bool | glictFontRender (const char *text, const char *fontname, float x, float y) |
Renders the font using default size. | |
float | glictFontSize (const char *text, const char *font, float size) |
float | glictFontSize (const char *text, const char *font) |
Variables | |
_GLICTFONTVECTOR | glictFonts |
glictFont* glictCreateFont | ( | const char * | name | ) |
Creates the font for further use.
name | Specifies the font name that'll be used when referencing to this font |
bool glictFontRender | ( | const char * | text, | |
const char * | fontname, | |||
float | fontsize, | |||
float | x, | |||
float | y | |||
) |
Renders the font using specified size.
text | Specifies the text being drawn | |
fontname | Specifies name of font used for rendering | |
fontsize | Specifies size of font used for rendering | |
x | X coordinate of destination | |
y | Y coordinate of destination |
If needed to call many times, you should consider finding the class of the font you're trying to render using glictFindFont() and remember its pointer, then call it directly, especially if you load tons of fonts.
Default size is set to 10. Font resizer believes the font is rendered at size 1.
There is an overloaded variant of this function that renders using default font size.
bool glictFontRender | ( | const char * | text, | |
const char * | fontname, | |||
float | x, | |||
float | y | |||
) |
Renders the font using default size.
text | Specifies the text being drawn | |
fontname | Specifies name of font used for rendering | |
x | X coordinate of destination | |
y | Y coordinate of destination |
If needed to call many times, you should consider finding the class of the font you're trying to render using glictFindFont() and remember its pointer, then call it directly, especially if you load tons of fonts.
Default size is set to 10. Font resizer believes the font is rendered at size 1.
There is an overloaded variant of this function that allows specifying font size as third parameter.
Definition at line 119 of file fonts.cpp.
Referenced by glictFontRender(), glictWindow::Paint(), glictTextbox::Paint(), glictScrollbar::Paint(), glictPanel::Paint(), and glictButton::Paint().