TTF_GetText...ingsForRange(3)

πŸ’– TTF_GetTextSubStringsForRange(3) πŸ’–

okay bestie, welcome to the SDL_ttf3 FUNCTIONS section of the manual, and lemme tell you, this one is a lil baddie. It's literally the function that gets you the substrings of a text object that contain a range of text. That's it, that's the vibe. πŸ¦‹


🌸 NAME 🌸

TTF_GetTextSubStringsForRange β€” get the substrings of a text object that contain a range of text. no cap, that's the whole job description. ✨


πŸ“ HEADER FILE πŸ“

It's defined in SDL3_ttf/SDL_ttf.h, bestie. go get it. πŸ’…


✨ SYNOPSIS ✨

#include "SDL3_ttf/SDL_ttf.h"

TTF_SubString ** TTF_GetTextSubStringsForRange(TTF_Text *text, int offset, int length, int *count);

look at her. so clean. so iconic. πŸ‘‘


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • text β€” the TTF_Text to query. this is the text object you're asking about, she's the main character here.
  • offset β€” a byte offset into the text string. like, where do you wanna start looking, bestie?
  • length β€” the length of the range being queried, in bytes, or -1 for the remainder of the string. so if you're feeling lazy (real), -1 means "yeah just gimme everything from there to the end". periodt.
  • count β€” a pointer that gets filled in with the number of substrings returned. it may be NULL, so if you don't care, you can just vibe and pass NULL. πŸ™ˆ

πŸ’œ RETURN VALUE πŸ’œ

( TTF_SubString ) It returns a NULL terminated array of substring pointers, or NULL on failure. 😭 and if it fails? call SDL_GetError() for more information, she'll tell you what went wrong.

⚠️ heads up bestie: this is a single allocation that should be freed with SDL_free() when it is no longer needed. do NOT forget, we do not leak memory in this house. πŸ’€

🧚 THREAD SAFETY 🧚

This function should be called on the thread that created the text. no jumping threads, she's loyal like that. 🫢


🌈 AVAILABILITY 🌈

This function is available since SDL_ttf 3.0.0. she's been around, she's got history. ⭐


πŸ“ SIGN-OFF πŸ“

and that's the whole page, bestie!! this came to you from SDL_ttf 3.2.2 (the SDL_ttf manual), and honestly? slay. go forth and get those substrings. πŸ’–πŸŽ€βœ¨πŸ”₯πŸ’…πŸŒΈ

πŸ“¦ where this page comes from