diff --git a/src/SDL_renderer_textengine.c b/src/SDL_renderer_textengine.c index beada70e..01b4d745 100644 --- a/src/SDL_renderer_textengine.c +++ b/src/SDL_renderer_textengine.c @@ -836,6 +836,13 @@ bool TTF_DrawRendererText(TTF_Text *text, float x, float y) return SDL_InvalidParamError("text"); } + // Make sure the engine text is up to date + TTF_TextEngine *engine = text->internal->engine; + if (!text->internal->engine_text && + !engine->CreateText(engine->userdata, text)) { + return false; + } + renderer = ((TTF_RendererTextEngineData *)text->internal->engine->userdata)->renderer; data = (TTF_RendererTextEngineTextData *)text->internal->engine_text; AtlasDrawSequence *sequence = data->draw_sequence; diff --git a/src/SDL_surface_textengine.c b/src/SDL_surface_textengine.c index 462c67be..ccef06b2 100644 --- a/src/SDL_surface_textengine.c +++ b/src/SDL_surface_textengine.c @@ -335,6 +335,13 @@ bool TTF_DrawSurfaceText(TTF_Text *text, int x, int y, SDL_Surface *surface) return SDL_InvalidParamError("surface"); } + // Make sure the engine text is up to date + TTF_TextEngine *engine = text->internal->engine; + if (!text->internal->engine_text && + !engine->CreateText(engine->userdata, text)) { + return false; + } + data = (TTF_SurfaceTextEngineTextData *)text->internal->engine_text; if (text->color.r != data->fcolor.r || diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c index 29e38a1e..7e8c381a 100644 --- a/src/SDL_ttf.c +++ b/src/SDL_ttf.c @@ -3856,15 +3856,6 @@ static void DestroyEngineText(TTF_Text *text) } } -static bool CreateEngineText(TTF_Text *text) -{ - TTF_TextEngine *engine = text->internal->engine; - if (engine && engine->CreateText && text->font && text->text) { - return engine->CreateText(engine->userdata, text); - } - return true; -} - static bool TTF_UpdateText(TTF_Text *text) { DestroyEngineText(text); @@ -3889,7 +3880,7 @@ static bool TTF_UpdateText(TTF_Text *text) } } - return CreateEngineText(text); + return true; } SDL_PropertiesID TTF_GetTextProperties(TTF_Text *text) @@ -3919,7 +3910,7 @@ bool TTF_SetTextEngine(TTF_Text *text, TTF_TextEngine *engine) text->internal->engine = engine; - return CreateEngineText(text); + return true; } bool TTF_SetTextFont(TTF_Text *text, TTF_Font *font)