From da25f121ac8cfda351cade27380a9a96b774debc Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 19 Nov 2009 22:49:04 +0000 Subject: (svn r18195) -Codechange: move the child padding calculation/handling to WWT_FRAME -Fix (r18168): crash when switching languages when a non-standard font height is used --- src/widget.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/widget.cpp') diff --git a/src/widget.cpp b/src/widget.cpp index 82fecbfea..fe13d0bd5 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1461,16 +1461,16 @@ void NWidgetBackground::SetupSmallestSize(Window *w, bool init_array) /* Account for the size of the frame's text if that exists */ if (w != NULL && this->type == WWT_FRAME) { + this->child->padding_left = WD_FRAMETEXT_LEFT; + this->child->padding_right = WD_FRAMETEXT_RIGHT; + this->child->padding_top = max((int)WD_FRAMETEXT_TOP, this->widget_data != STR_NULL ? FONT_HEIGHT_NORMAL + WD_FRAMETEXT_TOP / 2 : 0); + this->child->padding_bottom = WD_FRAMETEXT_BOTTOM; + + this->smallest_x += this->child->padding_left + this->child->padding_right; + this->smallest_y += this->child->padding_top + this->child->padding_bottom; + if (this->index >= 0) w->SetStringParameters(this->index); this->smallest_x = max(this->smallest_x, GetStringBoundingBox(this->widget_data).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); - if (this->widget_data != STR_NULL) { - /* Adjust child's padding to fit text. We assume that the - * original padding is designed around the 10 pixel high - * sprite font. */ - int y = FONT_HEIGHT_NORMAL - 10; - this->child->padding_top += y; - this->smallest_y += y; - } } } else { Dimension d = {this->min_x, this->min_y}; -- cgit v1.2.3-54-g00ecf