TTF_GETPREVIOUSTEXTSUBSTRING(3)
π NAME π
TTF_GetPreviousTextSubString β bestie, this one gets you the previous substring in a text object π«Ά
It's from the SDL_ttf3 squad, obviously, and yeah it's a real function, not a vibe. β¨
πΈ HEADER FILE πΈ
It lives in SDL3_ttf/SDL_ttf.h, no cap. That's literally where it's defined, go look. π
β¨ SYNOPSIS β¨
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_GetPreviousTextSubString(TTF_Text *text, const TTF_SubString *substring, TTF_SubString *previous);
Okay so it takes three things and gives you back a bool. Simple. Iconic. π
π¦ DESCRIPTION π¦
So like, you hand it a text object and a substring, and it goes backwards to find the previous one. It's giving "rewind" energy. βͺ
But here's the tea, and it's important: if you call this at the start of the text, it's not gonna error out on you or anything dramatic like that. Instead it returns a zero length substring with the TTF_SUBSTRING_TEXT_START flag set. So like, you always know you've hit the beginning. π
π FUNCTION PARAMETERS π
textβ theTTF_Textyou wanna query. That's the text object in question, girl. πsubstringβ theTTF_SubStringyou wanna query. This is your starting point, and we're going back from here. π₯
β RETURN VALUE β
Returns true on success or false on failure. And if it's a fail? Call SDL_GetError() for more information β that's where the actual explanation is hiding, so don't just sit there confused. π
π§ THREAD SAFETY π§
Real talk: this function should be called on the thread that created the text. Like, the same one. Don't be out here threading chaos into your life, bestie. π
π AVAILABILITY π
This function is available since SDL_ttf 3.0.0. So if you're on something olderβ¦ no it isn't. π
That's the whole page, periodt. This little masterpiece came from the SDL_ttf 3.2.2 era, brought to you by the SDL_ttf girlies β go get that previous substring, you main character. πβ¨ππ¦πΈπ π«Ά
π¦ where this page comes from
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms