CartoType C++ API 8.8-7-gb35e4dc71
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
CartoTypeCore::Char Class Reference

#include <cartotype_char.h>

Public Member Functions

 Char ()
 
 Char (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
 
CharCategory Category () const
 
CartoTypeCore::BidiType 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 Code { 0 }
 

Static Public Attributes

static constexpr int KMaxCaseVariantLength = 2
 
static constexpr uint32_t KFirstFontSelector = 0xF000
 
static constexpr uint32_t KDefaultFontSelector = 0xF3FF
 
static constexpr uint32_t KLastFontSelector = KDefaultFontSelector
 
static constexpr uint32_t KFontSelectorCount = KLastFontSelector - KFirstFontSelector
 
static constexpr uint32_t KFirstBoxStyleSelector = 0xF400
 
static constexpr uint32_t KLastBoxStyleSelector = 0xF7FE
 
static constexpr uint32_t KBoxStyleSelectorCount = KLastBoxStyleSelector - KFirstBoxStyleSelector + 1
 
static constexpr uint32_t KEndOfBox = 0xF7FF
 
static constexpr uint32_t KBaselineSelector = 0xF800
 
static constexpr uint32_t KFirstCartoTypePrivateUseCharacter = KFirstFontSelector
 
static constexpr uint32_t KLastCartoTypePrivateUseCharacter = KBaselineSelector
 

Detailed Description

A class to provide Unicode character properties. A Char 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

◆ Char() [1/2]

CartoTypeCore::Char::Char ( )
inline

Create a Char with the character code 0.

◆ Char() [2/2]

CartoTypeCore::Char::Char ( int32_t  aCode)
inline

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

Member Function Documentation

◆ AccentStripped()

int32_t CartoTypeCore::Char::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()

BidiType CartoTypeCore::Char::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 BidiType::ON (other neutral).

◆ Category()

CharCategory CartoTypeCore::Char::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 CharCategoryFlag::Cn (other, not assigned).

◆ GetLowerCase()

void CartoTypeCore::Char::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 CartoTypeCore::Char::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 CartoTypeCore::Char::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 CartoTypeCore::Char::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 CartoTypeCore::Char::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 CartoTypeCore::Char::IsWhitespace ( ) const

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

◆ Mirrored()

int32_t CartoTypeCore::Char::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

◆ Code

int32_t CartoTypeCore::Char::Code { 0 }

The Unicode code point of the character.

◆ KBaselineSelector

constexpr uint32_t CartoTypeCore::Char::KBaselineSelector = 0xF800
staticconstexpr

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

◆ KBoxStyleSelectorCount

constexpr uint32_t CartoTypeCore::Char::KBoxStyleSelectorCount = KLastBoxStyleSelector - KFirstBoxStyleSelector + 1
staticconstexpr

The number of box style selectors.

◆ KDefaultFontSelector

constexpr uint32_t CartoTypeCore::Char::KDefaultFontSelector = 0xF3FF
staticconstexpr

A private use character to select the default font.

◆ KEndOfBox

constexpr uint32_t CartoTypeCore::Char::KEndOfBox = 0xF7FF
staticconstexpr

A character to mark the end of a box.

◆ KFirstBoxStyleSelector

constexpr uint32_t CartoTypeCore::Char::KFirstBoxStyleSelector = 0xF400
staticconstexpr

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

◆ KFirstCartoTypePrivateUseCharacter

constexpr uint32_t CartoTypeCore::Char::KFirstCartoTypePrivateUseCharacter = KFirstFontSelector
staticconstexpr

The first private use character used by CartoTypeCore.

◆ KFirstFontSelector

constexpr uint32_t CartoTypeCore::Char::KFirstFontSelector = 0xF000
staticconstexpr

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

◆ KFontSelectorCount

constexpr uint32_t CartoTypeCore::Char::KFontSelectorCount = KLastFontSelector - KFirstFontSelector
staticconstexpr

The number of font selectors, excluding the default font selector.

◆ KLastBoxStyleSelector

constexpr uint32_t CartoTypeCore::Char::KLastBoxStyleSelector = 0xF7FE
staticconstexpr

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

◆ KLastCartoTypePrivateUseCharacter

constexpr uint32_t CartoTypeCore::Char::KLastCartoTypePrivateUseCharacter = KBaselineSelector
staticconstexpr

The last private use character used by CartoTypeCore.

◆ KLastFontSelector

constexpr uint32_t CartoTypeCore::Char::KLastFontSelector = KDefaultFontSelector
staticconstexpr

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

◆ KMaxCaseVariantLength

constexpr int CartoTypeCore::Char::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: