summaryrefslogtreecommitdiff
path: root/scene/gui/label.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/label.cpp')
-rw-r--r--scene/gui/label.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index e8097c79a4..2d4438c48c 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -87,11 +87,14 @@ void Label::_notification(int p_what) {
Color font_color_shadow = get_color("font_color_shadow");
bool use_outlinde = get_constant("shadow_as_outline");
Point2 shadow_ofs(get_constant("shadow_offset_x"),get_constant("shadow_offset_y"));
+ int line_spacing = get_constant("line_spacing");
VisualServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(),font.is_valid() && font->is_distance_field_hint());
- int font_h = font->get_height();
- int lines_visible = size.y/font_h;
+ int font_h = font->get_height()+line_spacing;
+
+ int lines_visible = (size.y+line_spacing)/font_h;
+
int space_w=font->get_char_size(' ').width;
int chars_total=0;
@@ -372,6 +375,7 @@ void Label::regenerate_word_cache() {
int line_width=0;
int space_count=0;
int space_width=font->get_char_size(' ').width;
+ int line_spacing = get_constant("line_spacing");
line_count=1;
total_char_cache=0;
@@ -486,9 +490,9 @@ void Label::regenerate_word_cache() {
if (!autowrap) {
minsize.width=width;
if (max_lines_visible > 0 && line_count > max_lines_visible) {
- minsize.height=font->get_height()*max_lines_visible;
+ minsize.height=(font->get_height() * max_lines_visible) + (line_spacing * (max_lines_visible - 1));
} else {
- minsize.height=font->get_height()*line_count;
+ minsize.height=(font->get_height() * line_count)+(line_spacing * (line_count - 1));
}
}