Untitled
Loading...
Searching...
No Matches
fonts.h
Go to the documentation of this file.
1
6#ifndef FONTS_H
7#define FONTS_H
8
9#include "utilities/types.h"
10#include "ui/ui.h"
11
15extern Vector FONTS;
16
17
21static inline void FONTS_INIT()
22{
23 if (FONTS.buffer) free(FONTS.buffer);
24 init_vector(&FONTS, 0, sizeof(Font));
25}
26
32
39Font * read_json_msdf(const char * json_path, const char * png_path);
40
47void determine_text_box_dimensions(TextBox * tb, float * width, float * height);
53
59int create_text_box(int menu_id);
60
66void delete_text_box(int menu, int id);
67
68
69
70#endif
Font * read_json_msdf(const char *json_path, const char *png_path)
Reads the JSON for an MSDF Font, and creates a Font from it.
Definition fonts.c:33
int create_text_box(int menu_id)
Creates a DEFAULT_TEXT_BOX.
Definition fonts.c:202
Vector FONTS
All loaded Fonts.
Definition fonts.c:14
int find_empty_text_box_slot(UIMenu *m)
Finds an empty slot for a TextBox that is marked as free.
Definition fonts.c:21
void delete_text_box(int menu, int id)
Deletes a TextBox and its text and frees it from the UIMenu.
Definition fonts.c:184
void determine_text_box_dimensions(TextBox *tb, float *width, float *height)
Determines TextBox dimensions by iterating through its text as if it was rendering the Font.
Definition fonts.c:97
void move_text_box_to_origin(TextBox *box)
Moves a TextBox to , while accounting for Justify.
Definition fonts.c:150
void FONTS_INIT()
Simply clears the FONTS buffer and re-initializes the Vector.
Definition fonts.h:21
A Font and its Glyphs used for rendering TextBoxes.
Definition ui.h:74
A structure holding a Font ID and text to be rendered and transformed with its properties.
Definition text.vert:5
The top-most UI structure that contains UIElements, TextBoxes, and UIContainers.
Definition ui.h:562
void * buffer
Definition types.h:210
The standalone UI library that controls text rendering, ui rendering, and events.
void init_vector(Vector *v, size_t i, size_t type_size)
Definition utilities.c:74