diff options
| author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-11-30 11:48:42 +0200 |
|---|---|---|
| committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-12-06 20:30:59 +0200 |
| commit | a458e901791818babe198c0177e0a2e851f821c1 (patch) | |
| tree | e061646c16eadcc5c87a050698b4b33f660b709c /scene/gui/line_edit.cpp | |
| parent | d834789f475d431b10dcaef8804cd75dcd8b47dd (diff) | |
| download | redot-engine-a458e901791818babe198c0177e0a2e851f821c1.tar.gz | |
[Complex Text Layouts] Adds missing Font::SPACING_* to the Label, LineEdit, TextEdit, TextLine and TextParagraph.
Fixes oversized editor control height (default editor spacing is negative) and control size changing when text is set.
Diffstat (limited to 'scene/gui/line_edit.cpp')
| -rw-r--r-- | scene/gui/line_edit.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 2eaa814419..9cf7c105ef 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -732,6 +732,7 @@ void LineEdit::_notification(int p_what) { style = get_theme_stylebox("read_only"); draw_caret = false; } + Ref<Font> font = get_theme_font("font"); style->draw(ci, Rect2(Point2(), size)); @@ -742,7 +743,7 @@ void LineEdit::_notification(int p_what) { int x_ofs = 0; bool using_placeholder = text.empty() && ime_text.empty(); float text_width = TS->shaped_text_get_size(text_rid).x; - float text_height = TS->shaped_text_get_size(text_rid).y; + float text_height = TS->shaped_text_get_size(text_rid).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM); switch (align) { case ALIGN_FILL: @@ -1570,7 +1571,7 @@ Size2 LineEdit::get_minimum_size() const { min_size.width = MAX(min_size.width, full_width + space_size); } - min_size.height = MAX(TS->shaped_text_get_size(text_rid).y, font->get_height(font_size)); + min_size.height = MAX(TS->shaped_text_get_size(text_rid).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM), font->get_height(font_size)); // Take icons into account. bool using_placeholder = text.empty() && ime_text.empty(); |
