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

Public Member Functions

 AttributedGlyph (AttributedGrapheme const &attr_grapheme, AttributedGlyph const *next_attr_glyph=nullptr) noexcept
 Constructed an attributed glyph from an attributed grapheme.
 
 AttributedGlyph (AttributedGlyph const &other)=default
 
 AttributedGlyph (AttributedGlyph &&other) noexcept=default
 
AttributedGlyphoperator= (AttributedGlyph const &other)=default
 
AttributedGlyphoperator= (AttributedGlyph &&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 isWord () 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.
 
aarect boundingBox (float border) const noexcept
 Get the bounding box for this glyph.
 
ssize_t relativeIndexAtCoordinate (vec coordinate) const noexcept
 Find the logical index closest to the coordinate.
 
Path get_path () const noexcept
 

Data Fields

FontGlyphIDs glyphs
 
ssize_t logicalIndex
 The logical index of the grapheme before bidi-algorithm.
 
GlyphMetrics metrics
 Metrics taken from the font file, pre-scaled to the font-size.
 
vec position
 Position of the glyph.
 
int8_t graphemeCount
 Number of graphemes merged (ligature) into this attributed-glyph.
 
GeneralCharacterClass charClass
 
TextStyle style
 Copied from the original attributed-grapheme.
 

Constructor & Destructor Documentation

◆ AttributedGlyph()

tt::AttributedGlyph::AttributedGlyph ( AttributedGrapheme const & attr_grapheme,
AttributedGlyph 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()

aarect tt::AttributedGlyph::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::AttributedGlyph::containsLogicalIndex ( ssize_t index) const
inlinenoexcept

Check if this glyph contains the grapheme at index.

◆ relativeIndexAtCoordinate()

ssize_t tt::AttributedGlyph::relativeIndexAtCoordinate ( vec 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::AttributedGlyph::selectionWordClusterID ( ) const
inlinenoexcept

return a cluster id for word selection.

This makes clusters of:

  • words (letter and digits),
  • visibiles (other visible letters)
  • whitespace
  • paragraph separator.

Field Documentation

◆ graphemeCount

int8_t tt::AttributedGlyph::graphemeCount

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

◆ logicalIndex

ssize_t tt::AttributedGlyph::logicalIndex

The logical index of the grapheme before bidi-algorithm.

◆ metrics

GlyphMetrics tt::AttributedGlyph::metrics

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

◆ position

vec tt::AttributedGlyph::position

Position of the glyph.

◆ style

TextStyle tt::AttributedGlyph::style

Copied from the original attributed-grapheme.


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