mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibGUI: Use Font::glyph_or_emoji_width() in TextEditor
This fixes selection of text containing emoji when variable-width font is set.
This commit is contained in:
parent
8542d1da5a
commit
b6d6cc5de4
1 changed files with 1 additions and 1 deletions
|
@ -170,7 +170,7 @@ TextPosition TextEditor::text_position_at_content_position(Gfx::IntPoint const&
|
|||
int glyph_x = 0;
|
||||
size_t i = 0;
|
||||
for (; i < view.length(); ++i) {
|
||||
int advance = font().glyph_width(view.code_points()[i]) + font().glyph_spacing();
|
||||
int advance = font().glyph_or_emoji_width(view.code_points()[i]) + font().glyph_spacing();
|
||||
if ((glyph_x + (advance / 2)) >= position.x())
|
||||
break;
|
||||
glyph_x += advance;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue