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

A FontFreeType implements the interface of FontBase from a scalable font loaded by libfreetype. More...

#include <font_freetype.hpp>

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

Public Member Functions

 FontFreeType (const reference_counted_ptr< FreeTypeFace::GeneratorBase > &pface_generator, const reference_counted_ptr< FreeTypeLib > &plib=reference_counted_ptr< FreeTypeLib >(), unsigned int num_faces=8)
 
 FontFreeType (const reference_counted_ptr< FreeTypeFace::GeneratorBase > &pface_generator, const FontProperties &props, const reference_counted_ptr< FreeTypeLib > &plib=reference_counted_ptr< FreeTypeLib >(), unsigned int num_faces=8)
 
virtual bool can_create_rendering_data (enum glyph_type tp) const override final
 
virtual void compute_metrics (uint32_t glyph_code, GlyphMetricsValue &metrics) const override final
 
virtual GlyphRenderDatacompute_rendering_data (GlyphRenderer render, GlyphMetrics glyph_metrics, Path &path, vec2 &render_size) const override final
 
const reference_counted_ptr< FreeTypeFace::GeneratorBase > & face_generator (void) const
 
virtual void glyph_codes (enum CharacterEncoding::encoding_value_t encoding, c_array< const uint32_t > in_character_codes, c_array< uint32_t > out_glyph_codes) const override final
 
const reference_counted_ptr< FreeTypeLib > & lib (void) const
 
virtual unsigned int number_glyphs (void) const override final
 
- Public Member Functions inherited from fastuidraw::FontBase
 FontBase (const FontProperties &pprops, const FontMetrics &pmetrics)
 
uint32_t glyph_code (uint32_t pcharacter_code) const
 
void glyph_codes (c_array< const uint32_t > in_character_codes, c_array< uint32_t > out_glyph_codes) const
 
const FontMetricsmetrics (void) const
 
const FontPropertiesproperties (void) const
 
unsigned int unique_id (void) const
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

Static Public Member Functions

static void compute_font_metrics_from_face (FT_Face in_face, FontMetrics &out_metrics)
 
static FontMetrics compute_font_metrics_from_face (FT_Face in_face)
 
static FontMetrics compute_font_metrics_from_face (const reference_counted_ptr< FreeTypeFace > &in_face)
 
static void compute_font_properties_from_face (FT_Face in_face, FontProperties &out_properties)
 
static FontProperties compute_font_properties_from_face (FT_Face in_face)
 
static FontProperties compute_font_properties_from_face (const reference_counted_ptr< FreeTypeFace > &in_face)
 
- Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
static void add_reference (const reference_counted_base< T, Counter > *p)
 
static void remove_reference (const reference_counted_base< T, Counter > *p)
 

Detailed Description

A FontFreeType implements the interface of FontBase from a scalable font loaded by libfreetype.

Definition at line 38 of file font_freetype.hpp.

Constructor & Destructor Documentation

◆ FontFreeType() [1/2]

fastuidraw::FontFreeType::FontFreeType ( const reference_counted_ptr< FreeTypeFace::GeneratorBase > &  pface_generator,
const reference_counted_ptr< FreeTypeLib > &  plib = reference_counted_ptrFreeTypeLib >(),
unsigned int  num_faces = 8 
)

Ctor. Guess the FontProperties from the FreeTypeFace::GeneratorBase

Parameters
pface_generatorobject used to generate the FreeTypeFace object(s) used by the FontFreeType object.
plibthe FreeTypeLib of the FreeTypeFace created by the FontFreeType, a null values indicates to use a private FreeTypeLib object
num_facesnumber of underlying faces for the FontFreeType to possess, this is the number of simumtaneous requests the FontFreeType can handle

◆ FontFreeType() [2/2]

fastuidraw::FontFreeType::FontFreeType ( const reference_counted_ptr< FreeTypeFace::GeneratorBase > &  pface_generator,
const FontProperties props,
const reference_counted_ptr< FreeTypeLib > &  plib = reference_counted_ptrFreeTypeLib >(),
unsigned int  num_faces = 8 
)

Ctor.

Parameters
pface_generatorobject used to generate the FreeTypeFace object(s) used by the FontFreeType object.
propsFontProperties with which to endow the created FontFreeType object
plibthe FreeTypeLib of the FreeTypeFace created by the FontFreeType, a null values indicates to use a private FreeTypeLib object
num_facesnumber of underlying faces for the FontFreeType to possess, this is the number of simumtaneous requests the FontFreeType can handle

Member Function Documentation

◆ can_create_rendering_data()

virtual bool fastuidraw::FontFreeType::can_create_rendering_data ( enum glyph_type  tp) const
finaloverridevirtual

To be implemented by a derived class to indicate that it will return non-nullptr in compute_rendering_data() when passed a GlyphRenderer whose GlyphRenderer::m_type is a specified value.

Implements fastuidraw::FontBase.

◆ compute_font_metrics_from_face() [1/3]

static void fastuidraw::FontFreeType::compute_font_metrics_from_face ( FT_Face  in_face,
FontMetrics out_metrics 
)
static

Fill the field of a FontMetrics from the values of an FT_Face. Beware that the foundary name is not assigned!

◆ compute_font_metrics_from_face() [2/3]

static FontMetrics fastuidraw::FontFreeType::compute_font_metrics_from_face ( FT_Face  in_face)
static

Return a FontMetrics from the values of an FT_Face. Beware that the foundary name is not assigned!

◆ compute_font_metrics_from_face() [3/3]

static FontMetrics fastuidraw::FontFreeType::compute_font_metrics_from_face ( const reference_counted_ptr< FreeTypeFace > &  in_face)
static

Return a FontMetrics from the values of an FT_Face. Beware that the foundary name is not assigned!

◆ compute_font_properties_from_face() [1/3]

static void fastuidraw::FontFreeType::compute_font_properties_from_face ( FT_Face  in_face,
FontProperties out_properties 
)
static

Fill the field of a FontProperties from the values of an FT_Face. Beware that the foundary name is not assigned!

◆ compute_font_properties_from_face() [2/3]

static FontProperties fastuidraw::FontFreeType::compute_font_properties_from_face ( FT_Face  in_face)
static

Return a FontProperties from the values of an FT_Face. Beware that the foundary name is not assigned!

◆ compute_font_properties_from_face() [3/3]

static FontProperties fastuidraw::FontFreeType::compute_font_properties_from_face ( const reference_counted_ptr< FreeTypeFace > &  in_face)
static

Return a FontProperties from the values of an FT_Face. Beware that the foundary name is not assigned!

◆ compute_metrics()

virtual void fastuidraw::FontFreeType::compute_metrics ( uint32_t  glyph_code,
GlyphMetricsValue metrics 
) const
finaloverridevirtual

To be implemented by a derived class to provide the metrics data for the named glyph.

Parameters
glyph_codeglyph code of glyph to compute the metric values
[out]metricslocation to which to place the metric values for the glyph

Implements fastuidraw::FontBase.

◆ compute_rendering_data()

virtual GlyphRenderData* fastuidraw::FontFreeType::compute_rendering_data ( GlyphRenderer  render,
GlyphMetrics  glyph_metrics,
Path path,
vec2 render_size 
) const
finaloverridevirtual

To be implemented by a derived class to generate glyph rendering data given a glyph code and GlyphRenderer.

Parameters
renderspecifies object to return via GlyphRenderer::type(), it is guaranteed by the caller that can_create_rendering_data() returns true on render.type()
glyph_metricsGlyphMetrics values as computed by compute_metrics()
[out]pathlocation to which to write the Path of the glyph
[out]render_sizelocation to which to write the render size of the glyph

Implements fastuidraw::FontBase.

◆ face_generator()

const reference_counted_ptr<FreeTypeFace::GeneratorBase>& fastuidraw::FontFreeType::face_generator ( void  ) const

Returns the FreeTypeFace::GeneratorBase object used to generate the faces to generate the glyph data.

◆ glyph_codes()

virtual void fastuidraw::FontFreeType::glyph_codes ( enum CharacterEncoding::encoding_value_t  encoding,
c_array< const uint32_t >  in_character_codes,
c_array< uint32_t >  out_glyph_codes 
) const
finaloverridevirtual

To be implemented by a derived class to return the index values (glyph codes) for a sequence of character code. A glyph code of 0 indicates that a character code is not present in the font.

Parameters
encodingcharacter encoding of character codes
in_character_codescharacter codes from which to fetch glyph codes
[out]out_glyph_codeslocation to which to write glyph codes.

Implements fastuidraw::FontBase.

◆ lib()

const reference_counted_ptr<FreeTypeLib>& fastuidraw::FontFreeType::lib ( void  ) const

Returns the FreeTypeLib used by this FontFreeType

◆ number_glyphs()

virtual unsigned int fastuidraw::FontFreeType::number_glyphs ( void  ) const
finaloverridevirtual

To be implemented by a derived class to return the number of glyph codes the instance has. In particular the return value of glyph_code() is always less than number_glyphs() and the input to compute_metrics() will also have value no more than number_glyphs().

Implements fastuidraw::FontBase.


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