#pragma once

#include "IFontEngine.h"

#include "Image.h"

class Image;

#include <ft2build.h>
#include FT_FREETYPE_H

class FreeTypeFontEngine : public IFontEngine
{
public:
    FreeTypeFontEngine() = default;

    void initialize() override;

    void loadFontFace(const std::filesystem::path& fontFile, float penSize = 16) override;

    std::unique_ptr<FontGlyph> loadGlyph(uint32_t charCode) override;

    double getHorizontalAdvance(const FontItem&, const std::string&) override
    {
        return 0.0;
    }

private:
    std::filesystem::path mSystemFontLocation{"/usr/share/fonts/"};

    FT_Face mWorkingFontFace{nullptr};
    FT_Library mLibrary{nullptr};
};
