TTF_HORIZONTALALIGNMENT(3type)
π TTF_HorizontalAlignment π
okay bestie, so like β this is TTF_HorizontalAlignment(3type) from the SDL_ttf3 manual, and it's literally the enum that decides which way your wrapped text leans when it renders. left, center, right... it's giving alignment main character energy β¨
β¨ NAME β¨
TTF_HorizontalAlignment β the horizontal alignment used when rendering wrapped text π
πΈ HEADER FILE πΈ
Defined in SDL3_ttf/SDL_ttf.h β that's where she lives, no cap π
π¦ SYNOPSIS π¦
#include "SDL3_ttf/SDL_ttf.h"
typedef enum TTF_HorizontalAlignment
{
TTF_HORIZONTAL_ALIGN_INVALID = -1,
TTF_HORIZONTAL_ALIGN_LEFT,
TTF_HORIZONTAL_ALIGN_CENTER,
TTF_HORIZONTAL_ALIGN_RIGHT
} TTF_HorizontalAlignment;
look at her. four little values, all vibes, all doing the most for your text layout π«Ά
π DESCRIPTION π
So the tea is: this enum is the horizontal alignment you hand over when you're rendering wrapped text. Like, when your string is too long for one line and the library has to break it up, this is the setting that tells it where each line should sit horizontally.
The values, one by one, no skipping, we don't do that here:
TTF_HORIZONTAL_ALIGN_INVALID = -1β the "oops, nothing set yet" value. She's the placeholder, the not-a-real-choice, the-1of shame πTTF_HORIZONTAL_ALIGN_LEFTβ flush left, the classic, the default vibe for basically everything πTTF_HORIZONTAL_ALIGN_CENTERβ centered, symmetrical, serving balance βTTF_HORIZONTAL_ALIGN_RIGHTβ flush right, for when you want that dramatic lean π
π AVAILABILITY π
This enum has been available since SDL_ttf 3.0.0 β so she's not new new, she's been here, iconic since day one π
π reminder bestie:TTF_HORIZONTAL_ALIGN_INVALIDis-1, which is not a valid alignment. Don't render with it thinking it'll do something cute. It won't.
and that's the whole page fr fr πΈ thanks for reading, you ate that. this was SDL_ttf 3.2.2, dated with the SDL_ttf manual, and the source is TTF_HorizontalAlignment(3type) β mwah, go render something pretty πβ¨π
π¦ 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