mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-19 16:59:47 +00:00
LibWeb: Layout text chunks based on their Unicode direction
Append text chunks to either the start or end of the text fragment, depending on the text direction. The direction is determined by what script its code points are from.
This commit is contained in:
parent
2f5b070716
commit
11e7d72686
Notes:
github-actions[bot]
2024-08-31 09:50:41 +00:00
Author: https://github.com/BenJilks
Commit: 11e7d72686
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1133
Reviewed-by: https://github.com/diegoiast
18 changed files with 460 additions and 150 deletions
|
@ -33,21 +33,26 @@ public:
|
|||
size_t length { 0 };
|
||||
bool has_breaking_newline { false };
|
||||
bool is_all_whitespace { false };
|
||||
Gfx::GlyphRun::TextType text_type;
|
||||
};
|
||||
|
||||
class ChunkIterator {
|
||||
public:
|
||||
ChunkIterator(StringView text, bool wrap_lines, bool respect_linebreaks, Gfx::FontCascadeList const&);
|
||||
Optional<Chunk> next();
|
||||
Optional<Chunk> peek(size_t);
|
||||
|
||||
private:
|
||||
Optional<Chunk> try_commit_chunk(Utf8View::Iterator const& start, Utf8View::Iterator const& end, bool has_breaking_newline, Gfx::Font const&) const;
|
||||
Optional<Chunk> next_without_peek();
|
||||
Optional<Chunk> try_commit_chunk(Utf8View::Iterator const& start, Utf8View::Iterator const& end, bool has_breaking_newline, Gfx::Font const&, Gfx::GlyphRun::TextType) const;
|
||||
|
||||
bool const m_wrap_lines;
|
||||
bool const m_respect_linebreaks;
|
||||
Utf8View m_utf8_view;
|
||||
Utf8View::Iterator m_iterator;
|
||||
Gfx::FontCascadeList const& m_font_cascade_list;
|
||||
|
||||
Vector<Chunk> m_peek_queue;
|
||||
};
|
||||
|
||||
void invalidate_text_for_rendering();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue