implement centered wrapped text

Wed, 10 Apr 2024 19:43:34 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 10 Apr 2024 19:43:34 +0200
changeset 57
7daec2f067a9
parent 56
428fbb8355eb
child 58
26ebb2f1e6e6

implement centered wrapped text

src/text.c file | annotate | diff | comparison | revisions
     1.1 --- a/src/text.c	Wed Apr 10 19:35:14 2024 +0200
     1.2 +++ b/src/text.c	Wed Apr 10 19:43:34 2024 +0200
     1.3 @@ -57,11 +57,13 @@
     1.4      }
     1.5  
     1.6      // Render text onto a surface
     1.7 +    TTF_Font *font = asc_font_cache_validate(node->font)->ptr;
     1.8 +    TTF_SetFontWrappedAlign(
     1.9 +            font, node->centered ?
    1.10 +                  TTF_WRAPPED_ALIGN_CENTER : TTF_WRAPPED_ALIGN_LEFT
    1.11 +    );
    1.12      SDL_Surface *surface = TTF_RenderUTF8_Blended_Wrapped(
    1.13 -            asc_font_cache_validate(node->font)->ptr,
    1.14 -            node->text,
    1.15 -            asc_col_sdl(node->color),
    1.16 -            node->max_width
    1.17 +            font, node->text, asc_col_sdl(node->color), node->max_width
    1.18      );
    1.19      if (surface == NULL) {
    1.20          asc_error(SDL_GetError());

mercurial