FlatUI
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Enumerations Groups Pages
flatui::FontBufferParameters Class Reference

This class that includes font buffer parameters. It is used as a key in the unordered_map to look up FontBuffer. More...

#include <font_buffer.h>

Detailed Description

This class that includes font buffer parameters. It is used as a key in the unordered_map to look up FontBuffer.

Public Member Functions

 FontBufferParameters ()
 The default constructor for an empty FontBufferParameters.
 
 FontBufferParameters (HashedId font_id, HashedId text_id, float font_size, const mathfu::vec2i &size, TextAlignment text_alignment, GlyphFlags glyph_flags, bool caret_info, bool ref_count, bool enable_hyphenation=false, bool rtl_layout=false, float kerning_scale=kKerningScaleDefault, float line_height_scale=kLineHeightDefault, HashedId cache_id=kNullHash)
 Constructor for a FontBufferParameters. More...
 
bool operator== (const FontBufferParameters &other) const
 The equal-to operator for comparing FontBufferParameters for equality. More...
 
size_t operator() (const FontBufferParameters &key) const
 The hash function for FontBufferParameters. More...
 
bool operator() (const FontBufferParameters &lhs, const FontBufferParameters &rhs) const
 The compare operator for FontBufferParameters.
 
HashedId get_font_id () const
 
HashedId get_text_id () const
 
HashedId get_cache_id () const
 
const mathfu::vec2i & get_size () const
 
float get_font_size () const
 
TextAlignment get_text_alignment () const
 
float get_kerning_scale () const
 
float get_line_height_scale () const
 
GlyphFlags get_glyph_flags () const
 
bool get_caret_info_flag () const
 
bool get_ref_count_flag () const
 
bool get_rtl_layout_flag () const
 
bool get_enable_hyphenation_flag () const
 
int32_t get_line_length () const
 
bool get_multi_line_setting () const
 
void set_font_size (float size)
 Set font size.
 
void set_size (mathfu::vec2i &size)
 Set the size value.
 

Constructor & Destructor Documentation

flatui::FontBufferParameters::FontBufferParameters ( HashedId  font_id,
HashedId  text_id,
float  font_size,
const mathfu::vec2i &  size,
TextAlignment  text_alignment,
GlyphFlags  glyph_flags,
bool  caret_info,
bool  ref_count,
bool  enable_hyphenation = false,
bool  rtl_layout = false,
float  kerning_scale = kKerningScaleDefault,
float  line_height_scale = kLineHeightDefault,
HashedId  cache_id = kNullHash 
)
inline

Constructor for a FontBufferParameters.

Parameters
[in]font_idThe HashedId for the font.
[in]text_idThe HashedID for the text.
[in]font_sizeA float representing the size of the font.
[in]sizeThe requested size of the FontBuffer in pixels. The created FontBuffer size can be smaller than requested size as the FontBuffer size is calcuated by the layout and rendering result.
[in]text_alignmentA horizontal alignment of multi line buffer.
[in]kerning_scaleValue indicating kerning scale.
[in]line_height_scaleValue indicating line height scale.
[in]glyph_flagsA flag determing SDF generation for the font.
[in]caret_infoA bool determining if the FontBuffer contains caret info.
[in]ref_countA bool determining if the FontBuffer manages reference counts of the buffer and referencing glyph cache rows.
[in]enable_hyphenationA bool determining if the hyphenation is enabled for the FontBuffer.
[in]rtl_layoutA bool determining if the FontBuffer is for RTL (right to left) layout.
[in]kerning_scaleA float value specifying a scale applied to the kerning value between glyphs. Default value is kKerningScaleDefault(1.0).
[in]line_height_scaleA float value specifying a scale applied to the line height for each line break. Default value is kLineHeightDefault(1.0).
[in]cache_idAn extra ID to distinguish cache entry. For instance, tweak the ID to have multiple FontBuffer instances with the same set of parameters.

Member Function Documentation

HashedId flatui::FontBufferParameters::get_cache_id ( ) const
inline
Returns
Returns a cache id value.
bool flatui::FontBufferParameters::get_caret_info_flag ( ) const
inline
Returns
Returns a flag indicating if the buffer has caret info.
bool flatui::FontBufferParameters::get_enable_hyphenation_flag ( ) const
inline
Returns
Returns a flag indicating if the hyphenation is enabled.
HashedId flatui::FontBufferParameters::get_font_id ( ) const
inline
Returns
Returns a font hash id.
float flatui::FontBufferParameters::get_font_size ( ) const
inline
Returns
Returns the font size.
GlyphFlags flatui::FontBufferParameters::get_glyph_flags ( ) const
inline
Returns
Returns a glyph setting info.
float flatui::FontBufferParameters::get_kerning_scale ( ) const
inline
Returns
Returns the kerning scale.
float flatui::FontBufferParameters::get_line_height_scale ( ) const
inline
Returns
Returns the line height scale.
int32_t flatui::FontBufferParameters::get_line_length ( ) const
inline

Retrieve a line length of the text based on given parameters. a fixed line length (get_size.x) will be used if the text is justified or right aligned otherwise the line length will be determined by the text layout phase.

Returns
Returns the expected line width.
bool flatui::FontBufferParameters::get_multi_line_setting ( ) const
inline
Returns
Returns the multi line setting.
bool flatui::FontBufferParameters::get_ref_count_flag ( ) const
inline
Returns
Returns a flag indicating if the buffer manages reference counts.
bool flatui::FontBufferParameters::get_rtl_layout_flag ( ) const
inline
Returns
Returns a flag indicating if the buffer is for RTL layout.
const mathfu::vec2i& flatui::FontBufferParameters::get_size ( ) const
inline
Returns
Returns the size value.
TextAlignment flatui::FontBufferParameters::get_text_alignment ( ) const
inline
Returns
Returns a text alignment info.
HashedId flatui::FontBufferParameters::get_text_id ( ) const
inline
Returns
Returns a hash value of the text.
size_t flatui::FontBufferParameters::operator() ( const FontBufferParameters key) const
inline

The hash function for FontBufferParameters.

Parameters
[in]keyA FontBufferParameters to use as the key for hashing.
Returns
Returns a size_t of the hash of the FontBufferParameters.
bool flatui::FontBufferParameters::operator== ( const FontBufferParameters other) const
inline

The equal-to operator for comparing FontBufferParameters for equality.

Parameters
[in]otherThe other FontBufferParameters to check against for equality.
Returns
Returns true if the two FontBufferParameters are equal. Otherwise it returns false.

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