TextShaper encapsulates different shaping libraries, used by TextLayouter to perform BiDi layouting, text shaping and glyph substitution.
More...
#include <kanzi/core.ui/text/text_shaper.hpp>
TextShaper encapsulates different shaping libraries, used by TextLayouter to perform BiDi layouting, text shaping and glyph substitution.
TextLayouter calls the shaping functions for every text being layouted in the following order:
- markBidiAndShape() for initial creation of layouting information
- appendTerminator() for adding terminator (if text is truncated)
- prepareLines() to prepare shaper internal data structures when line breaks are available
- reorderLine() for every line to apply right-to-left formatting
- adjustPositions() for every line to move characters to correct visual positions
- cleanup() to allow shaper to clean internal data structures
kanzi::TextShaper::TextShaper |
( |
const FontRuntime & |
font | ) |
|
|
explicit |
Constructor.
- Parameters
-
font | Font object used for shaping. |
virtual kanzi::TextShaper::~TextShaper |
( |
| ) |
|
|
virtual |
This function performs the following operations.
- Creates tags to indicate which parts of the text are written left-to-right and which right-to-left.
- Performs mirroring of specific character for the text written right-to-left.
- Performs text shaping.
- Parameters
-
unicodeText | Text to shape and mirror. |
- Returns
- Layouting information per character.
Reimplemented in kanzi::ItypeTextShaper, and kanzi::FreeTypeTextShaper.
Updates the internal shaper structures to accommodate a terminator string, which replaces a part of the original text.
- Parameters
-
newSize | Size of text including terminator. |
terminator | Pointer to intermediate layout containing terminator. |
terminatorPosition | The position in the text buffer at which the terminator would be appended. This is needed for RTL text. For LTR text, the terminator position is always at the right-end of the text. |
Reimplemented in kanzi::ItypeTextShaper.
Updates the internal shaper structures to accommodate another string, which Kanzi inserts in the original text.
For example, a hyphen.
- Parameters
-
location | Position where the string is inserted. |
text | Pointer to intermediate layout containing the text. |
Reimplemented in kanzi::ItypeTextShaper.
virtual void kanzi::TextShaper::removeText |
( |
unsigned int |
location, |
|
|
unsigned int |
length |
|
) |
| |
|
virtual |
When Kanzi truncates a part of text, updates the internal shaper structures in accordance with the changes to the shaped text during the text layout.
- Parameters
-
location | Position at which the text is removed. |
length | Length of the removed text. |
- Since
- Kanzi 3.9.6
Reimplemented in kanzi::ItypeTextShaper.
Prepares the internal data structures after line breaking.
- Parameters
-
layout | Pointer to intermediate layout containing the text. |
Reimplemented in kanzi::FreeTypeTextShaper.
Reorders the text line for the text written right-to-left.
- Parameters
-
layout | Pointer to intermediate layout containing the text. |
line | Information defining the currently processed line. |
Reimplemented in kanzi::ItypeTextShaper, and kanzi::FreeTypeTextShaper.
This phase iterates through all layouted glyphs on the line and adjusts the positions based on shaping results.
- Parameters
-
layout | Pointer to intermediate layout containing the text. |
line | Information defining the currently processed line. |
Reimplemented in kanzi::ItypeTextShaper.
virtual void kanzi::TextShaper::cleanup |
( |
| ) |
|
|
virtual |
void kanzi::TextShaper::setBaseBiDiLevel |
( |
uint8_t |
baseBiDiLevel | ) |
|
Sets the base bidi-level of the text.
The base bidi-level is derived from the first character of strong bidirectional character type, in the provided text. For LTR or direction-neutral text set an even bidi-level, whereas for RTL text set an odd bidi-level.
- Since
- Kanzi 3.9.0
uint8_t kanzi::TextShaper::getBaseBiDiLevel |
( |
| ) |
const |
Gets the base bidi-level of the text.
An even bidi-level represents LTR text direction, whereas an odd bidi-level represents RTL text direction.
- Since
- Kanzi 3.9.0
Gets the font file that the passed font is currently using.
- Parameters
-
font | Font for which you want to get the font file that the font is currently using. |
- Returns
- Font file that the passed font is currently using.
Font object used for shaping.
uint8_t kanzi::TextShaper::m_baseBiDiLevel |
|
protected |
The documentation for this class was generated from the following file: