# HG changeset patch # User Mike Becker # Date 1712771014 -7200 # Node ID 7daec2f067a91b7b4c00be5ec860c6275e9da269 # Parent 428fbb8355eb2697abaace2bf2ee31f5e8749f5f implement centered wrapped text diff -r 428fbb8355eb -r 7daec2f067a9 src/text.c --- a/src/text.c Wed Apr 10 19:35:14 2024 +0200 +++ b/src/text.c Wed Apr 10 19:43:34 2024 +0200 @@ -57,11 +57,13 @@ } // Render text onto a surface + TTF_Font *font = asc_font_cache_validate(node->font)->ptr; + TTF_SetFontWrappedAlign( + font, node->centered ? + TTF_WRAPPED_ALIGN_CENTER : TTF_WRAPPED_ALIGN_LEFT + ); SDL_Surface *surface = TTF_RenderUTF8_Blended_Wrapped( - asc_font_cache_validate(node->font)->ptr, - node->text, - asc_col_sdl(node->color), - node->max_width + font, node->text, asc_col_sdl(node->color), node->max_width ); if (surface == NULL) { asc_error(SDL_GetError());