#ifndef FONT_H
#define FONT_H

#include <map>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>

class Texture;
class TextNode;

class Font
{
public:
    struct CharInfo
    {
        glm::vec2 pos;
        glm::vec2 dim;
        glm::vec2 offset;
        float xadvance;
    };
    Font();
    
    // setters
    void setName(std::string name){m_name = name;}
    void addCharInfo(wchar_t character, CharInfo character_info){ m_charTable[character] = character_info; }
    void setNbChar(int nbchar){m_nbChar =nbchar;}
    void setLineHeight(float line_h){m_defaultLineHeight = line_h;}
    float getLineHeight(){return m_defaultLineHeight;}
    float getXAdvance(){return (m_charTable['a']).xadvance;}
    void setBase(float base){m_base = base;}
    void setAntiAnliasing(bool antialiasing){m_antiAliasing = antialiasing;}
    void setScale(glm::vec2 scale){m_scale = scale;}
    void setTexture(Texture *tex){m_tex = tex;}
    
    TextNode* getTextNode(std::string s, glm::vec3 color = glm::vec3(1), float font_size = 64.f, bool visible = true);
private:
    std::string m_name;
    Texture *m_tex;
    std::map<wchar_t, CharInfo> m_charTable;
    glm::vec2 m_scale;
    bool m_antiAliasing;
    int m_nbChar;
    float m_defaultLineHeight;
    float m_base;
};

#endif // FONT_H
