Integrate upstream #1392 by adriancaruana
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <SdCardFontManager.h>
|
||||
#include <SdCardFontRegistry.h>
|
||||
|
||||
class GfxRenderer;
|
||||
|
||||
/// Facade that owns the SD card font registry, manager, and resolver logic.
|
||||
/// Hides implementation details behind a single begin() + ensureLoaded() API.
|
||||
class SdCardFontSystem {
|
||||
public:
|
||||
SdCardFontSystem() = default;
|
||||
SdCardFontSystem(const SdCardFontSystem&) = delete;
|
||||
SdCardFontSystem& operator=(const SdCardFontSystem&) = delete;
|
||||
/// Discover SD card fonts and load user's saved selection. Call once during setup.
|
||||
void begin(GfxRenderer& renderer);
|
||||
|
||||
/// Ensure the correct SD font family is loaded for the current settings.
|
||||
/// Call before entering the reader or after settings change.
|
||||
void ensureLoaded(GfxRenderer& renderer);
|
||||
|
||||
/// Resolve an SD card font ID from family name + fontSize enum.
|
||||
/// Returns 0 if not found. Used by CrossPointSettings::getReaderFontId().
|
||||
int resolveFontId(const char* familyName, uint8_t fontSizeEnum) const;
|
||||
|
||||
/// Access the registry (e.g. for settings UI to enumerate available fonts).
|
||||
const SdCardFontRegistry& registry() const { return registry_; }
|
||||
|
||||
private:
|
||||
SdCardFontRegistry registry_;
|
||||
SdCardFontManager manager_;
|
||||
};
|
||||
Reference in New Issue
Block a user