Kanzi 3.9.10
kanzi::GlyphRun Class Reference

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.
 

Detailed Description

GlyphRun contains the memory structures that are needed to render a text string.

Constructor & Destructor Documentation

◆ GlyphRun()

kanzi::GlyphRun::GlyphRun ( Domain * domain,
unsigned int capacity )
explicit

Constructs a glyph run with given maximum capacity.

Parameters
domainDomain to use.
capacityDefines the maximum amount of glyphs that can be included in the run.

◆ ~GlyphRun()

kanzi::GlyphRun::~GlyphRun ( )

Destructor.

Member Function Documentation

◆ draw()

void kanzi::GlyphRun::draw ( Renderer3D & renderer,
GlyphCache & glyphCache,
bool twoPass,
const Material & material )

Renders the glyph run.

Parameters
rendererRenderer to use for drawing.
glyphCacheGlyph cache from which to fetch the glyph bitmaps.
twoPassTrue for separate color and depth render passes, false for a single pass.
materialMaterial whose shader program to use for rendering.

◆ setVertexCoordinates()

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.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
leftLeft edge x axis coordinate.
topTop edge y axis coordinate.
rightRight edge x axis coordinate.
bottomBottom edge y axis coordinate.

◆ setCharacterBounds()

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.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
leftLeft edge x axis coordinate.
topTop edge y axis coordinate.
rightRight edge x axis coordinate.
bottomBottom edge y axis coordinate.

◆ setClippingCoordinates()

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.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
leftLeft edge clipping amount.
topTop edge clipping amount.
rightRight edge clipping amount.
bottomBottom edge clipping amount.

◆ setGlyph()

void kanzi::GlyphRun::setGlyph ( unsigned int glyphRunIndex,
const GlyphKey & glyphKey )

Sets the font glyph index for the given glyph.

Use this function to retrieve texture coordinates.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
glyphKeyGlyphKey of the glyph in the used font.

◆ setLength()

void kanzi::GlyphRun::setLength ( unsigned int length)

Sets the actual length of the glyph run.

Parameters
lengthLength of the run. The length must be smaller than or equal to the available length.

◆ allocateClippingCoordinates()

void kanzi::GlyphRun::allocateClippingCoordinates ( )

Allocates the space for the clipping coordinates.

◆ getBoundingRectangle()

RectangleFloat kanzi::GlyphRun::getBoundingRectangle ( ) const

Returns the bounding box for the whole glyph run, with clipping.

Returns
Bounding box containing all the glyphs.

◆ getCharacterBounds()

RectangleFloat kanzi::GlyphRun::getCharacterBounds ( unsigned int glyphRunIndex) const

Returns the unclipped bounding box for the given glyph, as set by setCharacterBounds().

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
Returns
Bounding box for the glyph.

The documentation for this class was generated from the following file: