// Font.h - Font rendering abstraction with simple size cache
#pragma once
#include <SDL3_ttf/SDL_ttf.h>
#include <string>
#include <unordered_map>
struct SDL_Renderer;

class FontAtlas {
public:
    bool init(const std::string& path, int basePt);
    void shutdown();
    void draw(SDL_Renderer* r, float x, float y, const std::string& text, float scale, SDL_Color color);
    // Measure rendered text size in pixels for a given scale
    void measure(const std::string& text, float scale, int& outW, int& outH);
private:
    std::string fontPath;
    int baseSize{24};
    std::unordered_map<int, TTF_Font*> cache; // point size -> font*
    TTF_Font* getSized(int ptSize);
};
