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 -1 of 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_INVALID is -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