#ifndef SDL_TTF_TEXTENGINE_H_
#define SDL_TTF_TEXTENGINE_H_
#include <SDL3/SDL.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <SDL3/SDL_begin_code.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum TTF_DrawCommand
{
TTF_DRAW_COMMAND_NOOP,
TTF_DRAW_COMMAND_FILL,
TTF_DRAW_COMMAND_COPY
} TTF_DrawCommand;
typedef struct TTF_FillOperation
{
TTF_DrawCommand cmd;
SDL_Rect rect;
} TTF_FillOperation;
typedef struct TTF_CopyOperation
{
TTF_DrawCommand cmd;
int text_offset;
TTF_Font *glyph_font;
Uint32 glyph_index;
SDL_Rect src;
SDL_Rect dst;
void *reserved;
} TTF_CopyOperation;
typedef union TTF_DrawOperation
{
TTF_DrawCommand cmd;
TTF_FillOperation fill;
TTF_CopyOperation copy;
} TTF_DrawOperation;
typedef struct TTF_TextLayout TTF_TextLayout;
struct TTF_TextData
{
TTF_Font *font;
SDL_FColor color;
bool needs_layout_update;
TTF_TextLayout *layout;
int x;
int y;
int w;
int h;
int num_ops;
TTF_DrawOperation *ops;
int num_clusters;
TTF_SubString *clusters;
SDL_PropertiesID props;
bool needs_engine_update;
TTF_TextEngine *engine;
void *engine_text;
};
struct TTF_TextEngine
{
Uint32 version;
void *userdata;
bool (SDLCALL *CreateText)(void *userdata, TTF_Text *text);
void (SDLCALL *DestroyText)(void *userdata, TTF_Text *text);
};
SDL_COMPILE_TIME_ASSERT(TTF_TextEngine_SIZE,
(sizeof(void *) == 4 && sizeof(TTF_TextEngine) == 16) ||
(sizeof(void *) == 8 && sizeof(TTF_TextEngine) == 32));
#ifdef __cplusplus
}
#endif
#include <SDL3/SDL_close_code.h>
#endif