mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 09:36:08 +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
Notes:
sideshowbarker
2024-07-17 20:29:45 +09:00
Author: https://github.com/sppmacd
Commit: b6d6cc5de4
Pull-request: https://github.com/SerenityOS/serenity/pull/12054
Issue: https://github.com/SerenityOS/serenity/issues/12001
Reviewed-by: https://github.com/linusg
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