diff options
author | pommicket <pommicket@gmail.com> | 2023-07-18 16:09:50 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-07-18 16:09:50 -0400 |
commit | 2d2f0a09b180cf3bd6a2bc0ad3d21ea956398822 (patch) | |
tree | 33d6c80526a22e19a0974ea0a8297143208f3af7 /ted.h | |
parent | 14cc6fb3f93ab6e3ce9b51826a9e29968932b0d7 (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.h | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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); |