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

A GlyphRun represents a sequence of glyph codes with positions. A GlyphRun 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. In contrast to a GlyphSequence, a GlyphRun does NOT maintain a hierarchy to perform culling. However, it does provide an interface to select continuous subsets of the glyphs for the purporse of rendering. In addition, since it does not carry a hierarchy for culling, it is also a lighter weight object than GlyphSequence. Like GlyphSequence, the methods of GlyphRun are re-entrant but not thread safe, i.e. if an application uses the same GlyphRun from multiple threads it needs to explicitely handle locking itself when using it. More...

#include <glyph_run.hpp>

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

Public Member Functions

 GlyphRun (float format_size, enum PainterEnums::screen_orientation orientation, GlyphCache &cache, enum PainterEnums::glyph_layout_type layout=PainterEnums::glyph_layout_horizontal)
 
 GlyphRun (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 GlyphMetrics > glyph_metrics, c_array< const vec2 > positions)
 
void add_glyphs (c_array< const GlyphSource > glyph_sources, c_array< const vec2 > positions)
 
void add_glyphs (const FontBase *font, c_array< const uint32_t > glyph_codes, 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
 
const PainterAttributeWritersubsequence (GlyphRenderer renderer, unsigned int begin, unsigned int count) const
 
const PainterAttributeWritersubsequence (GlyphRenderer renderer, unsigned int begin) const
 
const PainterAttributeWritersubsequence (GlyphRenderer renderer) const
 

Detailed Description

A GlyphRun represents a sequence of glyph codes with positions. A GlyphRun 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. In contrast to a GlyphSequence, a GlyphRun does NOT maintain a hierarchy to perform culling. However, it does provide an interface to select continuous subsets of the glyphs for the purporse of rendering. In addition, since it does not carry a hierarchy for culling, it is also a lighter weight object than GlyphSequence. Like GlyphSequence, the methods of GlyphRun are re-entrant but not thread safe, i.e. if an application uses the same GlyphRun from multiple threads it needs to explicitely handle locking itself when using it.

Definition at line 54 of file glyph_run.hpp.

Constructor & Destructor Documentation

◆ GlyphRun() [1/2]

fastuidraw::GlyphRun::GlyphRun ( 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

◆ GlyphRun() [2/2]

fastuidraw::GlyphRun::GlyphRun ( 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::GlyphRun::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 125 of file glyph_run.hpp.

◆ add_glyphs() [1/3]

void fastuidraw::GlyphRun::add_glyphs ( c_array< const GlyphMetrics glyph_metrics,
c_array< const vec2 positions 
)

Add glyphs passing an array of positions and GlyphMetric values; values are -copied-.

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

◆ add_glyphs() [2/3]

void fastuidraw::GlyphRun::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

◆ add_glyphs() [3/3]

void fastuidraw::GlyphRun::add_glyphs ( const FontBase font,
c_array< const uint32_t >  glyph_codes,
c_array< const vec2 positions 
)

Add glyphs from a specific font and positions; values are -copied-.

Parameters
fontfont from which to fetch glyphs
glyph_codesspecifies what glyphs to add
positionsspecifies the positions of each glyph added

◆ added_glyph()

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

Returns the GlyphSource 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::GlyphRun::attribute_packer ( void  ) const

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

◆ format_size()

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

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

◆ glyph_cache()

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

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

◆ number_glyphs()

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

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

◆ subsequence() [1/3]

const PainterAttributeWriter& fastuidraw::GlyphRun::subsequence ( GlyphRenderer  renderer,
unsigned int  begin,
unsigned int  count 
) const

Returns a const-reference to PainterAttributeWriter object for rendering a named range of glyphs for a specified GlyphRenderer. The returned object is valid in value until this GlyphRun is destroyed or one of add_glyph(), add_glyphs(), subsequence() is called. The PainterAttributeWriter will provide indices and attributes as packed by attribute_packer().

Parameters
rendererhow to render the glyphs
beginindex to select which is the first glyph
countnumber of glyphs to take starting at begin

◆ subsequence() [2/3]

const PainterAttributeWriter& fastuidraw::GlyphRun::subsequence ( GlyphRenderer  renderer,
unsigned int  begin 
) const

Returns a const-reference to PainterAttributeWriter object for rendering all glyphs from a starting point for a specified GlyphRenderer. The returned object is valid in value until this GlyphRun is destroyed or one of add_glyph(), add_glyphs(), subsequence() is called. The PainterAttributeWriter will provide indices and attributes as packed by attribute_packer().

Parameters
rendererhow to render the glyphs
beginindex to select which is the first glyph

◆ subsequence() [3/3]

const PainterAttributeWriter& fastuidraw::GlyphRun::subsequence ( GlyphRenderer  renderer) const

Returns a const-reference to PainterAttributeWriter object for rendering the entire range of glyphs for a specified GlyphRenderer. The returned object is valid in value until this GlyphRun is destroyed or one of add_glyph(), add_glyphs(), subsequence() is called. The PainterAttributeWriter will provide indices and attributes as packed by attribute_packer().

Parameters
rendererhow to render the glyphs

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