FastUIDraw
Classes | Public Member Functions | List of all members
fastuidraw::GlyphSequence Class Reference

A GlyphSequence represents a sequence of glyph codes with positions. A GlyphSequence provides an interface to grab the glyph-codes realized as different renderers for the purpose of rendering text in response to the transformation that a Painter currently has. A GlyphSequence maintains a hierarchy so that Painter can quickly cull glyphs that are not visible. The methods of GlyphSequence are re-entrant but not thread safe, i.e. if an application uses the same GlyphSequence from multiple threads it needs to explicitely handle locking itself when using it. More...

#include <glyph_sequence.hpp>

Inheritance diagram for fastuidraw::GlyphSequence:
Inheritance graph
[legend]

Classes

class  ScratchSpace
 Opaque object to hold work room needed for functions of GlyphSequence that require scratch space. More...
 
class  Subset
 

Public Member Functions

 GlyphSequence (float format_size, enum PainterEnums::screen_orientation orientation, GlyphCache &cache, enum PainterEnums::glyph_layout_type layout=PainterEnums::glyph_layout_horizontal)
 
 GlyphSequence (float format_size, GlyphCache &cache, const reference_counted_ptr< const GlyphAttributePacker > &packer)
 
void add_glyph (const GlyphSource &glyph_source, const vec2 &position)
 
void add_glyphs (c_array< const GlyphSource > glyph_sources, c_array< const vec2 > positions)
 
void added_glyph (unsigned int I, GlyphMetrics *out_glyph_metrics, vec2 *out_position) const
 
const GlyphAttributePackerattribute_packer (void) const
 
float format_size (void) const
 
GlyphCacheglyph_cache (void) const
 
unsigned int number_glyphs (void) const
 
unsigned int number_subsets (void) const
 
unsigned int select_subsets (ScratchSpace &scratch_space, c_array< const vec3 > clip_equations, const float3x3 &clip_matrix_local, c_array< unsigned int > dst) const
 
Subset subset (unsigned int I) const
 

Detailed Description

A GlyphSequence represents a sequence of glyph codes with positions. A GlyphSequence provides an interface to grab the glyph-codes realized as different renderers for the purpose of rendering text in response to the transformation that a Painter currently has. A GlyphSequence maintains a hierarchy so that Painter can quickly cull glyphs that are not visible. The methods of GlyphSequence are re-entrant but not thread safe, i.e. if an application uses the same GlyphSequence from multiple threads it needs to explicitely handle locking itself when using it.

Definition at line 51 of file glyph_sequence.hpp.

Constructor & Destructor Documentation

◆ GlyphSequence() [1/2]

fastuidraw::GlyphSequence::GlyphSequence ( float  format_size,
enum PainterEnums::screen_orientation  orientation,
GlyphCache cache,
enum PainterEnums::glyph_layout_type  layout = PainterEnums::glyph_layout_horizontal 
)
explicit

Ctor that sets the GlyphAttributePacker to come from GlyphAttributePacker::standard_packer().

Parameters
format_sizeformat size at which glyphs added via add_glyphs() or add_glyph() are formatted
orientationscreen orientation at which glyphs added by add_glyphs() or add_glyph() are formatted
cacheGlyphCache used to fetch Glyph values
layoutspecifies if glyphs added by add_glyphs() or add_glyph() will be layed out horizontally or vertically

◆ GlyphSequence() [2/2]

fastuidraw::GlyphSequence::GlyphSequence ( float  format_size,
GlyphCache cache,
const reference_counted_ptr< const GlyphAttributePacker > &  packer 
)
explicit

Ctor.

Parameters
format_sizeformat size at which glyphs added via
cacheGlyphCache used to fetch Glyph values
packerspecifies how the Glyph values will be realized as attribute and index data.

Member Function Documentation

◆ add_glyph()

void fastuidraw::GlyphSequence::add_glyph ( const GlyphSource glyph_source,
const vec2 position 
)
inline

Add a single GlyphSource and position

Parameters
glyph_sourcespecifies what glyph to add
positionspecifies the position of the glyph added

Definition at line 176 of file glyph_sequence.hpp.

◆ add_glyphs()

void fastuidraw::GlyphSequence::add_glyphs ( c_array< const GlyphSource glyph_sources,
c_array< const vec2 positions 
)

Add GlyphSource values and positions; values are -copied-.

Parameters
glyph_sourcesspecifies what glyphs to add
positionsspecifies the positions of each glyph added

◆ added_glyph()

void fastuidraw::GlyphSequence::added_glyph ( unsigned int  I,
GlyphMetrics out_glyph_metrics,
vec2 out_position 
) const

Returns the GlyphMetrics and position value for the i'th glyph added via add_glyph() or add_glyphs().

Parameters
Iindex to select which glyph, must be that 0 <= I < number_glyphs()
*out_glyph_metricslocation to which to write the GlyphMetrics value describing the glyph
*out_positionlocation to which to write the position of the glyph

◆ attribute_packer()

const GlyphAttributePacker& fastuidraw::GlyphSequence::attribute_packer ( void  ) const

Returns the GlyphAttributePacker that is used to create the attribute and index data.

◆ format_size()

float fastuidraw::GlyphSequence::format_size ( void  ) const

Format size with which glyph sequences added by add_glyphs() and add_glyph() are formatted.

◆ glyph_cache()

GlyphCache& fastuidraw::GlyphSequence::glyph_cache ( void  ) const

Return the GlyphCache used by this GlyphSequence to fetch Glyph values.

◆ number_glyphs()

unsigned int fastuidraw::GlyphSequence::number_glyphs ( void  ) const

Returns the number of GlyphSource values added via add_glyph() and add_glyphs().

◆ number_subsets()

unsigned int fastuidraw::GlyphSequence::number_subsets ( void  ) const

Returns the total number of Subset objects of this GlyphSequence. This value can change when add_glyph() or add_glyphs() is called.

◆ select_subsets()

unsigned int fastuidraw::GlyphSequence::select_subsets ( ScratchSpace scratch_space,
c_array< const vec3 clip_equations,
const float3x3 clip_matrix_local,
c_array< unsigned int >  dst 
) const

Fetch those Subset objects that intersect a region specified by clip equations.

Parameters
scratch_spacescratch space for computations.
clip_equationsarray of clip equations
clip_matrix_local3x3 transformation from local (x, y, 1) coordinates to clip coordinates.
[out]dstlocation to which to write the Subset ID values
Returns
the number of Subset object ID's written to dst, that number is guaranteed to be no more than number_subsets().

◆ subset()

Subset fastuidraw::GlyphSequence::subset ( unsigned int  I) const

Fetch a Subset of this GlyphSequence. The returned object may no longer be valid if add_glyph() or add_glyphs() is called. In addition, any returned object is no longer valid if the owning GlyphSequence goes out of scope.

Parameters
Iwhich Subset to fetch with 0 <= I < number_subsets()

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