diff --git a/src/openrct2/drawing/ttf.c b/src/openrct2/drawing/ttf.c index 73c5d5227f..73884fd3d9 100644 --- a/src/openrct2/drawing/ttf.c +++ b/src/openrct2/drawing/ttf.c @@ -60,7 +60,6 @@ static TTF_Font * ttf_open_font(const utf8 * fontPath, sint32 ptSize); static void ttf_close_font(TTF_Font * font); static uint32 ttf_surface_cache_hash(TTF_Font * font, const utf8 * text); static void ttf_surface_cache_dispose(ttf_cache_entry * entry); -static void ttf_surface_cache_dispose_all(); static void ttf_getwidth_cache_dispose_all(); static bool ttf_get_size(TTF_Font * font, const utf8 * text, sint32 * width, sint32 * height); static TTFSurface * ttf_render(TTF_Font * font, const utf8 * text); @@ -144,7 +143,7 @@ static void ttf_surface_cache_dispose(ttf_cache_entry *entry) } } -static void ttf_surface_cache_dispose_all() +void ttf_surface_cache_dispose_all() { for (sint32 i = 0; i < TTF_SURFACE_CACHE_SIZE; i++) { ttf_surface_cache_dispose(&_ttfSurfaceCache[i]); diff --git a/src/openrct2/drawing/ttf.h b/src/openrct2/drawing/ttf.h index 46c39a8634..6714d445a5 100644 --- a/src/openrct2/drawing/ttf.h +++ b/src/openrct2/drawing/ttf.h @@ -44,6 +44,7 @@ extern "C" { TTFFontDescriptor * ttf_get_font_from_sprite_base(uint16 spriteBase); TTFSurface * ttf_surface_cache_get_or_add(TTF_Font * font, const utf8 * text); +void ttf_surface_cache_dispose_all(); uint32 ttf_getwidth_cache_get_or_add(TTF_Font * font, const utf8 * text); bool ttf_provides_glyph(const TTF_Font * font, codepoint_t codepoint); void ttf_free_surface(TTFSurface * surface); diff --git a/src/openrct2/interface/console.c b/src/openrct2/interface/console.c index 7ebdc392e9..dc2c49fba1 100644 --- a/src/openrct2/interface/console.c +++ b/src/openrct2/interface/console.c @@ -45,6 +45,10 @@ #include "console.h" #include "viewport.h" +#ifndef NO_TTF +#include "../drawing/ttf.h" +#endif + #define CONSOLE_BUFFER_SIZE 8192 #define CONSOLE_BUFFER_2_SIZE 256 #define CONSOLE_HISTORY_SIZE 64 @@ -833,6 +837,11 @@ static sint32 cc_get(const utf8 **argv, sint32 argc) else if (strcmp(argv[0], "cheat_disable_support_limits") == 0) { console_printf("cheat_disable_support_limits %d", gCheatsDisableSupportLimits); } +#ifndef NO_TTF + else if (strcmp(argv[0], "enable_hinting") == 0) { + console_printf("enable_hinting %d", gConfigFonts.enable_hinting); + } +#endif else { console_writeline_warning("Invalid variable."); } @@ -1069,6 +1078,14 @@ static sint32 cc_set(const utf8 **argv, sint32 argc) } console_execute_silent("get cheat_disable_support_limits"); } +#ifndef NO_TTF + else if (strcmp(argv[0], "enable_hinting") == 0 && invalidArguments(&invalidArgs, int_valid[0])) { + gConfigFonts.enable_hinting = (int_val[0] != 0); + config_save_default(); + console_execute_silent("get enable_hinting"); + ttf_surface_cache_dispose_all(); + } +#endif else if (invalidArgs) { console_writeline_error("Invalid arguments."); }