From c448eb04d8275ce8ec6713e348545e4a9686aabb Mon Sep 17 00:00:00 2001 From: PeterN Date: Thu, 15 Dec 2022 23:21:10 +0000 Subject: [PATCH] Fix #10242: Allow a space for text shadow when clipping WWT_EMPTY/WWT_TEXT. (#10243) --- src/widget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index 9c9868988c..da85271fd6 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -2839,9 +2839,10 @@ void NWidgetLeaf::Draw(const Window *w) { if (this->current_x == 0 || this->current_y == 0) return; - /* Setup a clipping rectangle... */ + /* Setup a clipping rectangle... for WWT_EMPTY or WWT_TEXT, an extra scaled pixel is allowed vertically in case text shadow encroaches. */ + int extra_y = (this->type == WWT_EMPTY || this->type == WWT_TEXT) ? ScaleGUITrad(1) : 0; DrawPixelInfo new_dpi; - if (!FillDrawPixelInfo(&new_dpi, this->pos_x, this->pos_y, this->current_x, this->current_y)) return; + if (!FillDrawPixelInfo(&new_dpi, this->pos_x, this->pos_y, this->current_x, this->current_y + extra_y)) return; /* ...but keep coordinates relative to the window. */ new_dpi.left += this->pos_x; new_dpi.top += this->pos_y;