summaryrefslogtreecommitdiff
path: root/ted.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-07-18 16:09:50 -0400
committerpommicket <pommicket@gmail.com>2023-07-18 16:09:50 -0400
commit2d2f0a09b180cf3bd6a2bc0ad3d21ea956398822 (patch)
tree33d6c80526a22e19a0974ea0a8297143208f3af7 /ted.h
parent14cc6fb3f93ab6e3ce9b51826a9e29968932b0d7 (diff)
new font management system
this lets us avoid reloading the font file from disk whenever the font size changes
Diffstat (limited to 'ted.h')
-rw-r--r--ted.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/ted.h b/ted.h
index 4e4f4bb..0cf9ea1 100644
--- a/ted.h
+++ b/ted.h
@@ -725,6 +725,11 @@ typedef struct {
Action *actions;
} Macro;
+typedef struct {
+ char *path;
+ Font *font;
+} LoadedFont;
+
#define TED_MACRO_MAX 256
/// (almost) all data used by the ted application
@@ -739,6 +744,7 @@ typedef struct Ted {
bool executing_macro;
SDL_Window *window;
+ LoadedFont *all_fonts;
Font *font_bold;
Font *font;
TextBuffer *active_buffer;
@@ -1655,8 +1661,12 @@ TextBuffer *ted_get_buffer_with_file(Ted *ted, const char *path);
bool ted_save_all(Ted *ted);
/// reload all buffers from their files
void ted_reload_all(Ted *ted);
-/// Load all the fonts ted will use.
+/// Load all the fonts ted will use, freeing any previous ones.
void ted_load_fonts(Ted *ted);
+/// Change ted's font size. Avoid calling this super often since it trashes all current font textures.
+void ted_change_text_size(Ted *ted, float new_size);
+/// Free all of ted's fonts.
+void ted_free_fonts(Ted *ted);
/// Get likely root directory of project containing `path`.
/// The returned value should be freed.
char *ted_get_root_dir_of(Ted *ted, const char *path);