//
// Created by sebastian on 10.02.26.
//

#ifndef DICEWARS_SIEDLER_FONT_H
#define DICEWARS_SIEDLER_FONT_H
#include <string>

#include "glad/glad.h"
#include "glm/vec2.hpp"

#include <ft2build.h>
#include <unordered_map>

#include FT_FREETYPE_H

class Font {
public:
    Font(const std::string& fontPath, unsigned int fontSize);
    ~Font() = default;

    struct Character {
        GLuint textureID;
        glm::ivec2 size;
        glm::ivec2 bearing;
        unsigned int advance;
    };

    [[nodiscard]] Character getCharacter(char c) const;
    float getAscent() const { return ascent; }
    float getDescent() const { return descent; }
    float getLineHeight() const { return lineHeight; }

private:
    FT_Library ft;
    FT_Face face;
    std::unordered_map<unsigned char, Character> characters;
    float ascent;
    float descent;
    float lineHeight;
};


#endif //DICEWARS_SIEDLER_FONT_H