class
AbstractRendererBase for text renderers.
Contents
Not meant to be used directly, see Renderer for more information.
Derived classes
-
template<UnsignedInt dimensions>class Renderer
- Text renderer.
Public static functions
-
static auto render(AbstractFont& font,
const GlyphCache& cache,
Float size,
const std::
string& text, Alignment alignment = Alignment:: LineLeft) -> std:: tuple<std:: vector<Vector2>, std:: vector<Vector2>, std:: vector<UnsignedInt>, Range2D> - Render text.
Public functions
- auto capacity() const -> UnsignedInt
- Capacity for rendered glyphs.
- auto rectangle() const -> Range2D
- Rectangle spanning the rendered text.
- auto vertexBuffer() -> GL::Buffer&
- Vertex buffer.
- auto indexBuffer() -> GL::Buffer&
- Index buffer.
- auto mesh() -> GL::Mesh&
- Mesh.
-
void reserve(UnsignedInt glyphCount,
GL::
BufferUsage vertexBufferUsage, GL:: BufferUsage indexBufferUsage) - Reserve capacity for rendered glyphs.
-
void render(const std::
string& text) - Render text.
Function documentation
static std:: tuple<std:: vector<Vector2>, std:: vector<Vector2>, std:: vector<UnsignedInt>, Range2D> Magnum:: Text:: AbstractRenderer:: render(AbstractFont& font,
const GlyphCache& cache,
Float size,
const std:: string& text,
Alignment alignment = Alignment:: LineLeft)
Render text.
Parameters | |
---|---|
font | Font |
cache | Glyph cache |
size | Font size |
text | Text to render |
alignment | Text alignment |
Returns tuple with vertex positions, texture coordinates, indices and rectangle spanning the rendered text.
UnsignedInt Magnum:: Text:: AbstractRenderer:: capacity() const
Capacity for rendered glyphs.
void Magnum:: Text:: AbstractRenderer:: reserve(UnsignedInt glyphCount,
GL:: BufferUsage vertexBufferUsage,
GL:: BufferUsage indexBufferUsage)
Reserve capacity for rendered glyphs.
Reallocates memory in buffers to hold glyphCount
glyphs and prefills index buffer. Consider using appropriate vertexBufferUsage
if the text will be changed frequently. Index buffer is changed only by calling this function, thus indexBufferUsage
generally doesn't need to be so dynamic if the capacity won't be changed much.
Initially zero capacity is reserved.
void Magnum:: Text:: AbstractRenderer:: render(const std:: string& text)
Render text.
Renders the text to vertex buffer, reusing index buffer already filled with reserve(). Rectangle spanning the rendered text is available through rectangle().
Initially no text is rendered.