#include "font.h"


class PcbCamFontData : public QSharedData
{
public:
    PcbCamFontData() { }
    PcbCamFontData(const PcbCamFontData &other): QSharedData(other),
        name(other.name),
        sizeX(other.sizeX),
        sizeY(other.sizeY),
        offset(other.offset),
        charLinesMap(other.charLinesMap){ }
    ~PcbCamFontData() { }

    QString name {"standard"};
    double sizeX {0.0};
    double sizeY {0.0};
    double offset {0.0};
    QMap<QChar, QList<PcbCamFontCharLine> > charLinesMap;

};

PcbCamFont::PcbCamFont() : d(new PcbCamFontData)
{

}

PcbCamFont::PcbCamFont(const PcbCamFont &rhs) : d (rhs.d)
{

}

PcbCamFont &PcbCamFont::operator=(const PcbCamFont &rhs)
{
    if (this != &rhs)
        d.operator=(rhs.d);
    return *this;
}

PcbCamFont::~PcbCamFont()
{

}

void PcbCamFont::setName(const QString &iName)
{
    d->name = iName;
}

QString PcbCamFont::name() const
{
    return d->name;
}

void PcbCamFont::setSizeX(double iSizeX)
{
    d->sizeX = iSizeX;
}

void PcbCamFont::setSizeY(double iSizeY)
{
    d->sizeY = iSizeY;
}

double PcbCamFont::sizeX() const
{
    return d->sizeX;
}

double PcbCamFont::sizeY()
{
    return d->sizeY;
}


void PcbCamFont::setOffset(double iOffset)
{
    d->offset = iOffset;
}

double PcbCamFont::offset() const
{
    return d->offset;
}

QList<PcbCamFontCharLine> PcbCamFont::charLines(QChar iChar) const
{
    return d->charLinesMap.value(iChar);
}

void PcbCamFont::setCharLines(QChar iChar, const QList<PcbCamFontCharLine> &iLines)
{
    d->charLinesMap.insert(iChar, iLines);
}

