Skip to content

Commit

Permalink
Merge pull request #71747 from Koyper/rich_text_label_dropcap_selecti…
Browse files Browse the repository at this point in the history
…on_bug

Fixed RichTextLabel wrong selection offset after drop cap
  • Loading branch information
YuriSizov authored Apr 11, 2023
2 parents 6a65597 + 99376ee commit ca808c8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scene/gui/rich_text_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,16 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
}
} break;
}

// Adjust for dropcap.
int dc_lines = l.text_buf->get_dropcap_lines();
float h_off = l.text_buf->get_dropcap_size().x;
if (line <= dc_lines) {
if (rtl) {
off.x -= h_off;
} else {
off.x += h_off;
}
}
off.y += TS->shaped_text_get_ascent(rid);

Array objects = TS->shaped_text_get_objects(rid);
Expand Down

0 comments on commit ca808c8

Please sign in to comment.