#pragma once

#include "Point.h"
#include "Image.h"

#include <memory>
#include <vector>
#include <string>

struct GlyphRunSegment
{
    enum class Type
    {
        POINT,
        LINE,
        BEZIER
    };
    std::vector<Point> mPoints;
    Type mType{ Type::LINE };
};

struct GlyphRunFeature
{
    bool mFilled{ true };
    std::vector<GlyphRunSegment> mSegments;
};

class GlyphRunOutlines
{
public:
    void addSegment(const GlyphRunSegment& point);
    void startFeature(const Point& point, bool isFilled);

    std::string toPostScriptPath();
private:
    std::vector<GlyphRunFeature> mFeatures;
};

class FontGlyph
{
public:
    FontGlyph(unsigned width, unsigned height, int bearingX, int bearingY, int advanceX, std::unique_ptr<Image> image);

    Image* getImage() const;

    unsigned getWidth() const;
    unsigned getHeight() const;
    int getBearingX() const;
    int getBearingY() const;
    int getAdvanceX() const;

private:
    unsigned mWidth{0};
    unsigned mHeight{0};
    int mBearingX{0};
    int mBearingY{0};
    int mAdvanceX{0};
    std::unique_ptr<Image> mImage;
};
