Wed, 10 Apr 2024 19:43:34 +0200
implement centered wrapped text
src/text.c | file | annotate | diff | comparison | revisions |
--- 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());