Untitled
Toggle main menu visibility
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
15
extern
Vector
FONTS
;
16
17
21
static
inline
void
FONTS_INIT
()
22
{
23
if
(
FONTS
.
buffer
) free(
FONTS
.
buffer
);
24
init_vector
(&
FONTS
, 0,
sizeof
(
Font
));
25
}
26
31
int
find_empty_text_box_slot
(
UIMenu
* m);
32
39
Font
*
read_json_msdf
(
const
char
* json_path,
const
char
* png_path);
40
47
void
determine_text_box_dimensions
(
TextBox
* tb,
float
* width,
float
* height);
52
void
move_text_box_to_origin
(
TextBox
* box);
53
59
int
create_text_box
(
int
menu_id);
60
66
void
delete_text_box
(
int
menu,
int
id
);
67
68
69
70
#endif
read_json_msdf
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
create_text_box
int create_text_box(int menu_id)
Creates a DEFAULT_TEXT_BOX.
Definition
fonts.c:202
FONTS
Vector FONTS
All loaded Fonts.
Definition
fonts.c:14
find_empty_text_box_slot
int find_empty_text_box_slot(UIMenu *m)
Finds an empty slot for a TextBox that is marked as free.
Definition
fonts.c:21
delete_text_box
void delete_text_box(int menu, int id)
Deletes a TextBox and its text and frees it from the UIMenu.
Definition
fonts.c:184
determine_text_box_dimensions
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
move_text_box_to_origin
void move_text_box_to_origin(TextBox *box)
Moves a TextBox to , while accounting for Justify.
Definition
fonts.c:150
FONTS_INIT
void FONTS_INIT()
Simply clears the FONTS buffer and re-initializes the Vector.
Definition
fonts.h:21
Font
A Font and its Glyphs used for rendering TextBoxes.
Definition
ui.h:74
TextBox
A structure holding a Font ID and text to be rendered and transformed with its properties.
Definition
text.vert:5
UIMenu
The top-most UI structure that contains UIElements, TextBoxes, and UIContainers.
Definition
ui.h:562
types.h
Vector::buffer
void * buffer
Definition
types.h:210
Vector
Definition
types.h:207
ui.h
The standalone UI library that controls text rendering, ui rendering, and events.
init_vector
void init_vector(Vector *v, size_t i, size_t type_size)
Definition
utilities.c:74
src
ui
fonts.h
Generated by
1.18.0