From: Holger Schemel Date: Mon, 30 Dec 2024 18:08:14 +0000 (+0100) Subject: fixed multi-line request text overlapping with request buttons X-Git-Tag: 4.4.0.1~70 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=a6a54e325c7abbd3869c72ec0d3b3b73b5e6b731;p=rocksndiamonds.git fixed multi-line request text overlapping with request buttons --- diff --git a/src/tools.c b/src/tools.c index 7af966c9..51f3e11b 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3229,6 +3229,21 @@ static void DrawEnvelopeRequestText(int sx, int sy, char *text) text_final = text_door_style; } + else if (strlen(text_final) * font_width > max_text_width) + { + // prevent multi-line request text overlapping with request buttons + max_text_height = menu.request.button.confirm.y - sy_offset; + + struct WrappedTextInfo *wrapped_text = + GetWrappedTextBuffer(text_final, font_nr, -1, -1, -1, + max_text_width, -1, max_text_height, line_spacing, mask_mode, + menu.request.autowrap, menu.request.centered, FALSE); + + if (wrapped_text != NULL && wrapped_text->total_height > wrapped_text->max_height) + use_narrow_font = TRUE; + + FreeWrappedText(wrapped_text); + } if (use_narrow_font) {