HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Friends
tt::unicode_description Class Reference

#include <ttauri/text/unicode_description.hpp>

Public Member Functions

constexpr unicode_description (char32_t code_point, unicode_general_category general_category, unicode_grapheme_cluster_break grapheme_cluster_break, unicode_bidi_class bidi_class, unicode_bidi_bracket_type bidi_bracket_type, char32_t bidi_mirrored_glyph, bool decomposition_canonical, bool composition_canonical, uint8_t combining_class, uint8_t decomposition_length, uint32_t decomposition_index) noexcept
 
constexpr char32_t code_point () const noexcept
 The code point of the description.
 
constexpr unicode_grapheme_cluster_break grapheme_cluster_break () const noexcept
 The grapheme cluster break of this code-point.
 
constexpr unicode_general_category general_category () const noexcept
 The general category of this code-point.
 
constexpr unicode_bidi_class bidi_class () const noexcept
 The bidi class of this code-point This function is used by the bidirectional algorithm to figure out if the code-point represents a character that is written left-to-right or right-to-left.
 
constexpr unicode_bidi_bracket_type bidi_bracket_type () const noexcept
 Get the bidi bracket type.
 
constexpr char32_t bidi_mirrored_glyph () const noexcept
 Get the mirrored glyph.
 
constexpr bool decomposition_canonical () const noexcept
 This character has a canonical decomposition.
 
constexpr bool composition_canonical () const noexcept
 This character has a canonical composition.
 
constexpr uint8_t combining_class () const noexcept
 Get the combining class.
 
constexpr size_t decomposition_length () const noexcept
 The number of code-points the decomposed grapheme has.
 
constexpr size_t decomposition_index () const noexcept
 A multi-use value representing the decomposition of this code-point.
 
constexpr char32_t canonical_equivalent () const noexcept
 Get the canonical equivalent of this code-point.
 

Friends

template<typename It >
constexpr It unicode_description_find (It first, It last, char32_t code_point) noexcept
 Find a code-point in a unicode_description table using a binary-search algorithm.
 

Detailed Description

Description of a unicode code point.

This class holds information of a unicode code point.

The information is compressed to use bit-fields to reduce memory usage of the unicode database.

Member Function Documentation

◆ bidi_bracket_type()

constexpr unicode_bidi_bracket_type tt::unicode_description::bidi_bracket_type ( ) const
inlineconstexprnoexcept

Get the bidi bracket type.

This function is used by the bidirectional algorithm for mirroring characters when needing to reverse the writing direction.

Returns
n = no-mirror, o = open-bracket, c = close-bracket, m = bidi-mirrored.

◆ bidi_class()

constexpr unicode_bidi_class tt::unicode_description::bidi_class ( ) const
inlineconstexprnoexcept

The bidi class of this code-point This function is used by the bidirectional algorithm to figure out if the code-point represents a character that is written left-to-right or right-to-left.

Returns
the bidi class of this code-point.

◆ bidi_mirrored_glyph()

constexpr char32_t tt::unicode_description::bidi_mirrored_glyph ( ) const
inlineconstexprnoexcept

Get the mirrored glyph.

Returns
The mirrored glyph or U+ffff when there is no mirrored glyph.

◆ canonical_equivalent()

constexpr char32_t tt::unicode_description::canonical_equivalent ( ) const
inlineconstexprnoexcept

Get the canonical equivalent of this code-point.

The canonical equivalent is the code-point after NFC-normalization. This is equal to canonical decomposition to a single code-point.

Returns
The canonical equivalent code-point or U+ffff if there is not equivalent.

◆ code_point()

constexpr char32_t tt::unicode_description::code_point ( ) const
inlineconstexprnoexcept

The code point of the description.

Returns
The code_point of the description.

◆ combining_class()

constexpr uint8_t tt::unicode_description::combining_class ( ) const
inlineconstexprnoexcept

Get the combining class.

The combing class describes how a code-point combines with other code-points. Specifically the value 0 means that the code-point is a starter character, and the numeric value of the combing class determines the order of the the code-points after a starter before trying to look up composition in the composition table.

Returns
The numeric combining class of this code point.

◆ composition_canonical()

constexpr bool tt::unicode_description::composition_canonical ( ) const
inlineconstexprnoexcept

This character has a canonical composition.

Returns
When true the decomposition_index() points into the composition table.

◆ decomposition_canonical()

constexpr bool tt::unicode_description::decomposition_canonical ( ) const
inlineconstexprnoexcept

This character has a canonical decomposition.

Returns
When true you can decompose the character canonically.

◆ decomposition_index()

constexpr size_t tt::unicode_description::decomposition_index ( ) const
inlineconstexprnoexcept

A multi-use value representing the decomposition of this code-point.

To compress the data for decomposition:

  • For single code-point decomposition the index itself is the code-point value.
  • For double code-point decomposition, if it is equal to the composition it points into the composition table, otherwise it points into the decomposition table
  • Anything else points into the decomposition table.
See also
decomposition_length
Returns
A code-point value, or a index into the composition table, or an index into the decomposition table.

◆ decomposition_length()

constexpr size_t tt::unicode_description::decomposition_length ( ) const
inlineconstexprnoexcept

The number of code-points the decomposed grapheme has.

Return values
0There is no decomposition
1Decomposition is a single code-point, the decomposition_index() is the numeric value of the code point.
2Decomposition is has two code-point. When composition_canonical is set the decomposition_index() points in the composition table. Otherwise the index points into the decomposition table.
Returns
Values 3 and above are the number of code points in the decomposition table pointed to from the decomposition_index().

◆ general_category()

constexpr unicode_general_category tt::unicode_description::general_category ( ) const
inlineconstexprnoexcept

The general category of this code-point.

This function is used to determine what kind of code-point this, this allows you to determine if the code-point is a letter, number, punctuation, white-space, etc.

Returns
The general category of this code-point

◆ grapheme_cluster_break()

constexpr unicode_grapheme_cluster_break tt::unicode_description::grapheme_cluster_break ( ) const
inlineconstexprnoexcept

The grapheme cluster break of this code-point.

This function is used to determine where to break a string of code-points into grapheme clusters.

Returns
The grapheme cluster break of this code-point

Friends And Related Symbol Documentation

◆ unicode_description_find

template<typename It >
constexpr It unicode_description_find ( It first,
It last,
char32_t code_point )
friend

Find a code-point in a unicode_description table using a binary-search algorithm.

Parameters
firstThe iterator pointing to the first element of a sorted container of unicode_description objects.
lastThe iterator pointing to one beyond the last element of a sorted container of unicode_description objects.
code_pointThe code point to look up.
Returns
An iterator pointing the found unicode_description, or the last iterator when not found.

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