26#include <SDL3_ttf/SDL_ttf.h>
28#include <Objectively/Enum.h>
29#include <Objectively/Array.h>
30#include <Objectively/Data.h>
31#include <Objectively/String.h>
36#define DEFAULT_FONT_FAMILY "Coda"
37#define DEFAULT_FONT_SIZE 16
38#define DEFAULT_FONT_STYLE FontStyleRegular
40#define DEFAULT_MONOSPACE_FONT_FAMILY "Share Tech Mono"
82typedef struct FontInterface FontInterface;
129 char *iconPlaceholder;
155struct FontInterface {
160 ObjectInterface objectInterface;
187 Font *(*defaultFont)(void);
197 Font *(*defaultMonospaceFont)(void);
253 String *(*name)(
const Font *self);
288 SDL_Surface *(*renderCharacters)(
const Font *self,
const char *chars, SDL_Color color,
int wrapWidth);
Fixed-width Fonts baked into a glyph sheet, drawn as one quad per glyph.
const EnumName FontStyleNames[]
OBJECTIVELYMVC_EXPORT Class * _Font(void)
static ImageAtlas * icons(Theme *self)
ObjectivelyMVC base types.
#define OBJECTIVELYMVC_EXPORT
The family, size and style attributes that identify a Font, independent of the pixel density at which...
const char * family
The family, or NULL for the default.
int style
The FontStyle, or -1 for the default.
int size
The point size, or 0 for the default.
A fixed-width Font's glyphs, baked into one sheet, drawn as one quad per glyph.
float pixelDensity
The display pixel density scale, greater than 1.0 on high-density displays.
void(* cacheFont)(Data *data, const char *family)
Caches the specified font Data.
void renderBitmapCharacters(Font *self, const Renderer *renderer, const char *chars, SDL_Color color, int wrapWidth, const SDL_Point *origin, const ImageAtlas *icons)
Records one quad per glyph of the given characters from this Font's bitmap.
FontInterface * interface[0]
The interface type.
int renderSize
The render size, adjusted for pixel density.
char * family
The family name.
void sizeBitmapCharacters(const Font *self, const char *chars, int wrapWidth, const ImageAtlas *icons, int *w, int *h)
Measures the given characters against this Font's bitmap.
void clearCache(void)
Clears the Font cache.
FontBitmap bitmap
The glyphs of a fixed-width Font, baked into one sheet; bitmap.surface is NULL for a proportional Fon...
void renderDeviceWillReset(Font *self)
Releases this Font's bitmap Texture, if any, ahead of a render device reset. It is recreated on the n...
TTF_Font * font
The backing font.
String * name(const Font *self)
void sizeCharacters(const Font *self, const char *chars, int *w, int *h)
Measures the given characters in this Font.
Data * data
The raw font data.
Object object
The superclass.
Packs many Images into one sheet, backed by one Texture.
Renderer extends Object with ObjectivelyMVC's UI rendering layer.