From: Holger Schemel Date: Mon, 14 Oct 2024 21:17:53 +0000 (+0200) Subject: added total height of all lines to wrapped text structure X-Git-Tag: 4.4.0.0-test-4~132 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2f3bc0c1a60e87ea90b5e63266b41e0bdf30f68f;p=rocksndiamonds.git added total height of all lines to wrapped text structure --- diff --git a/src/libgame/text.c b/src/libgame/text.c index 8cc7e1c2..88a9c248 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -529,6 +529,8 @@ static void AddLineToWrappedText(struct WrappedTextInfo *wrapped_text, wrapped_text->line[wrapped_text->num_lines].text = getStringCopy(buffer); wrapped_text->line[wrapped_text->num_lines].font_nr = font_nr; wrapped_text->line[wrapped_text->num_lines].centered = centered; + + wrapped_text->total_height += getFontHeight(font_nr) + wrapped_text->line_spacing; wrapped_text->num_lines++; } @@ -598,6 +600,7 @@ static struct WrappedTextInfo *GetWrappedText(char *text_buffer, int base_font_n wrapped_text->max_height = max_height; wrapped_text->line_spacing = line_spacing; wrapped_text->mask_mode = mask_mode; + wrapped_text->total_height = 0; wrapped_text->num_lines = 0; buffer[0] = '\0'; diff --git a/src/libgame/text.h b/src/libgame/text.h index 97613f48..06b2a439 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -105,6 +105,9 @@ struct WrappedTextInfo // number of wrapped lines int num_lines; + // total height of all lines + int total_height; + // internal info for processing lines int line_width, cut_length, max_height; int line_spacing, mask_mode;