26#include <SDL3/SDL_gpu.h>
125typedef struct TextInterface TextInterface;
231struct TextInterface {
236 ViewInterface viewInterface;
255 SDL_Size (*naturalSize)(
const Text *self);
266 SDL_Size (*sizeText)(
const Text *self,
const char *text);
284 void (*setText)(
Text *self,
const char *text);
293 void (*setTextWithFormat)(
Text *self,
const char *fmt, ...);
Packs many Images into one sheet, backed by one Texture.
OBJECTIVELYMVC_EXPORT size_t MVC_IconEscapeLength(const char *chars, const ImageAtlas *icons, AtlasImage **image)
Parses an icon escape at the start of chars: :name:, where name is one or more of [A-Za-z0-9_-] and u...
OBJECTIVELYMVC_EXPORT SDL_Color TextEscapeColors[10]
Color palette for text escape sequences (^0 through ^9).
OBJECTIVELYMVC_EXPORT Class * _Text(void)
OBJECTIVELYMVC_EXPORT char * MVC_LayoutText(const Font *font, const char *text, SDL_Color color, const ImageAtlas *icons, TextSpan **spans, size_t *count)
Resolves the escapes in text into the string to lay out and the spans to draw it as.
TextTransform
Case transforms a Text applies when drawing, leaving Text::text as set.
@ TextTransformCapitalize
OBJECTIVELYMVC_EXPORT char * MVC_StripColorEscapes(const char *text)
Strips color escape sequences from the given text: ^0 through ^9 are removed, and ^^ collapses to ^.
OBJECTIVELYMVC_EXPORT const EnumName TextTransformNames[]
OBJECTIVELYMVC_EXPORT bool MVC_HasColorEscapes(const char *text)
static ImageAtlas * icons(Theme *self)
static Font * font(Theme *self, const FontAttributes *attributes, float pixelDensity)
static Image * image(Theme *self, const char *name, float pixelDensity)
#define OBJECTIVELYMVC_EXPORT
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
An Image packed into an ImageAtlas.
Packs many Images into one sheet, backed by one Texture.
Text rendered with TrueType fonts.
TextTransform transform
The case transform applied when drawing: the text-transform style attribute, or textTransform in JSON...
TextInterface * interface[0]
The interface type.
Texture * texture
The rendered GPU texture.
TextRun * runs
The runs of texture, one textured quad each, when the text contains escapes; otherwise NULL,...
bool lineWrap
If true, wrap text along word boundaries to fit this Text's width.
SDL_Color color
The text color.
Font * font
The Font. A fixed-width Font carries a bitmap, and is drawn as one quad per glyph from its glyph shee...
size_t runCount
The number of entries in runs.
One quad of a rendered TrueType Text: a region of its texture, in texels, drawn in color,...
One span of a laid-out string, in bytes of the layout string MVC_LayoutText returns: either the chara...
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.