Use TextInputLayout to precalculate information on text layout properties, such as glyph directionality, width, buffer index to glyph mapping, and so on.
More...
#include <kanzi/core.ui/text/text_input_layout.hpp>
|
void | calculateLayout (string_view text, TextLayout &textLayout, bool isMarked) |
| Calculates the layout information for the given text. More...
|
|
vector< pair< float, float > > | calculateSelectionCoordinates (size_t selectionStart, size_t selectionEnd) const |
| Returns all intervals to highlight due to a selection. More...
|
|
float | getCaretX (size_t characterIndex) const |
| Returns the caret position for the character at a given character index. More...
|
|
float | getCaretXAfter (size_t characterIndex) const |
| Returns the caret position after the character at a given character index. More...
|
|
size_t | getCharacterAt (float x, bool round) const |
| Finds the index of the character at a given x axis coordinate. More...
|
|
size_t | getClustersPositionBackward (size_t position, size_t distance) const |
| Returns the position distance clusters backward. More...
|
|
size_t | getClustersPositionForward (size_t position, size_t distance) const |
| Returns the position distance clusters forward. More...
|
|
size_t | startOfFollowingCluster (size_t characterIndex) const |
| Returns the index of the first character in the cluster that follows the cluster to which characterIndex belongs. More...
|
|
size_t | startOfPrecedingCluster (size_t characterIndex) const |
| Returns the index of the first character in the cluster that precedes the cluster to which characterIndex belongs. More...
|
|
| TextInputLayout ()=default |
| Constructor. More...
|
|
Use TextInputLayout to precalculate information on text layout properties, such as glyph directionality, width, buffer index to glyph mapping, and so on.
- Since
- Kanzi 3.9.0
kanzi::TextInputLayout::TextInputLayout |
( |
| ) |
|
|
explicitdefault |
void kanzi::TextInputLayout::calculateLayout |
( |
string_view |
text, |
|
|
TextLayout & |
textLayout, |
|
|
bool |
isMarked |
|
) |
| |
Calculates the layout information for the given text.
Call this function whenever the text or its layout changes.
- Parameters
-
text | The text for which this function computes the layout information. |
textLayout | The text layout that this function uses to compute the positions of characters in the text. |
isMarked | Indicates whether the text is prefixed with a directionality marker. |
size_t kanzi::TextInputLayout::startOfPrecedingCluster |
( |
size_t |
characterIndex | ) |
const |
Returns the index of the first character in the cluster that precedes the cluster to which characterIndex belongs.
- Parameters
-
characterIndex | The character index for which this function returns the index of the first character in the preceding cluster. |
- Returns
- The index of the first character in the cluster that precedes the cluster to which characterIndex belongs.
size_t kanzi::TextInputLayout::getClustersPositionForward |
( |
size_t |
position, |
|
|
size_t |
distance |
|
) |
| const |
Returns the position
distance
clusters forward.
size_t kanzi::TextInputLayout::getClustersPositionBackward |
( |
size_t |
position, |
|
|
size_t |
distance |
|
) |
| const |
Returns the position
distance
clusters backward.
size_t kanzi::TextInputLayout::startOfFollowingCluster |
( |
size_t |
characterIndex | ) |
const |
Returns the index of the first character in the cluster that follows the cluster to which characterIndex belongs.
- Parameters
-
characterIndex | The character index for which this function returns the index of the first character in the following cluster. |
- Returns
- The index of the first character in the cluster that follows the cluster to which characterIndex belongs.
float kanzi::TextInputLayout::getCaretX |
( |
size_t |
characterIndex | ) |
const |
Returns the caret position for the character at a given character index.
If characterIndex is greater than the length of the text, the caret position is the logical end of the text.
- Parameters
-
characterIndex | The character index whose caret position this function returns. |
- Returns
- The caret position of characterIndex.
float kanzi::TextInputLayout::getCaretXAfter |
( |
size_t |
characterIndex | ) |
const |
Returns the caret position after the character at a given character index.
If characterIndex is greater than the length of the text, the caret position is the logical end of the text.
- Parameters
-
characterIndex | The character index whose caret position this function returns. |
- Returns
- The caret end position of characterIndex.
size_t kanzi::TextInputLayout::getCharacterAt |
( |
float |
x, |
|
|
bool |
round |
|
) |
| const |
Finds the index of the character at a given x axis coordinate.
- Parameters
-
x | The x axis coordinate to translate to a character position. |
round | Indicates whether to round to the nearest cursor position. To round use true, to not round use false. |
- Returns
- The character position translated from the x axis coordinate.
vector<pair<float, float> > kanzi::TextInputLayout::calculateSelectionCoordinates |
( |
size_t |
selectionStart, |
|
|
size_t |
selectionEnd |
|
) |
| const |
Returns all intervals to highlight due to a selection.
- Parameters
-
selectionStart | The first character of a selection. |
selectionEnd | The final character of a selection. |
- Returns
- A vector that contains the highlighted intervals.
The documentation for this class was generated from the following file: