1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:18:11 +00:00

LibGUI: Support variable-width fonts in TextEditor

This patch reworks metric and coordinate computation to iterate over
text content instead of making assumptions about fixed glyph widths.
This commit is contained in:
Andreas Kling 2020-05-18 16:38:28 +02:00
parent 7207276697
commit 2e11c16be4
2 changed files with 47 additions and 32 deletions

View file

@ -85,8 +85,6 @@ public:
int line_height() const;
TextPosition cursor() const { return m_cursor; }
TextRange normalized_selection() const { return m_selection.normalized(); }
// FIXME: This should take glyph spacing into account, no?
int glyph_width() const;
void insert_at_cursor_or_replace_selection(const StringView&);
bool write_to_file(const StringView& path);
@ -172,6 +170,7 @@ private:
void paint_ruler(Painter&);
void update_content_size();
void did_change();
int fixed_glyph_width() const;
Gfx::Rect line_content_rect(size_t item_index) const;
Gfx::Rect line_widget_rect(size_t line_index) const;