class
#include <Magnum/Text/GlyphCache.h>
GlyphCache Glyph cache.
Contains font glyphs prerendered into texture atlas.
Usage
Create GlyphCache object with sufficient size and then call AbstractFont::
Containers::Pointer<Text::AbstractFont> font = …; Text::GlyphCache cache{Vector2i{512}}; font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789?!:;,. ");
See Renderer for information about text rendering.
This class supports the GlyphCacheFeature::
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 |
size | Actual glyph cache texture size |
padding | Padding around every glyph |
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
the same.
Magnum:: Text:: GlyphCache:: GlyphCache(const Vector2i& originalSize,
const Vector2i& size,
const Vector2i& padding) explicit
Constructor.
Sets internal texture format to red channel only. On desktop OpenGL requires ARB_
Magnum:: Text:: GlyphCache:: GlyphCache(const Vector2i& size,
const Vector2i& padding = {}) explicit
Constructor.
Same as calling the above with originalSize
and size
the same.