HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
v1::true_type_font Class Referencefinal
Inheritance diagram for v1::true_type_font:
v1::font

Public Member Functions

 true_type_font (std::filesystem::path const &path)
 true_type_font (true_type_font const &other)=delete
true_type_font & operator= (true_type_font const &other)=delete
 true_type_font (true_type_font &&other)=delete
true_type_font & operator= (true_type_font &&other)=delete
bool loaded () const noexcept override
 Return if the font is loaded.
graphic_path get_path (hi::glyph_id glyph_id) const override
 Load a glyph into a path.
float get_advance (hi::glyph_id glyph_id) const override
 Get the advance for a glyph.
glyph_metrics get_metrics (hi::glyph_id glyph_id) const override
 Load a glyph into a path.
shape_run_result_type shape_run (iso_639 language, iso_15924 script, gstring run) const override
 Shape a run of graphemes.
Public Member Functions inherited from v1::font
 font (font const &)=delete
font & operator= (font const &)=delete
 font (font &&)=delete
font & operator= (font &&)=delete
glyph_id find_glyph (char32_t c) const noexcept
 Get the glyph for a code-point.
lean_vector< glyph_id > find_glyph (grapheme g) const
 Get the glyphs for a grapheme.
glyph_atlas_infoatlas_info (glyph_id glyph) const
font_variant font_variant () const noexcept

Additional Inherited Members

Data Fields inherited from v1::font
std::string family_name
 The family name as parsed from the font file.
std::string sub_family_name
 The sub-family name as parsed from the font file.
bool monospace = false
bool serif = false
font_style style = font_style::normal
bool condensed = false
font_weight weight = font_weight::regular
float optical_size = 12.0
font_char_map char_map
 A optimized character map.
std::string features
 A string representing the features of a font.
font_metrics_em metrics
 The metrics of a font.
std::vector< hi::font_idfallback_chain
 List of fonts to use as a fallback for this font.

Member Function Documentation

◆ get_advance()

float v1::true_type_font::get_advance ( hi::glyph_id glyph_id) const
inlinenodiscardoverridevirtual

Get the advance for a glyph.

Parameters
glyph_idThe glyph to look up the advance for.
Returns
The advance for the glyph.
Exceptions
std::exceptionIf there was an error looking up the glyph.

Implements v1::font.

◆ get_metrics()

glyph_metrics v1::true_type_font::get_metrics ( hi::glyph_id glyph_id) const
inlinenodiscardoverridevirtual

Load a glyph into a path.

The glyph is directly loaded from the font file.

Parameters
glyph_idthe id of a glyph inside the font.
metricsThe metrics constructed by the loader.
lookahead_glyph_idThe id of a glyph to the right, needed for kerning.
Returns
true on success, false on error.

Implements v1::font.

◆ get_path()

graphic_path v1::true_type_font::get_path ( hi::glyph_id glyph_id) const
inlinenodiscardoverridevirtual

Load a glyph into a path.

The glyph is directly loaded from the font file.

Parameters
glyph_idthe id of a glyph inside the font.
Returns
The path loaded from the font file.
Exceptions
std::exceptionIf there was an error while loading the path. Recommend to disable the font on error.

Implements v1::font.

◆ loaded()

bool v1::true_type_font::loaded ( ) const
inlinenodiscardoverridevirtualnoexcept

Return if the font is loaded.

Returns
true if the font is fully loaded, false if only metadata of the font is available.

Implements v1::font.

◆ shape_run()

shape_run_result_type v1::true_type_font::shape_run ( iso_639 language,
iso_15924 script,
gstring run ) const
inlinenodiscardoverridevirtual

Shape a run of graphemes.

A run of graphemes is a piece of text that is:

  • from the same style,
  • from the same font,
  • from the same language and script, and
  • on the same line.

A run needs to be shaped by the font-file itself as it handles:

  • language/script depended glyph substitution for ligatures, accents and cursive text.
  • language/script depended glyph positioning for kerning, accents and cursive text.
Parameters
languageThe language of this run of graphemes.
scriptThe script of this run of graphemes.
runThe run of graphemes.
Returns
The glyphs and coordinates to display, and coordinates of grapheme for interaction.

Implements v1::font.


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