FastUIDraw
Public Member Functions | Static Public Member Functions | Friends | List of all members
fastuidraw::Glyph Class Reference

A Glyph is essentially an opaque pointer to data for rendering and performing layout of a glyph. More...

#include <glyph.hpp>

Public Member Functions

 Glyph (void)
 
c_array< const GlyphAttributeattributes (void) const
 
GlyphCachecache (void) const
 
unsigned int cache_location (void) const
 
GlyphMetrics metrics (void) const
 
const Pathpath (void) const
 
c_array< const GlyphRenderCostInforender_cost (void) const
 
vec2 render_size (void) const
 
GlyphRenderer renderer (void) const
 
enum glyph_type type (void) const
 
enum return_code upload_to_atlas (void) const
 
bool uploaded_to_atlas (void) const
 
bool valid (void) const
 

Static Public Member Functions

static Glyph create_glyph (GlyphRenderer render, const reference_counted_ptr< const FontBase > &font, uint32_t glyph_code)
 
static enum return_code delete_glyph (Glyph G)
 
static void glyph_attribute_dst_write (int glyph_attribute_index, PainterAttribute::pointer_to_field *out_attribute, int *out_index_into_attribute)
 

Friends

class GlyphCache
 

Detailed Description

A Glyph is essentially an opaque pointer to data for rendering and performing layout of a glyph.

Definition at line 48 of file glyph.hpp.

Constructor & Destructor Documentation

◆ Glyph()

fastuidraw::Glyph::Glyph ( void  )
inline

Ctor. Initializes the Glyph to be invalid, i.e. essentially a nullptr pointer

Definition at line 55 of file glyph.hpp.

Member Function Documentation

◆ attributes()

c_array<const GlyphAttribute> fastuidraw::Glyph::attributes ( void  ) const

Returns the glyph's per-corner attribute data.

◆ cache()

GlyphCache* fastuidraw::Glyph::cache ( void  ) const

Returns the GlyphCache on which the glyph resides. The return value of valid() must be true. If not, debug builds FASTUIDRAWassert and release builds crash.

◆ cache_location()

unsigned int fastuidraw::Glyph::cache_location ( void  ) const

Returns the index location into the GlyphCache of the glyph. The return value of valid() must be true. If not, debug builds FASTUIDRAWassert and release builds crash.

◆ create_glyph()

static Glyph fastuidraw::Glyph::create_glyph ( GlyphRenderer  render,
const reference_counted_ptr< const FontBase > &  font,
uint32_t  glyph_code 
)
static

Create a Glyph WITHOUT placing it on a GlyphCache. Such a Glyph needs to be destroyed manually with delete_glyph() or placed on a GlyphCache (via GlyphCache::add_glyph()). Glyph values that are NOT on a GlyphCache will always fail in their call to upload_to_atlas().

Parameters
renderthe nature of the render data to give to the Glyph
fontthe font used to generate the Glyph
glyph_codethe glyph code to generate the Glyph

◆ delete_glyph()

static enum return_code fastuidraw::Glyph::delete_glyph ( Glyph  G)
static

Destroy a Glyph that is NOT in a GlyphCache, i.e. cache() returns a nullptr. On success the underlying data of the passed Glyph is no longer valid and the Glyph value passed should be discarded (i.e. like a freed pointer).

Parameters
GGlyph to delete

◆ glyph_attribute_dst_write()

static void fastuidraw::Glyph::glyph_attribute_dst_write ( int  glyph_attribute_index,
PainterAttribute::pointer_to_field out_attribute,
int *  out_index_into_attribute 
)
static

Given an index into an array of GlyphAttribute values, as used by pack_raw() or returned by attributes()), return the point to member variable of which attribute is written to from the glyph attribute value and what component of it.

Parameters
glyph_attribute_indexinto an array of GlyphAttribute values, for example the array returned by attributes().
out_attributelocation to which to write the pointer member of Painter Attribute that the glyph attribute value is written to in pack_raw() and/or pack_glyph().
out_index_into_attributelocation to which to write the array-index element of the member of Painter Attribute that the glyph attribute value is written to in pack_raw() and/or pack_glyph().

◆ metrics()

GlyphMetrics fastuidraw::Glyph::metrics ( void  ) const

Returns the glyph's layout data, valid() must return true. If not, debug builds FASTUIDRAWassert and release builds crash.

◆ path()

const Path& fastuidraw::Glyph::path ( void  ) const

Returns the path of the Glyph; the path is in coordinates of the glyph with the convention that the y-coordinate increases upwards. If one is rendering the path (for example stroking it), together with drawing of glyphs via a Painter, then one needs to reverse the y-coordinate (for example by Painter::shear(1.0, -1.0)) if the glyphs are rendered with data packed by pack_glyph() with PainterEnums::y_increases_downwards.

◆ render_cost()

c_array<const GlyphRenderCostInfo> fastuidraw::Glyph::render_cost ( void  ) const

Provides information on the rendering cost of the Glyph, entirely dependent on the GlyphRenderData that generated the data.

◆ render_size()

vec2 fastuidraw::Glyph::render_size ( void  ) const

Returns ths rendering size of the glyph (in font coordinates). This value is similair in value to GlyphMetrics:size() but not necessarily idential (differnces come from discretization to pixels for example).

◆ renderer()

GlyphRenderer fastuidraw::Glyph::renderer ( void  ) const

Returns the glyph's renderer, valid() must return true. If not, debug builds FASTUIDRAWassert and release builds crash.

◆ type()

enum glyph_type fastuidraw::Glyph::type ( void  ) const

Returns the glyph's rendering type, valid() must return true. If not, debug builds FASTUIDRAWassert and release builds crash.

◆ upload_to_atlas()

enum return_code fastuidraw::Glyph::upload_to_atlas ( void  ) const

If returns routine_fail, then the GlyphCache on which the glyph resides needs to be cleared first. If the glyph is already uploaded returns immediately with routine_success.

◆ uploaded_to_atlas()

bool fastuidraw::Glyph::uploaded_to_atlas ( void  ) const

Returns true if and only if the Glyph is already uploaded to a GlyphAtlas.

◆ valid()

bool fastuidraw::Glyph::valid ( void  ) const
inline

Returns true if the Glyph refers to actual glyph data

Definition at line 64 of file glyph.hpp.


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