From: Holger Schemel Date: Tue, 5 Dec 2023 17:14:33 +0000 (+0100) Subject: added fallback to narrow font on word length for envelope request dialogs X-Git-Tag: 4.3.8.0~11 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=a42320dc0f3af61bee63a8d81508e6ff5b44c41b added fallback to narrow font on word length for envelope request dialogs --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 891e1500..7b9d243e 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -6858,6 +6858,8 @@ struct ConfigInfo image_config[] = { "font.request.y", "210" }, { "font.request.width", "14" }, { "font.request.height", "14" }, + { "font.request_narrow", UNDEFINED_FILENAME }, + { "font.request_narrow.clone_from", "font.text_1.DOOR" }, { "font.input_1", "RocksFontSmall.png" }, { "font.input_1.x", "0" }, diff --git a/src/main.c b/src/main.c index bb8e1f0d..a1ba5c7c 100644 --- a/src/main.c +++ b/src/main.c @@ -7644,6 +7644,7 @@ struct FontInfo font_info[NUM_FONTS + 1] = { "font.envelope_2" }, { "font.envelope_3" }, { "font.envelope_4" }, + { "font.request_narrow" }, { "font.request" }, { "font.input_1.active" }, { "font.input_2.active" }, diff --git a/src/main.h b/src/main.h index 228ca5a6..08cb1e5c 100644 --- a/src/main.h +++ b/src/main.h @@ -2553,6 +2553,7 @@ enum FONT_ENVELOPE_2, FONT_ENVELOPE_3, FONT_ENVELOPE_4, + FONT_REQUEST_NARROW, FONT_REQUEST, FONT_INPUT_1_ACTIVE, FONT_INPUT_2_ACTIVE, diff --git a/src/tools.c b/src/tools.c index e56516a0..a3aa3c34 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3176,6 +3176,13 @@ static void DrawEnvelopeRequestText(int sx, int sy, char *text) { char *src_text_ptr, *dst_text_ptr; + if (maxWordLengthInRequestString(text) > line_length) + { + font_nr = FONT_REQUEST_NARROW; + font_width = getFontWidth(font_nr); + line_length = max_text_width / font_width; + } + text_door_style = checked_malloc(2 * strlen(text) + 1); src_text_ptr = text;