|
HikoGUI
A low latency retained GUI
|
#include <ttauri/text/shaped_text.hpp>
Public Types | |
| using | iterator = recursive_iterator<std::vector<attributed_glyph_line>::iterator> |
| using | const_iterator = recursive_iterator<std::vector<attributed_glyph_line>::const_iterator> |
Public Member Functions | |
| shaped_text (shaped_text const &other)=default | |
| shaped_text (shaped_text &&other) noexcept=default | |
| shaped_text & | operator= (shaped_text const &other)=default |
| shaped_text & | operator= (shaped_text &&other) noexcept=default |
| shaped_text (std::vector< attributed_grapheme > const &text, float width, tt::alignment const alignment=alignment::middle_center, bool wrap=true) noexcept | |
| Create shaped text from attributed text. | |
| shaped_text (gstring const &text, text_style const &style, float width, tt::alignment const alignment=alignment::middle_center, bool wrap=true) noexcept | |
| Create shaped text from a string. | |
| shaped_text (std::u8string_view text, text_style const &style, float width, tt::alignment const alignment=alignment::middle_center, 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. | |
| translate2 | translate_base_line (point2 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. | |
| aarectangle | rectangleOfgrapheme (ssize_t index) const noexcept |
| Get a rectangle for the grapheme. | |
| aarectangle | leftToRightCaret (ssize_t index, bool overwrite) const noexcept |
| Return the cursor-carets. | |
| std::vector< aarectangle > | 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 (point2 coordinate) const noexcept |
| Get the character close to a coordinate. | |
| std::optional< ssize_t > | indexOfCharOnTheLeft (ssize_t logical_index) const noexcept |
| Get the character left of the given character. | |
| std::optional< ssize_t > | indexOfCharOnTheRight (ssize_t logical_index) const noexcept |
| Get the character right of the given character. | |
| std::pair< ssize_t, ssize_t > | indicesOfWord (ssize_t logical_index) const noexcept |
| Get the word with the given character. | |
| std::pair< ssize_t, ssize_t > | indicesOfParagraph (ssize_t logical_index) const noexcept |
| Get the character right of the given character. | |
| ssize_t | indexAtRightSideOfWord (ssize_t logical_index) const noexcept |
| Get the character right of the given character. | |
| std::optional< ssize_t > | indexOfWordOnTheLeft (ssize_t logical_index) const noexcept |
| Get the first character of the word on the left. | |
| std::optional< ssize_t > | indexOfWordOnTheRight (ssize_t logical_index) const noexcept |
| Get the last character of the word on the right. | |
| graphic_path | get_path () const noexcept |
| Convert the whole shaped text into a layered path. | |
| int | indexFromCoordinate (point2 coordinate) const noexcept |
| Get the index into the text from a coordinate. | |
| std::vector< int > | indicesFromCoordinates (point2 start, point2 current) const noexcept |
| Get the index into the text from a coordinate. | |
Data Fields | |
| alignment | alignment |
| aarectangle | boundingBox |
| float | width |
| extent2 | preferred_extent |
shaped_text represent a piece of text shaped to be displayed.
|
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. |
| width | The width into which the text is horizontally aligned. |
| alignment | The alignment of the text within the extent. |
| 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. |
| width | The maximum a width of the text. |
| 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. |
| width | The maximum width of the text. |
| 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.
Get the character right of the given character.
| logical_index | The index of the logical character pointed to. |
|
noexcept |
Get the index into the text from a coordinate.
The index returned is from the text that was used to construct the shaped_text.
| coordinate | A coordinate within the box. |
|
noexcept |
Get the character close to a coordinate.
| coordinate | The coordinate of the mouse pointer. |
|
noexcept |
Get the character left of the given character.
| logical_index | The index of the logical character pointed to. |
|
noexcept |
Get the character right of the given character.
| logical_index | The index of the logical character pointed to. |
|
noexcept |
Get the first character of the word on the left.
| logical_index | The index of the logical character pointed to. |
|
noexcept |
Get the last character of the word on the right.
| logical_index | The index of the logical character pointed to. |
|
noexcept |
Get the index into the text from a coordinate.
The index returned is from the text that was used to construct the shaped_text.
| start | The coordinate at the start of a mouse drag. |
| current | The current coordinate of the mouse pointer, during the drag. |
|
noexcept |
Get the character right of the given character.
| logical_index | The index of the logical character pointed to. |
|
noexcept |
Get the word with the given character.
| logical_index | The index of the logical character pointed to. |
|
noexcept |
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.
|
noexcept |
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. |
|
inlinenoexcept |
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. |