|
HikoGUI
A low latency retained GUI
|
#include <TTauri/Text/ShapedText.hpp>
Public Types | |
| using | iterator |
| using | const_iterator |
Public Member Functions | |
| ShapedText (ShapedText const &other)=default | |
| ShapedText (ShapedText &&other) noexcept=default | |
| ShapedText & | operator= (ShapedText const &other)=default |
| ShapedText & | operator= (ShapedText &&other) noexcept=default |
| ShapedText (std::vector< AttributedGrapheme > const &text, float width, Alignment const alignment=Alignment::MiddleCenter, bool wrap=true) noexcept | |
| Create shaped text from attributed text. | |
| ShapedText (gstring const &text, TextStyle const &style, float width, Alignment const alignment=Alignment::MiddleCenter, bool wrap=true) noexcept | |
| Create shaped text from a string. | |
| ShapedText (std::string_view text, TextStyle const &style, float width, Alignment const alignment=Alignment::MiddleCenter, bool wrap=true) noexcept | |
| Create shaped text from a string. | |
| size_t | size () const noexcept |
| iterator | begin () noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | cbegin () const noexcept |
| iterator | end () noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cend () const noexcept |
| float | topAccender () const noexcept |
| float | bottomDescender () const noexcept |
| float | topCapHeight () const noexcept |
| float | bottomCapHeight () const noexcept |
| float | middleCapHeight () const noexcept |
| Get the capHeight of the middle line(s). | |
| float | baselineOffset (float height) noexcept |
| Get the offset of the baseline The offset of the baseline when the text needs to be rendered inside a box of the given height. | |
| float | middleOffset (float height) const noexcept |
| Get the offset of the middle of a line. | |
| mat::T2 | T (aarect rectangle) noexcept |
| Get the translation for where to place the text. | |
| mat::T2 | TMiddle (vec position) noexcept |
| Get the translation for where to place the text. | |
| const_iterator | find (ssize_t position) const noexcept |
| Find a glyph that corresponds to position. | |
| aarect | rectangleOfGrapheme (ssize_t index) const noexcept |
| Get a rectangle for the grapheme. | |
| aarect | leftToRightCaret (ssize_t index, bool overwrite) const noexcept |
| Return the cursor-carets. | |
| std::vector< aarect > | selectionRectangles (ssize_t first, ssize_t last) const noexcept |
| Return a list of merged rectangles to display for the selection. | |
| std::optional< ssize_t > | indexOfCharAtCoordinate (vec coordinate) const noexcept |
| Return the index of the character . | |
| std::optional< ssize_t > | indexOfCharOnTheLeft (ssize_t logicalIndex) const noexcept |
| Return the index of the character to the left. | |
| std::optional< ssize_t > | indexOfCharOnTheRight (ssize_t logicalIndex) const noexcept |
| Return the index of the character to the right. | |
| std::pair< ssize_t, ssize_t > | indicesOfWord (ssize_t logicalIndex) const noexcept |
| Return the index at the left side and right side of a word. | |
| std::pair< ssize_t, ssize_t > | indicesOfParagraph (ssize_t logicalIndex) const noexcept |
| Return the index at the left side and right side of a paragraph. | |
| ssize_t | indexAtRightSideOfWord (ssize_t logicalIndex) const noexcept |
| Return the index at the left side of a word. | |
| std::optional< ssize_t > | indexOfWordOnTheLeft (ssize_t logicalIndex) const noexcept |
| Return the index of the word to the left. | |
| std::optional< ssize_t > | indexOfWordOnTheRight (ssize_t logicalIndex) const noexcept |
| Return the index of the word to the right. | |
| Path | get_path () const noexcept |
| Convert the whole shaped text into a layered path. | |
| int | indexFromCoordinate (vec coordinate) const noexcept |
| Get the index into the text from a coordinate. | |
| std::vector< int > | indicesFromCoordinates (vec start, vec current) const noexcept |
| Get the index into the text from a coordinate. | |
Data Fields | |
| Alignment | alignment |
| aarect | boundingBox |
| float | width |
| vec | preferredExtent |
ShapedText represent a piece of text shaped to be displayed.
| using tt::ShapedText::iterator |
|
noexcept |
Create shaped text from attributed text.
This function is used to draw rich-text. Each grapheme comes with its own text-style.
Vertical alignment is based on base line at y=0.0:
Horizontal alignment is based on the given width:
| text | The text to draw. |
| alignment | The alignment of the text within the extent. |
| width | The width into which the text is horizontally aligned. |
| wrap | True when text should be wrapped to fit inside the given width. |
|
noexcept |
Create shaped text from a string.
This function is mostly used for drawing label text.
| text | The text to draw. |
| style | The text style. |
| extent | The size of the box to draw in. |
| alignment | The alignment of the text within the extent. |
| wrap | When fitting the text in the extent wrap lines when needed. |
|
noexcept |
Create shaped text from a string.
This function is mostly used for drawing label text.
| text | The text to draw. |
| style | The text style. |
| extent | The size of the box to draw in. |
| alignment | The alignment of the text within the extent. |
| wrap | When fitting the text in the extent wrap lines when needed. |
|
inlinenoexcept |
Get the offset of the baseline The offset of the baseline when the text needs to be rendered inside a box of the given height.
The offset is depended on the vertical alignment of the shaped text.
|
noexcept |
Find a glyph that corresponds to position.
|
noexcept |
Convert the whole shaped text into a layered path.
Return the index at the left side of a word.
|
noexcept |
Get the index into the text from a coordinate.
The index returned is from the text that was used to construct the ShapedText.
| coordinate | A coordinate within the box. |
Return the index of the character .
| logicalIndex | The character at logicalIndex. |
|
noexcept |
Return the index of the character to the left.
| logicalIndex | The character at logicalIndex. |
|
noexcept |
Return the index of the character to the right.
| logicalIndex | The character at logicalIndex. |
|
noexcept |
Return the index of the word to the left.
| logicalIndex | The character at logicalIndex. |
|
noexcept |
Return the index of the word to the right.
| logicalIndex | The character at logicalIndex. |
|
noexcept |
Get the index into the text from a coordinate.
The index returned is from the text that was used to construct the ShapedText.
| start | The coordinate at the start of a mouse drag. |
| current | The current coordinate of the mouse pointer, during the drag. |
|
noexcept |
Return the index at the left side and right side of a paragraph.
Return the index at the left side and right side of a word.
Return the cursor-carets.
The caret will be to the left of the character at position.
| index | Logical grapheme index. |
| overwrite | When true display a overwrite cursor. |
|
inlinenoexcept |
Get the capHeight of the middle line(s).
|
inlinenoexcept |
Get the offset of the middle of a line.
The offset of the baseline when the middle of a line needs to be at a specific height. The offset is depended on the vertical alignment of the shaped text.
Get a rectangle for the grapheme.
The rectangle describes the edges of the grapheme:
| index |
|
noexcept |
Return a list of merged rectangles to display for the selection.
The selection may be discontinues due to bidirectional text.
| first | The first logical grapheme that is selected. |
| last | One beyond the last logical grapheme that is selected. |
Get the translation for where to place the text.
| rectangle | The rectangle where the text should be aligned into. The width is ignored and assumed to be the same as the width passed during text shaping. |
Get the translation for where to place the text.
| position | x is the left position, y is where the middle of the line should be. |