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

#include <TTauri/Text/UnicodeData.hpp>

Public Member Functions

 UnicodeData (nonstd::span< std::byte const > bytes)
 Load binary unicode data.
 
 UnicodeData (std::unique_ptr< ResourceView > view)
 Load binary unicode data from a resource.
 
 UnicodeData (UnicodeData const &other)=delete
 
UnicodeDataoperator= (UnicodeData const &other)=delete
 
 UnicodeData (UnicodeData &&other)=delete
 
UnicodeDataoperator= (UnicodeData &&other)=delete
 
std::u32string toNFD (std::u32string_view text, bool decomposeLigatures=false) const noexcept
 Convert text to Unicode-NFD normal form.
 
std::u32string toNFC (std::u32string_view text, bool decomposeLigatures=false, bool composeCRLF=false) const noexcept
 Convert text to Unicode-NFC normal form.
 
std::u32string toNFKD (std::u32string_view text) const noexcept
 Convert text to Unicode-NFKD normal form.
 
std::u32string toNFKC (std::u32string_view text, bool composeCRLF=false) const noexcept
 Convert text to Unicode-NFKC normal form.
 
bool checkGraphemeBreak (char32_t codeUnit, GraphemeBreakState &state) const noexcept
 Check if for a graphemeBreak before the character.
 
BidiClass getBidiClass (char32_t codePoint) const noexcept
 Get the bidirectional class for a code-point.
 

Detailed Description

Unicode Data used for characterizing unicode code-points.

Constructor & Destructor Documentation

◆ UnicodeData() [1/2]

tt::UnicodeData::UnicodeData ( nonstd::span< std::byte const > bytes)

Load binary unicode data.

The bytes passed into this constructor will need to remain available.

◆ UnicodeData() [2/2]

tt::UnicodeData::UnicodeData ( std::unique_ptr< ResourceView > view)

Load binary unicode data from a resource.

Member Function Documentation

◆ checkGraphemeBreak()

bool tt::UnicodeData::checkGraphemeBreak ( char32_t codeUnit,
GraphemeBreakState & state ) const
noexcept

Check if for a graphemeBreak before the character.

Code-units must be tested in order, starting at the beginning of the text.

Do not pass code-units above 0x1f'ffff nor the code-unit 0x00'ffff. Code units between 0x11'0000 and 0x1f'ffff will be treated as GraphemeUnitType::Other.

Parameters
codeUnitCurrent code-unit to test.
stateCurrent state of the grapheme-break algorithm.
Returns
true when a grapheme break exists before the current code-unit.

◆ getBidiClass()

BidiClass tt::UnicodeData::getBidiClass ( char32_t codePoint) const
noexcept

Get the bidirectional class for a code-point.

Do not pass code-units above 0x1f'ffff nor the code-unit 0x00'ffff. Code units between 0x11'0000 and 0x1f'ffff will be treated as BidiClass::Unknown.

◆ toNFC()

std::u32string tt::UnicodeData::toNFC ( std::u32string_view text,
bool decomposeLigatures = false,
bool composeCRLF = false ) const
noexcept

Convert text to Unicode-NFC normal form.

Certain ligatures, which are seen as separate graphemes by the user may be decomposed when using the decomposeLigatures flag.

Do not pass code-units above 0x1f'ffff nor the code-unit 0x00'ffff. Code units between 0x11'0000 and 0x1f'ffff will pass through.

Parameters
textto normalize, in-place.
decomposeLigatures'canonical'-ligatures are decomposed.
composeCRLFCompose CR-LF combinations to LF.

◆ toNFD()

std::u32string tt::UnicodeData::toNFD ( std::u32string_view text,
bool decomposeLigatures = false ) const
noexcept

Convert text to Unicode-NFD normal form.

Certain ligatures, which are seen as separate graphemes by the user may be decomposed when using the decomposeLigatures flag.

Do not pass code-units above 0x1f'ffff nor the code-unit 0x00'ffff. Code units between 0x11'0000 and 0x1f'ffff will pass through.

Parameters
textto normalize, in-place.
decomposeLigatures'canonical'-ligatures are decomposed.

◆ toNFKC()

std::u32string tt::UnicodeData::toNFKC ( std::u32string_view text,
bool composeCRLF = false ) const
noexcept

Convert text to Unicode-NFKC normal form.

Do not pass code-units above 0x1f'ffff nor the code-unit 0x00'ffff. Code units between 0x11'0000 and 0x1f'ffff will pass through.

Parameters
textto normalize, in-place.
composeCRLFCompose CR-LF combinations to LF.

◆ toNFKD()

std::u32string tt::UnicodeData::toNFKD ( std::u32string_view text) const
noexcept

Convert text to Unicode-NFKD normal form.

Do not pass code-units above 0x1f'ffff nor the code-unit 0x00'ffff. Code units between 0x11'0000 and 0x1f'ffff will pass through.

Parameters
textto normalize, in-place.

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