--- a/src/text.c Tue Aug 05 16:53:25 2025 +0200 +++ b/src/text.c Tue Aug 05 20:00:24 2025 +0200 @@ -34,6 +34,8 @@ #include <assert.h> #include <cx/printf.h> +#include <SDL3_ttf/SDL_ttf.h> + typedef struct asc_text_shader_s { AscShaderProgram program; asc_uniform_loc tex; @@ -64,15 +66,16 @@ asc_set_flag(node->flags, ASC_SCENE_NODE_HIDDEN); return; } - static int alignments[] = { - TTF_WRAPPED_ALIGN_LEFT, - TTF_WRAPPED_ALIGN_CENTER, - TTF_WRAPPED_ALIGN_RIGHT + static TTF_HorizontalAlignment alignments[] = { + TTF_HORIZONTAL_ALIGN_LEFT, + TTF_HORIZONTAL_ALIGN_CENTER, + TTF_HORIZONTAL_ALIGN_RIGHT }; - TTF_SetFontWrappedAlign( + TTF_SetFontWrapAlignment( font, alignments[text->base.flags & ASC_TEXT_ALIGNMENT_MASK]); - SDL_Surface *surface = TTF_RenderUTF8_Blended_Wrapped( - font, text->text.ptr, asc_col_sdl(text->color), text->max_width + // TODO: it looks like TTF_RenderText_Blended_Wrapped is broken in SDL 3 + SDL_Surface *surface = TTF_RenderText_Blended( + font, text->text.ptr, text->text.length, asc_col_sdl(text->color)//, text->max_width ); if (surface == NULL) { asc_error("Rendering TTF surface failed: %s", SDL_GetError()); @@ -97,7 +100,7 @@ } // Free the surface - SDL_FreeSurface(surface); + SDL_DestroySurface(surface); // Schedule for transform update asc_scene_node_update_transform(node);