FastUIDraw
Namespaces | Classes | Macros | Enumerations | Enumerator | Functions
Glyph

Glyph provides the interfaces to realizing glyph data for rendering glyphs. The big classes being Glyph, GlyphCache, GlyphAtlas and FontBase. Part of the main library libFastUIDraw. More...

Namespaces

 fastuidraw::CharacterEncoding
 A CharacterEncoding is used to decide how to interpret characters. The value itself is just a 32-bit value that mirrors the FT_Encoding of FreeType.
 
 fastuidraw::GlyphGenerateParams
 GlyphGenerateParams encapsulates values to determine how glyphs are to be produced. These values cannot be changed if there are any FontBase derived objects alive.
 

Classes

class  fastuidraw::FontBase
 FontBase provides an interface for a font to generate glyph rendering data. More...
 
class  fastuidraw::FontDatabase
 A FontDatabase performs the act of font selection and glyph selection. It uses the values of FontProperties (except for FontProperties::source_label()) to select suitable font or fonts. More...
 
class  fastuidraw::FontFreeType
 A FontFreeType implements the interface of FontBase from a scalable font loaded by libfreetype. More...
 
class  fastuidraw::FontMetrics
 Represents various metric values global to an entire font. More...
 
class  fastuidraw::FontProperties
 Represents defining properties of a font used by FontDatabase to perform font merging. More...
 
class  fastuidraw::FreeTypeFace
 A FreeTypeFace wraps an FT_Face object of the FreeType library together with a mutex in a reference counted object. More...
 
class  fastuidraw::FreeTypeLib
 A FreeTypeLib wraps an FT_Library object of the FreeType library together with a mutex in a reference counted object. More...
 
class  fastuidraw::Glyph
 A Glyph is essentially an opaque pointer to data for rendering and performing layout of a glyph. More...
 
class  fastuidraw::GlyphAtlasProxy
 An GlyphAtlasProxy is a proxy for a GlyphAtlas; one can allocate through it. Internally it tracks all that was allocated with it. More...
 
class  fastuidraw::GlyphAttribute
 A GlyphAttribute represents one Painter Attribute per glyph corner. More...
 
class  fastuidraw::GlyphCache
 A GlyphCache represents a cache of glyphs and manages the uploading of the data to a GlyphAtlas. The methods of GlyphAtlas are thread safe because it maintains an internal mutex lock for the durations of its methods. More...
 
class  fastuidraw::GlyphMetrics
 A GlyphMetrics provides information on the metrics of a glyph, all the values are in units of the font glyph. The function units_per_EM() provides the conversion factor to pixel coordinates via $PixelCoordinates = FontCoordinates * PixelSize / units_per_EM()$ where PixelSize is the pixel size in which one is to render the text. More...
 
class  fastuidraw::GlyphMetricsValue
 A GlyphMetricsValue is to be used by a FontBase derived object to specify the values of a GlyphMetrics object. More...
 
class  fastuidraw::GlyphRenderCostInfo
 
class  fastuidraw::GlyphRenderData
 GlyphRenderData provides an interface to specify data used for rendering glyphs and to pack that data onto a GlyphAtlas. More...
 
class  fastuidraw::GlyphRenderDataBandedRays
 
class  fastuidraw::GlyphRenderDataRestrictedRays
 
class  fastuidraw::GlyphRenderDataTexels
 A GlyphRenderDataTexels holds texel data for rendering a glyph. Such texel data can be for both distance field and coverage glyph rendeding. More...
 
class  fastuidraw::GlyphRenderer
 Specifies how to render a glyph. More...
 
class  fastuidraw::GlyphSource
 

Macros

#define FASTUIDRAW_CHARACTER_ENCODING_VALUE(a, b, c, d)   (uint32_t(a) << 24u) | (uint32_t(b) << 16u) | (uint32_t(c) << 8u) | uint32_t(d)
 

Enumerations

enum  fastuidraw::CharacterEncoding::encoding_value_t : uint32_t {
  fastuidraw::CharacterEncoding::unicode = FASTUIDRAW_CHARACTER_ENCODING_VALUE('u', 'n', 'i', 'c'), fastuidraw::CharacterEncoding::ms_symbol = FASTUIDRAW_CHARACTER_ENCODING_VALUE('s', 'y', 'm', 'b'), fastuidraw::CharacterEncoding::sjis = FASTUIDRAW_CHARACTER_ENCODING_VALUE('s', 'j', 'i', 's'), fastuidraw::CharacterEncoding::prc = FASTUIDRAW_CHARACTER_ENCODING_VALUE('g', 'b', ' ', ' '),
  fastuidraw::CharacterEncoding::big5 = FASTUIDRAW_CHARACTER_ENCODING_VALUE('b', 'i', 'g', '5'), fastuidraw::CharacterEncoding::wansung = FASTUIDRAW_CHARACTER_ENCODING_VALUE('w', 'a', 'n', 's'), fastuidraw::CharacterEncoding::johab = FASTUIDRAW_CHARACTER_ENCODING_VALUE('j', 'o', 'h', 'a'), fastuidraw::CharacterEncoding::adobe_latin1 = FASTUIDRAW_CHARACTER_ENCODING_VALUE('l', 'a', 't', '1'),
  fastuidraw::CharacterEncoding::adobe_standard = FASTUIDRAW_CHARACTER_ENCODING_VALUE('A', 'D', 'O', 'B'), fastuidraw::CharacterEncoding::adobe_expert = FASTUIDRAW_CHARACTER_ENCODING_VALUE('A', 'D', 'B', 'E'), fastuidraw::CharacterEncoding::adobe_custom = FASTUIDRAW_CHARACTER_ENCODING_VALUE('A', 'D', 'B', 'C'), fastuidraw::CharacterEncoding::apple_roman = FASTUIDRAW_CHARACTER_ENCODING_VALUE('a', 'r', 'm', 'n')
}
 Enumeration type to define character encodings. More...
 
enum  fastuidraw::glyph_type {
  fastuidraw::coverage_glyph, fastuidraw::distance_field_glyph, fastuidraw::restricted_rays_glyph, fastuidraw::banded_rays_glyph,
  fastuidraw::invalid_glyph = 0x1000, fastuidraw::adaptive_rendering = invalid_glyph
}
 Provides an enumeration of the rendering data for a glyph. More...
 

Functions

float fastuidraw::GlyphGenerateParams::banded_rays_average_number_curves_thresh (void)
 
enum return_code fastuidraw::GlyphGenerateParams::banded_rays_average_number_curves_thresh (float v)
 
unsigned int fastuidraw::GlyphGenerateParams::banded_rays_max_recursion (void)
 
enum return_code fastuidraw::GlyphGenerateParams::banded_rays_max_recursion (unsigned int v)
 
enum encoding_value_t fastuidraw::CharacterEncoding::chracter_encoding (uint8_t a, uint8_t b, uint8_t c, uint8_t d)
 
template<typename input_iterator , typename output_iterator >
void fastuidraw::FontDatabase::create_glyph_sequence (FontGroup group, input_iterator character_codes_begin, input_iterator character_codes_end, output_iterator output_begin, uint32_t selection_strategy=0u)
 
template<typename input_iterator , typename output_iterator >
void fastuidraw::FontDatabase::create_glyph_sequence (const FontBase *h, input_iterator character_codes_begin, input_iterator character_codes_end, output_iterator output_begin, uint32_t selection_strategy=0u)
 
template<typename input_iterator , typename output_iterator >
void fastuidraw::FontDatabase::create_glyph_sequence_no_merging (const FontBase *h, input_iterator character_codes_begin, input_iterator character_codes_end, output_iterator output_begin)
 
float fastuidraw::GlyphGenerateParams::distance_field_max_distance (void)
 
enum return_code fastuidraw::GlyphGenerateParams::distance_field_max_distance (float v)
 
enum return_code fastuidraw::GlyphGenerateParams::distance_field_pixel_size (unsigned int v)
 
unsigned int fastuidraw::GlyphGenerateParams::distance_field_pixel_size (void)
 
int fastuidraw::GlyphGenerateParams::restricted_rays_max_recursion (void)
 
enum return_code fastuidraw::GlyphGenerateParams::restricted_rays_max_recursion (int v)
 
enum return_code fastuidraw::GlyphGenerateParams::restricted_rays_minimum_render_size (float v)
 
float fastuidraw::GlyphGenerateParams::restricted_rays_minimum_render_size (void)
 
int fastuidraw::GlyphGenerateParams::restricted_rays_split_thresh (void)
 
enum return_code fastuidraw::GlyphGenerateParams::restricted_rays_split_thresh (int v)
 

Detailed Description

Glyph provides the interfaces to realizing glyph data for rendering glyphs. The big classes being Glyph, GlyphCache, GlyphAtlas and FontBase. Part of the main library libFastUIDraw.

Macro Definition Documentation

◆ FASTUIDRAW_CHARACTER_ENCODING_VALUE

#define FASTUIDRAW_CHARACTER_ENCODING_VALUE (   a,
  b,
  c,
 
)    (uint32_t(a) << 24u) | (uint32_t(b) << 16u) | (uint32_t(c) << 8u) | uint32_t(d)

Conveniance macro to define a 32-bit character encoding scheme from four unsigned 8-bit values.

Definition at line 35 of file character_encoding.hpp.

Enumeration Type Documentation

◆ encoding_value_t

Enumeration type to define character encodings.

Enumerator
unicode 

Unicode character set to cover all version of Unicode.

ms_symbol 

Miscrosoft Symbol Encoding; uses the character codes 0xF020 - 0xF0FF.

sjis 

Shift JIS encoding for Japanese characters.

prc 

Character encoding for the Simplified Chinese of the People's Republic of China.

big5 

Characted encoding for Traditional Chinese of Taiwan and Hong Kong

wansung 

Encoding of the Korean characters as Extended Wansung (MS Windows code page 949). See also https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt

johab 

The Korean standard character set (KS C 5601-1992). This corrresponds to MS Windows code page 1361.

adobe_latin1 

Latin-1 character encoding as defined by Type 1 PostScript font, limited to 256 character codes.

adobe_standard 

Adobe Standard character encoding found in Type 1, CFF and OpenType/CFF fonts, limited to 256 character codes.

adobe_expert 

Adobe Expert character encoding found in Type 1, CFF and OpenType/CFF fonts, limited to 256 character codes.

adobe_custom 

Custom character encoding found in Type 1, CFF and OpenType/CFF fonts, limited to 256 character codes.

apple_roman 

Apply Roman character encoding; a number of TrueType and OpenType fonts have this 8-bit encoding because quite older version of Mac OS support it.

Definition at line 49 of file character_encoding.hpp.

◆ glyph_type

Provides an enumeration of the rendering data for a glyph.

Enumerator
coverage_glyph 

Glyph is a coverage glyph. Glyph is not scalable.

distance_field_glyph 

Glyph is a distance field glyph. Glyph is scalable.

restricted_rays_glyph 

Glyph is a Restricted rays glyph, generated from a GlyphRenderDataRestrictedRays. Glyph is scalable.

banded_rays_glyph 

Glyph is a Banded rays glyph, generated from a GlyphRenderDataBandedRays. Glyph is scalable.

invalid_glyph 

Tag to indicate invalid glyph type; the value is much larger than the last glyph type to allow for later ABI compatibility as more glyph types are added. Value is also to indicate to Painter::draw_glyphs() to draw glyphs adaptively (i.e. choose a renderer based from the size of the rendered glyphs).

adaptive_rendering 

Tag to indicate invalid glyph type; the value is much larger than the last glyph type to allow for later ABI compatibility as more glyph types are added. Value is also to indicate to Painter::draw_glyphs() to draw glyphs adaptively (i.e. choose a renderer based from the size of the rendered glyphs).

Definition at line 34 of file glyph_renderer.hpp.

Function Documentation

◆ banded_rays_average_number_curves_thresh() [1/2]

float fastuidraw::GlyphGenerateParams::banded_rays_average_number_curves_thresh ( void  )

When generating banded rays glyphs see (GlyphRenderDataBandedRays), specifies the threshhold for the average number of curves across bands to stop recursing to finer bands.

◆ banded_rays_average_number_curves_thresh() [2/2]

enum return_code fastuidraw::GlyphGenerateParams::banded_rays_average_number_curves_thresh ( float  v)

Set the value returned by banded_rays_average_number_curves_thresh(void) const, initial value is 2.5. Returns routine_success if value is successfully changed.

Parameters
vvalue

◆ banded_rays_max_recursion() [1/2]

unsigned int fastuidraw::GlyphGenerateParams::banded_rays_max_recursion ( void  )

When generating banded rays glyphs see (GlyphRenderDataBandedRays), specifies the maximum number of times to recurse when generating sub-bands. The number of bands that are generated in a dimension is 2^N where N is the number of levels of recurion used to generate bands.

◆ banded_rays_max_recursion() [2/2]

enum return_code fastuidraw::GlyphGenerateParams::banded_rays_max_recursion ( unsigned int  v)

Set the value returned by banded_rays_max_recursion(void) const, initial value is 11. Returns routine_success if value is successfully changed.

Parameters
vvalue

◆ chracter_encoding()

enum encoding_value_t fastuidraw::CharacterEncoding::chracter_encoding ( uint8_t  a,
uint8_t  b,
uint8_t  c,
uint8_t  d 
)
inline

Conveniance functions to create a CharacterEncoding value from an arbitary 4-tuple of uint8_t values.

Definition at line 130 of file character_encoding.hpp.

◆ create_glyph_sequence() [1/2]

template<typename input_iterator , typename output_iterator >
void fastuidraw::FontDatabase::create_glyph_sequence ( FontGroup  group,
input_iterator  character_codes_begin,
input_iterator  character_codes_end,
output_iterator  output_begin,
uint32_t  selection_strategy = 0u 
)

Fill Glyph values from an iterator range of character code values.

Template Parameters
input_iteratorread iterator to type that is castable to uint32_t
output_iteratorwrite iterator to Glyph
Parameters
groupFontGroup to choose what font
character_codes_beginiterator to 1st character code
character_codes_enditerator to one past last character code
output_beginbegin iterator to output
selection_strategyusing bit-wise ors of values of selection_bits_t to choose the matching criteria of selecting a font.

Definition at line 365 of file font_database.hpp.

◆ create_glyph_sequence() [2/2]

template<typename input_iterator , typename output_iterator >
void fastuidraw::FontDatabase::create_glyph_sequence ( const FontBase h,
input_iterator  character_codes_begin,
input_iterator  character_codes_end,
output_iterator  output_begin,
uint32_t  selection_strategy = 0u 
)

Fill Glyph values from an iterator range of character code values.

Template Parameters
input_iteratorread iterator to type that is castable to uint32_t
output_iteratorwrite iterator to Glyph
Parameters
hpointer to font from which to fetch the glyph, if the glyph is not present in the font attempt to get the glyph from a font of similiar properties
character_codes_beginiterator to 1st character code
character_codes_enditerator to one past last character code
output_beginbegin iterator to output
selection_strategyusing bit-wise ors of values of selection_bits_t to choose the matching criteria of selecting a font.

Definition at line 385 of file font_database.hpp.

◆ create_glyph_sequence_no_merging()

template<typename input_iterator , typename output_iterator >
void fastuidraw::FontDatabase::create_glyph_sequence_no_merging ( const FontBase h,
input_iterator  character_codes_begin,
input_iterator  character_codes_end,
output_iterator  output_begin 
)

Fill an array of Glyph values from an array of character code values.

Template Parameters
input_iteratorread iterator to type that is castable to uint32_t
output_iteratorwrite iterator to Glyph
Parameters
hpointer to font from which to fetch the glyph, if the glyph is not present in the font attempt to get the glyph from a font of similiar properties
character_codes_beginiterator to first character code
character_codes_enditerator to one pash last character code
output_beginbegin iterator to output

Definition at line 405 of file font_database.hpp.

◆ distance_field_max_distance() [1/2]

float fastuidraw::GlyphGenerateParams::distance_field_max_distance ( void  )

When creating distance field data, the distances are normalized and clamped to [0, 1]. This value provides the normalization which effectivly gives the maximum distance recorded in the distance field texture. Recall that the values stored in texels are uint8_t's so larger values will have lower accuracy. The units are in pixels. Default value is 1.5.

◆ distance_field_max_distance() [2/2]

enum return_code fastuidraw::GlyphGenerateParams::distance_field_max_distance ( float  v)

Set the value returned by distance_field_max_distance(void) const, initial value is 96.0, i.e. 1.5 pixels. Return routine_success if value is successfully changed.

Parameters
vvalue

◆ distance_field_pixel_size() [1/2]

enum return_code fastuidraw::GlyphGenerateParams::distance_field_pixel_size ( unsigned int  v)

Set the value returned by distance_field_pixel_size(void) const, initial value is 48. Return routine_success if value is successfully changed.

Parameters
vvalue

◆ distance_field_pixel_size() [2/2]

unsigned int fastuidraw::GlyphGenerateParams::distance_field_pixel_size ( void  )

Pixel size at which to generate distance field scalable glyphs.

◆ restricted_rays_max_recursion() [1/2]

int fastuidraw::GlyphGenerateParams::restricted_rays_max_recursion ( void  )

When generating restricted rays glyph data see (GlyphRenderDataRestrictedRays), specifies the maximum level of recursion that will be used to generate the hierarchy of boxes.

◆ restricted_rays_max_recursion() [2/2]

enum return_code fastuidraw::GlyphGenerateParams::restricted_rays_max_recursion ( int  v)

Set the value returned by restricted_rays_max_recursion(void) const, initial value is 12. Returns routine_success if value is successfully changed.

Parameters
vvalue

◆ restricted_rays_minimum_render_size() [1/2]

enum return_code fastuidraw::GlyphGenerateParams::restricted_rays_minimum_render_size ( float  v)

Set the value returned by restricted_rays_minimum_render_size(void) const, initial value is 32.0. Returns routine_success if value is successfully changed.

Parameters
vvalue

◆ restricted_rays_minimum_render_size() [2/2]

float fastuidraw::GlyphGenerateParams::restricted_rays_minimum_render_size ( void  )

When generating restricted rays glyph data see (GlyphRenderDataRestrictedRays), specifies the expected smallest size on the scrren at which to render glyphs via a GlyphRenderDataRestrictedRays. The value is used to include curves near the boundary of bounding box so that anti-aliasing works correctly when the glyph is renderer very small. A negative value indicates that no slack is taken/used.

◆ restricted_rays_split_thresh() [1/2]

int fastuidraw::GlyphGenerateParams::restricted_rays_split_thresh ( void  )

When generating restricted rays glyph data see (GlyphRenderDataRestrictedRays), specifies the threshhold value for number of curves allowed in a single box before a box.

◆ restricted_rays_split_thresh() [2/2]

enum return_code fastuidraw::GlyphGenerateParams::restricted_rays_split_thresh ( int  v)

Set the value returned by restricted_rays_split_thresh(void) const, initial value is 4. Returns routine_success if value is successfully changed.

Parameters
vvalue