|
constexpr | text_shaper (text_shaper const &) noexcept=default |
|
constexpr | text_shaper (text_shaper &&) noexcept=default |
|
constexpr text_shaper & | operator= (text_shaper const &) noexcept=default |
|
constexpr text_shaper & | operator= (text_shaper &&) noexcept=default |
|
| text_shaper (gstring const &text, text_style const &style, hi::pixel_density pixel_density, hi::alignment alignment, bool left_to_right, iso_15924 script=iso_15924{"Zyyy"}) noexcept |
| Construct a text_shaper with a text and alignment.
|
|
| text_shaper (std::string_view text, text_style const &style, hi::pixel_density pixel_density, hi::alignment alignment, bool left_to_right, iso_15924 script=iso_15924{"Zyyy"}) noexcept |
|
bool | empty () const noexcept |
|
size_t | size () const noexcept |
|
char_iterator | begin () noexcept |
|
char_const_iterator | begin () const noexcept |
|
char_const_iterator | cbegin () const noexcept |
|
char_iterator | end () noexcept |
|
char_const_iterator | end () const noexcept |
|
char_const_iterator | cend () const noexcept |
|
auto const & | lines () const noexcept |
|
aarectangle | bounding_rectangle (float maximum_line_width, float line_spacing=1.0f, float paragraph_spacing=1.5f) noexcept |
| Get bounding rectangle.
|
|
void | layout (aarectangle rectangle, float baseline, extent2 sub_pixel_size, float line_spacing=1.0f, float paragraph_spacing=1.5f) noexcept |
| Layout the lines of the text.
|
|
aarectangle | rectangle () const noexcept |
| The rectangle used when laying out the text.
|
|
unicode_bidi_class | text_direction () const noexcept |
| Get the text-direction as a whole.
|
|
alignment | resolved_alignment () const noexcept |
| Get the resolved alignment of the text.
|
|
char_const_iterator | get_it (size_t index) const noexcept |
| Get the character at index in logical order.
|
|
char_const_iterator | get_it (text_cursor cursor) const noexcept |
| Get the character at the cursor.
|
|
char_const_iterator | get_it (size_t column_nr, size_t line_nr) const noexcept |
| Get the character at column and row in display order.
|
|
char_const_iterator | get_it (std::pair< size_t, size_t > column_row) const noexcept |
| Get the character at column and row in display order.
|
|
std::pair< size_t, size_t > | get_column_line (text_shaper::char_const_iterator it) const noexcept |
| Get the column and line of a character.
|
|
std::pair< size_t, size_t > | get_column_line (size_t index) const noexcept |
| Get the column and line of a character.
|
|
std::pair< size_t, size_t > | get_column_line (text_cursor cursor) const noexcept |
| Get the column and line of a character.
|
|
size_t | get_index (text_shaper::char_const_iterator it) const noexcept |
| Get the index of the character in logical order.
|
|
text_cursor | get_begin_cursor () const noexcept |
| Get the cursor at the beginning of the document.
|
|
text_cursor | get_end_cursor () const noexcept |
| Get the cursor at the end of the document.
|
|
text_cursor | get_before_cursor (size_t index) const noexcept |
| Get the cursor before the character in logical order.
|
|
text_cursor | get_after_cursor (size_t index) const noexcept |
| Get the cursor after the character in logical order.
|
|
text_cursor | get_before_cursor (text_shaper::char_const_iterator it) const noexcept |
| Get the cursor before the character in logical order.
|
|
text_cursor | get_after_cursor (text_shaper::char_const_iterator it) const noexcept |
| Get the cursor after the character in logical order.
|
|
text_cursor | get_left_cursor (text_shaper::char_const_iterator it) const noexcept |
| Get the cursor left of the character in display order.
|
|
text_cursor | get_right_cursor (text_shaper::char_const_iterator it) const noexcept |
| Get the cursor right of the character in display order.
|
|
bool | is_on_left (text_cursor cursor) const noexcept |
| Check if the cursor is on the left side of the character in display order.
|
|
bool | is_on_right (text_cursor cursor) const noexcept |
| Check if the cursor is on the right side of the character in display order.
|
|
text_cursor | get_nearest_cursor (point2 position) const noexcept |
| find the nearest character.
|
|
std::pair< text_cursor, text_cursor > | select_char (text_cursor cursor) const noexcept |
| Get the selection for the character at the cursor.
|
|
std::pair< text_cursor, text_cursor > | select_word (text_cursor cursor) const noexcept |
| Get the selection for the word at the cursor.
|
|
std::pair< text_cursor, text_cursor > | select_sentence (text_cursor cursor) const noexcept |
| Get the selection for the sentence at the cursor.
|
|
std::pair< text_cursor, text_cursor > | select_paragraph (text_cursor cursor) const noexcept |
| Get the selection for a paragraph at the cursor.
|
|
std::pair< text_cursor, text_cursor > | select_document (text_cursor cursor) const noexcept |
| Get the selection for a paragraph at the cursor.
|
|
char_const_iterator | move_left_char (char_const_iterator it) const noexcept |
| Get the character to the left.
|
|
char_const_iterator | move_right_char (char_const_iterator it) const noexcept |
| Get the character to the right.
|
|
text_cursor | move_left_char (text_cursor cursor, bool overwrite_mode) const noexcept |
|
text_cursor | move_right_char (text_cursor cursor, bool overwrite_mode) const noexcept |
|
text_cursor | move_down_char (text_cursor cursor, float &x) const noexcept |
|
text_cursor | move_up_char (text_cursor cursor, float &x) const noexcept |
|
text_cursor | move_left_word (text_cursor cursor, bool overwrite_mode) const noexcept |
|
text_cursor | move_right_word (text_cursor cursor, bool overwrite_mode) const noexcept |
|
text_cursor | move_begin_line (text_cursor cursor) const noexcept |
|
text_cursor | move_end_line (text_cursor cursor) const noexcept |
|
text_cursor | move_begin_sentence (text_cursor cursor) const noexcept |
|
text_cursor | move_end_sentence (text_cursor cursor) const noexcept |
|
text_cursor | move_begin_paragraph (text_cursor cursor) const noexcept |
|
text_cursor | move_end_paragraph (text_cursor cursor) const noexcept |
|
text_cursor | move_begin_document (text_cursor cursor) const noexcept |
|
text_cursor | move_end_document (text_cursor cursor) const noexcept |
|
Text shaper.
This class takes text as a set of graphemes attributed with font, size, style and color.
Steps:
- Load default glyphs and metrics scaled to the font-size of each glyph.
- Fold default glyphs to a certain width by inserting line-separators.
- Run unicode bidirectional algorithm.
- Reload glyphs and metrics of any brackets.
- Morph glyphs.
- Position glyphs including kerning and justification.