GlyphRun contains the memory structures that are needed to render a text string. More...
#include <kanzi/core.ui/text/glyph_run.hpp>
Public Member Functions | |
void | allocateClippingCoordinates () |
Allocates the space for the clipping coordinates. | |
void | draw (Renderer3D &renderer, GlyphCache &glyphCache, bool twoPass, const Material &material) |
Renders the glyph run. | |
RectangleFloat | getBoundingRectangle () const |
Returns the bounding box for the whole glyph run, with clipping. | |
RectangleFloat | getCharacterBounds (unsigned int glyphRunIndex) const |
Returns the unclipped bounding box for the given glyph, as set by setCharacterBounds(). | |
GlyphRun (Domain *domain, unsigned int capacity) | |
Constructs a glyph run with given maximum capacity. | |
void | setCharacterBounds (unsigned int glyphRunIndex, float left, float top, float right, float bottom) |
Sets the unclipped bounding box for a glyph at the given index. | |
void | setClippingCoordinates (unsigned int glyphRunIndex, float left, float top, float right, float bottom) |
Sets the clipping coordinates for a glyph at the given index. | |
void | setGlyph (unsigned int glyphRunIndex, const GlyphKey &glyphKey) |
Sets the font glyph index for the given glyph. | |
void | setLength (unsigned int length) |
Sets the actual length of the glyph run. | |
void | setVertexCoordinates (unsigned int glyphRunIndex, float left, float top, float right, float bottom) |
Sets the vertex coordinates for the given index, based on the given edges. | |
~GlyphRun () | |
Destructor. | |
GlyphRun contains the memory structures that are needed to render a text string.
Constructs a glyph run with given maximum capacity.
domain | Domain to use. |
capacity | Defines the maximum amount of glyphs that can be included in the run. |
kanzi::GlyphRun::~GlyphRun | ( | ) |
Destructor.
void kanzi::GlyphRun::draw | ( | Renderer3D & | renderer, |
GlyphCache & | glyphCache, | ||
bool | twoPass, | ||
const Material & | material ) |
void kanzi::GlyphRun::setVertexCoordinates | ( | unsigned int | glyphRunIndex, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom ) |
Sets the vertex coordinates for the given index, based on the given edges.
glyphRunIndex | Index of the glyph in the glyph run. |
left | Left edge x axis coordinate. |
top | Top edge y axis coordinate. |
right | Right edge x axis coordinate. |
bottom | Bottom edge y axis coordinate. |
void kanzi::GlyphRun::setCharacterBounds | ( | unsigned int | glyphRunIndex, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom ) |
Sets the unclipped bounding box for a glyph at the given index.
Used to calculate final clipped vertex coordinates.
glyphRunIndex | Index of the glyph in the glyph run. |
left | Left edge x axis coordinate. |
top | Top edge y axis coordinate. |
right | Right edge x axis coordinate. |
bottom | Bottom edge y axis coordinate. |
void kanzi::GlyphRun::setClippingCoordinates | ( | unsigned int | glyphRunIndex, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom ) |
Sets the clipping coordinates for a glyph at the given index.
For each quad there are 4 floats in range[0, 1]: left, right, bottom, and top. For example, a left value of 0.1 and a right value of 0.25 means that one tenth of the glyph is being clipped from the left side and a quarter of the glyph is being clipped from the right side.
glyphRunIndex | Index of the glyph in the glyph run. |
left | Left edge clipping amount. |
top | Top edge clipping amount. |
right | Right edge clipping amount. |
bottom | Bottom edge clipping amount. |
Sets the font glyph index for the given glyph.
Use this function to retrieve texture coordinates.
glyphRunIndex | Index of the glyph in the glyph run. |
glyphKey | GlyphKey of the glyph in the used font. |
Sets the actual length of the glyph run.
length | Length of the run. The length must be smaller than or equal to the available length. |
void kanzi::GlyphRun::allocateClippingCoordinates | ( | ) |
Allocates the space for the clipping coordinates.
RectangleFloat kanzi::GlyphRun::getBoundingRectangle | ( | ) | const |
Returns the bounding box for the whole glyph run, with clipping.
RectangleFloat kanzi::GlyphRun::getCharacterBounds | ( | unsigned int | glyphRunIndex | ) | const |
Returns the unclipped bounding box for the given glyph, as set by setCharacterBounds().
glyphRunIndex | Index of the glyph in the glyph run. |