CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
CartoType::TChar Class Reference

#include <cartotype_char.h>

Public Member Functions

 TChar ()
 
 TChar (int32_t aCode)
 
void GetLowerCase (int32_t *aText, int32_t &aTextLength) const
 
void GetTitleCase (int32_t *aText, int32_t &aTextLength) const
 
void GetUpperCase (int32_t *aText, int32_t &aTextLength) const
 
TCharCategory Category () const
 
TBidiType BidiType () const
 
int32_t Mirrored () const
 
int32_t AccentStripped () const
 
bool IsAlphanumeric () const
 
bool IsWhitespace () const
 

Static Public Member Functions

static bool InWord (int32_t aCode)
 

Public Attributes

int32_t iCode { 0 }
 

Static Public Attributes

static constexpr int KMaxCaseVariantLength = 2
 
static constexpr uint32_t KFirstFontSelector = 0xF000
 
static constexpr uint32_t KDefaultFontSelector = 0xF0FF
 
static constexpr uint32_t KLastFontSelector = KDefaultFontSelector
 
static constexpr uint32_t KFirstBoxStyleSelector = 0xF100
 
static constexpr uint32_t KLastBoxStyleSelector = 0xF1FE
 
static constexpr uint32_t KEndOfBox = 0xF1FF
 
static constexpr uint32_t KBaselineSelector = 0xF200
 
static constexpr uint32_t KFirstCartoTypePrivateUseCharacter = KFirstFontSelector
 
static constexpr uint32_t KLastCartoTypePrivateUseCharacter = KBaselineSelector
 

Detailed Description

A class to provide Unicode character properties. A TChar object holds a single character encoded using its Unicode code point. Surrogates have no meaning in this context. All signed 32-bit values are valid but not all are defined as characters. Non-character values give consistent default values: for example, the uppercase version of a non-character value is the same value.

Constructor & Destructor Documentation

◆ TChar() [1/2]

CartoType::TChar::TChar ( )
inline

Create a TChar with the character code 0.

◆ TChar() [2/2]

CartoType::TChar::TChar ( int32_t  aCode)
inline

Construct a TChar from a Unicode code point (without checking its validity as such).

Member Function Documentation

◆ AccentStripped()

int32_t CartoType::TChar::AccentStripped ( ) const

Returns the character stripped of any accent. This function is limited at the moment and does not handle all accented characters, only a commonly used subset. It is used in fuzzy matching in text searches.

◆ BidiType()

TBidiType CartoType::TChar::BidiType ( ) const

Returns the bidirectional type of a character as defined in the Unicode Standard. For characters outside the Basic Multilingual Plane (U+0000...U+FFFF) this function returns TBidiType::ON (other neutral).

◆ Category()

TCharCategory CartoType::TChar::Category ( ) const

Returns the general category of a character as defined in the Unicode Standard. For characters outside the Basic Multilingual Plane (U+0000...U+FFFF) this function returns TCharCategoryFlag::Cn (other, not assigned).

◆ GetLowerCase()

void CartoType::TChar::GetLowerCase ( int32_t *  aText,
int32_t &  aTextLength 
) const

Returns the lower-case version of a character as a sequence of one or more characters. If there is no lower-case variant this function returns the original character. For characters outside the Basic Multilingual Plane (U+0000...U+FFFF) this function returns the original character.

◆ GetTitleCase()

void CartoType::TChar::GetTitleCase ( int32_t *  aText,
int32_t &  aTextLength 
) const

Returns the title-case version of a character as a sequence of one or more characters. If there is no title-case variant this function returns the original character. For characters outside the Basic Multilingual Plane (U+0000...U+FFFF) this function returns the original character.

◆ GetUpperCase()

void CartoType::TChar::GetUpperCase ( int32_t *  aText,
int32_t &  aTextLength 
) const

Returns the upper-case (capital) version of a character as a sequence of one or more characters. If there is no upper-case variant this function returns the original character. For characters outside the Basic Multilingual Plane (U+0000...U+FFFF) this function returns the original character.

◆ InWord()

static bool CartoType::TChar::InWord ( int32_t  aCode)
inlinestatic

Return true if a character code is in a word. Words are defined as sequences of letters and combining marks.

◆ IsAlphanumeric()

bool CartoType::TChar::IsAlphanumeric ( ) const

Returns true if this character is a letter or a digit: in one of the categories Lu, Ll, Lt, Lm, Lo, Nd, Nl or No.

◆ IsWhitespace()

bool CartoType::TChar::IsWhitespace ( ) const

Returns true if this character is whitespace: in one of the categories Zs, Zl, or Zp.

◆ Mirrored()

int32_t CartoType::TChar::Mirrored ( ) const

Returns the mirrored version of the character; that is, the character to be displayed if the text is drawn from right to left. For example, the mirrored version of '[' is ']'. For characters outside the Basic Multilingual Plane (U+0000...U+FFFF) this function returns the original character.

Member Data Documentation

◆ iCode

int32_t CartoType::TChar::iCode { 0 }

The Unicode code point of the character.

◆ KBaselineSelector

constexpr uint32_t CartoType::TChar::KBaselineSelector = 0xF200
staticconstexpr

A character to set the baseline of a box to the baseline of the current line.

◆ KDefaultFontSelector

constexpr uint32_t CartoType::TChar::KDefaultFontSelector = 0xF0FF
staticconstexpr

A private use character to select the default font.

◆ KEndOfBox

constexpr uint32_t CartoType::TChar::KEndOfBox = 0xF1FF
staticconstexpr

A character to mark the end of a box.

◆ KFirstBoxStyleSelector

constexpr uint32_t CartoType::TChar::KFirstBoxStyleSelector = 0xF100
staticconstexpr

The start of a range of private use characters to select box styles (background and outline).

◆ KFirstCartoTypePrivateUseCharacter

constexpr uint32_t CartoType::TChar::KFirstCartoTypePrivateUseCharacter = KFirstFontSelector
staticconstexpr

The first private use character used by CartoType.

◆ KFirstFontSelector

constexpr uint32_t CartoType::TChar::KFirstFontSelector = 0xF000
staticconstexpr

The start of a range of private use characters to select fonts.

◆ KLastBoxStyleSelector

constexpr uint32_t CartoType::TChar::KLastBoxStyleSelector = 0xF1FE
staticconstexpr

The end of a range of private use characters to select box styles (background and outline).

◆ KLastCartoTypePrivateUseCharacter

constexpr uint32_t CartoType::TChar::KLastCartoTypePrivateUseCharacter = KBaselineSelector
staticconstexpr

The last private use character used by CartoType.

◆ KLastFontSelector

constexpr uint32_t CartoType::TChar::KLastFontSelector = KDefaultFontSelector
staticconstexpr

The end of a range of private use characters to select fonts.

◆ KMaxCaseVariantLength

constexpr int CartoType::TChar::KMaxCaseVariantLength = 2
staticconstexpr

A case variant can be no longer than this number of UTF32 characters. For example, the upper-case variant of U+00DF is 'SS' and is two characters long.


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