diff --git a/applications/services/gui/canvas.c b/applications/services/gui/canvas.c index f9ff2aadb..ff52c6090 100644 --- a/applications/services/gui/canvas.c +++ b/applications/services/gui/canvas.c @@ -137,7 +137,7 @@ uint8_t canvas_current_font_width(const Canvas* canvas) { const CanvasFontParameters* canvas_get_font_params(const Canvas* canvas, Font font) { furi_assert(canvas); furi_assert(font < FontTotalNumber); - if((FontSwap)font < FontSwapCount && xtreme_assets.font_params[font]) { + if(xtreme_assets.font_params[font]) { return xtreme_assets.font_params[font]; } return &canvas_font_params[font]; @@ -176,7 +176,7 @@ void canvas_invert_color(Canvas* canvas) { void canvas_set_font(Canvas* canvas, Font font) { furi_assert(canvas); u8g2_SetFontMode(&canvas->fb, 1); - if((FontSwap)font < FontSwapCount && xtreme_assets.fonts[font]) { + if(xtreme_assets.fonts[font]) { u8g2_SetFont(&canvas->fb, xtreme_assets.fonts[font]); return; } diff --git a/lib/xtreme/assets.c b/lib/xtreme/assets.c index 1154510ca..a474db04d 100644 --- a/lib/xtreme/assets.c +++ b/lib/xtreme/assets.c @@ -111,7 +111,7 @@ void free_icon(const Icon* icon) { free(frames); } -void load_font(FontSwap font, const char* name, FuriString* path, File* file) { +void load_font(Font font, const char* name, FuriString* path, File* file) { furi_string_printf(path, FONTS_FMT, xtreme_settings.asset_pack, name); if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { uint64_t size = storage_file_size(file); @@ -133,7 +133,7 @@ void load_font(FontSwap font, const char* name, FuriString* path, File* file) { storage_file_close(file); } -void free_font(FontSwap font) { +void free_font(Font font) { free(xtreme_assets.fonts[font]); xtreme_assets.fonts[font] = NULL; free(xtreme_assets.font_params[font]); @@ -141,11 +141,11 @@ void free_font(FontSwap font) { } static const char* font_names[] = { - [FontSwapPrimary] = "Primary", - [FontSwapSecondary] = "Secondary", - [FontSwapKeyboard] = "Keyboard", - [FontSwapBigNumbers] = "BigNumbers", - [FontSwapBatteryPercent] = "BatteryPercent", + [FontPrimary] = "Primary", + [FontSecondary] = "Secondary", + [FontKeyboard] = "Keyboard", + [FontBigNumbers] = "BigNumbers", + [FontBatteryPercent] = "BatteryPercent", }; void XTREME_ASSETS_LOAD() { @@ -171,7 +171,7 @@ void XTREME_ASSETS_LOAD() { } } - for(FontSwap font = 0; font < FontSwapCount; font++) { + for(Font font = 0; font < FontTotalNumber; font++) { load_font(font, font_names[font], p, f); } @@ -188,7 +188,7 @@ void XTREME_ASSETS_FREE() { } } - for(FontSwap font = 0; font < FontSwapCount; font++) { + for(Font font = 0; font < FontTotalNumber; font++) { if(xtreme_assets.fonts[font] != NULL) { free_font(font); } diff --git a/lib/xtreme/xtreme.h b/lib/xtreme/xtreme.h index 663cdb47f..0f167ba58 100644 --- a/lib/xtreme/xtreme.h +++ b/lib/xtreme/xtreme.h @@ -85,19 +85,10 @@ typedef struct { bool file_naming_prefix_after; } XtremeSettings; -typedef enum { - FontSwapPrimary, - FontSwapSecondary, - FontSwapKeyboard, - FontSwapBigNumbers, - FontSwapBatteryPercent, - FontSwapCount, -} FontSwap; - typedef struct { bool is_nsfw; // TODO: replace with packs text support - uint8_t* fonts[FontSwapCount]; - CanvasFontParameters* font_params[FontSwapCount]; + uint8_t* fonts[FontTotalNumber]; + CanvasFontParameters* font_params[FontTotalNumber]; } XtremeAssets; void XTREME_SETTINGS_LOAD();