Convenience class to simplify rendering text.
More...
#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/graphics/al_Font.hpp>
|
void | write (const char *text, float worldHeight=1.0f) |
|
void | render (Graphics &g) |
|
void | renderAt (Graphics &g, Vec3d position) |
|
bool | load (const char *filename, int fontSize, int bitmapSize) |
|
void | write (Mesh &mesh, const char *text, float worldHeight) |
|
void | alignLeft () |
| Returns the width of a text string, in pixels. More...
|
|
void | alignCenter () |
|
void | alignRight () |
|
|
static void | render (Graphics &g, const char *text, Vec3d position, float worldHeight=1.0, int fontSize=24, const char *filename=Font::defaultFont().c_str(), int bitmapSize=1024) |
|
static std::string | defaultFont () |
|
|
Mesh | fontMesh |
|
Impl * | impl |
|
Texture | tex |
|
float | alignFactorX = 0.0f |
|
Convenience class to simplify rendering text.
Definition at line 138 of file al_Font.hpp.
◆ alignLeft()
void al::Font::alignLeft |
( |
| ) |
|
|
inlineinherited |
Returns the width of a text string, in pixels.
Returns the width of a character, in pixels Returns the "above-line" height of the font, in pixels Returns the "below-line" height of the font, in pixels Returns the total height of the font, in pixels Set alignment of rendered text strings
- Parameters
-
[in] | xfrac | Fraction along text width to render at x=0; 0 is left-aligned, 0.5 is centered, 1 is right-aligned |
[in] | yfrac | Fraction along text height to render at y=0 |
Definition at line 127 of file al_Font.hpp.
◆ load()
bool al::Font::load |
( |
const char * |
filename, |
|
|
int |
fontSize, |
|
|
int |
bitmapSize |
|
) |
| |
|
inherited |
Load font from file
- Parameters
-
[in] | filename | path to font file |
[in] | fontSize | size of font |
[in] | bitmapSize | size of font bitmap |
- Returns
- whether font loaded successfully
◆ write()
void al::Font::write |
( |
Mesh & |
mesh, |
|
|
const char * |
text, |
|
|
float |
worldHeight |
|
) |
| |
|
inherited |
Render text geometry Render text into geometry for drawing a string of text using the bitmap returned by ascii_chars. Render expects the vertex and texcoord buffers to be at least as big as the text length * 4 since each character is rendered by a quad.
Example usage:
Mesh mesh;
font.write(mesh, "allocore");
font.texture().bind();
g.draw(mesh);
font.texture().unbind();
The documentation for this struct was generated from the following file: