class
#include <Magnum/Text/GlyphCache.h>
GlyphCache Glyph cache.
Contains font glyphs rendered into a texture atlas.
Usage
Create the GlyphCache object with sufficient size and then call AbstractFont::
Containers::Pointer<Text::AbstractFont> font = …; font->openFile("font.ttf", 12.0f); Text::GlyphCache cache{Vector2i{128}}; font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789?!:;,. ");
See the Renderer class for information about text rendering. The AbstractGlyphCache base class has more information about general glyph cache usage.
Base classes
- class AbstractGlyphCache new in 2019.10
- Base for glyph caches.
Derived classes
- class DistanceFieldGlyphCache
- Glyph cache with distance field rendering.
Constructors, destructors, conversion operators
-
GlyphCache(GL::
TextureFormat internalFormat, const Vector2i& originalSize, const Vector2i& size, const Vector2i& padding) explicit - Constructor.
-
GlyphCache(GL::
TextureFormat internalFormat, const Vector2i& size, const Vector2i& padding = {}) explicit - Constructor.
- GlyphCache(const Vector2i& originalSize, const Vector2i& size, const Vector2i& padding) explicit
- Constructor.
- GlyphCache(const Vector2i& size, const Vector2i& padding = {}) explicit
- Constructor.
Public functions
-
auto texture() -> GL::
Texture2D& - Cache texture.
Function documentation
Magnum:: Text:: GlyphCache:: GlyphCache(GL:: TextureFormat internalFormat,
const Vector2i& originalSize,
const Vector2i& size,
const Vector2i& padding) explicit
Constructor.
Parameters | |
---|---|
internalFormat | Internal texture format |
originalSize | Unscaled glyph cache texture size in pixels |
size | Actual glyph cache texture size in pixels |
padding | Padding around every glyph in pixels |
All glyphs parameters are saved relative to originalSize
, although the actual glyph cache texture has size
. Glyph padding
can be used to account for e.g. glyph shadows.
Magnum:: Text:: GlyphCache:: GlyphCache(GL:: TextureFormat internalFormat,
const Vector2i& size,
const Vector2i& padding = {}) explicit
Constructor.
Same as calling the above with originalSize
and size
being set to the same value.
Magnum:: Text:: GlyphCache:: GlyphCache(const Vector2i& originalSize,
const Vector2i& size,
const Vector2i& padding) explicit
Constructor.
Sets the internal texture format to single-channel. On OpenGL ES 3.0+ and WebGL 2 uses GL::
Magnum:: Text:: GlyphCache:: GlyphCache(const Vector2i& size,
const Vector2i& padding = {}) explicit
Constructor.
Same as calling the above with originalSize
and size
being set to the same value.