TTF_GetTextPosition(3)
π TTF_GetTextPosition(3) π
okay bestie, welcome to the SDL_ttf3 girlies' manual, we're talking about TTF_GetTextPosition today and it's literally so simple you'll be obsessed π
β¨ NAME β¨
TTF_GetTextPosition β get the position of a text object. that's it. that's the whole job. she's a getter. she gets. π
π HEADER FILE π
she lives in SDL3_ttf/SDL_ttf.h β defined in SDL3_ttf/SDL_ttf.h, to be exact. go say hi.
πΈ SYNOPSIS πΈ
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_GetTextPosition(TTF_Text *text, int *x, int *y);
look at her. three args. returns a bool. iconic, no notes. β¨
π¦ FUNCTION PARAMETERS π¦
textβ theTTF_Textyou wanna query. the main character in question πxβ a pointer that gets filled in with the x offset of the upper left corner of this text, in pixels. may beNULL(she's flexible, we love that) πyβ a pointer that gets filled in with the y offset of the upper left corner of this text, in pixels. may beNULLtoo. equal opportunity NULL-ing π«Ά
ngl the phrasing is "upper left corner" for both, and yes that's the whole corner, we're not doing math here, just reporting the vibe check on where the top-left pixel party starts.
π§ THREAD SAFETY π§
β οΈ bestie. this function should be called on the thread that created the text. do NOT go wandering into other threads with this one, that's giving chaos and we don't do chaos. thread that made it = thread that asks about it. periodt. π
β AVAILABILITY β
this function is available since SDL_ttf 3.0.0. if you're on anything older, she simply does not exist for you, sorry, no cap. π
π SEE ALSO π
β’(3)TTF_SetTextPosition(3)
(yeah the bullet thing in the original is just like that, we don't question the ancients π β but the one you actually want next is TTF_SetTextPosition(3), her setter sister. get/set. a duo. a duo of all time. π₯)
and that's the page!! go forth and query your text position, you absolute legend ππ
signing off from the SDL_ttf 3.2.2 era β xoxo, your local manpage bestie ππ¦β¨
π¦ 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