HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
tt::attributed_glyph Struct Reference

Public Member Functions

 attributed_glyph (attributed_grapheme const &attr_grapheme, attributed_glyph const *next_attr_glyph=nullptr) noexcept
 Constructed an attributed glyph from an attributed grapheme.
 
 attributed_glyph (attributed_glyph const &other)=default
 
 attributed_glyph (attributed_glyph &&other) noexcept=default
 
attributed_glyphoperator= (attributed_glyph const &other)=default
 
attributed_glyphoperator= (attributed_glyph &&other) noexcept=default
 
bool containsLogicalIndex (ssize_t index) const noexcept
 Check if this glyph contains the grapheme at index.
 
bool isLetter () const noexcept
 
bool isDigit () const noexcept
 
bool isIdentifier () const noexcept
 
bool isWhiteSpace () const noexcept
 
bool isParagraphSeparator () const noexcept
 
bool isVisible () const noexcept
 
int selectionWordClusterID () const noexcept
 return a cluster id for word selection.
 
aarectangle boundingBox (float border) const noexcept
 Get the bounding box for this glyph.
 
ssize_t relativeIndexAtCoordinate (point2 coordinate) const noexcept
 Find the logical index closest to the coordinate.
 
graphic_path get_path () const noexcept
 

Data Fields

font_glyph_ids glyphs
 
ssize_t logicalIndex
 The logical index of the grapheme before bidi-algorithm.
 
glyph_metrics metrics
 Metrics taken from the font file, pre-scaled to the font-size.
 
point2 position
 Position of the glyph.
 
int8_t graphemeCount
 Number of graphemes merged (ligature) into this attributed-glyph.
 
unicode_general_category general_category
 
text_style style
 Copied from the original attributed-grapheme.
 

Constructor & Destructor Documentation

◆ attributed_glyph()

tt::attributed_glyph::attributed_glyph ( attributed_grapheme const & attr_grapheme,
attributed_glyph const * next_attr_glyph = nullptr )
noexcept

Constructed an attributed glyph from an attributed grapheme.

When converting a string of graphemes into a string of glyphs you should process the graphemes in reverse order so that you can pass the next_attr_glyph to this constructor for font-based-kerning.

The string of graphemes should already be in display-order; after Unicode-bidi-algorithm.

Parameters
attr_graphemeThe grapheme to turn into a glyph.
next_attr_glyphThe next glyph in display-ordering, used for kerning.

Member Function Documentation

◆ boundingBox()

aarectangle tt::attributed_glyph::boundingBox ( float border) const
inlinenoexcept

Get the bounding box for this glyph.

Get the scaled and positioned bounding box.

Parameters
borderThe 1EM scaled border around the glyph bounding box.

◆ containsLogicalIndex()

bool tt::attributed_glyph::containsLogicalIndex ( ssize_t index) const
inlinenoexcept

Check if this glyph contains the grapheme at index.

◆ relativeIndexAtCoordinate()

ssize_t tt::attributed_glyph::relativeIndexAtCoordinate ( point2 coordinate) const
inlinenoexcept

Find the logical index closest to the coordinate.

For a non-ligature, left of the halfway-point returnes the current logicalIndex, right of the halfway-point return the next logicalIndex.

◆ selectionWordClusterID()

int tt::attributed_glyph::selectionWordClusterID ( ) const
inlinenoexcept

return a cluster id for word selection.

This makes clusters of:

  • paragraph separator.
  • identifiers (letter and digits),
  • visibles (other marks and symbols)
  • whitespace

Field Documentation

◆ graphemeCount

int8_t tt::attributed_glyph::graphemeCount

Number of graphemes merged (ligature) into this attributed-glyph.

◆ logicalIndex

ssize_t tt::attributed_glyph::logicalIndex

The logical index of the grapheme before bidi-algorithm.

◆ metrics

glyph_metrics tt::attributed_glyph::metrics

Metrics taken from the font file, pre-scaled to the font-size.

◆ position

point2 tt::attributed_glyph::position

Position of the glyph.

◆ style

text_style tt::attributed_glyph::style

Copied from the original attributed-grapheme.


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