
#include "kjs/wk_config.h"
#include "BALConfiguration.h"
#include "BCFontPlatformDataPrivateDirectFB.h"
#include <font/BTFontPlatformData.h>

#include <font/FontDescription.h>

#include "BTLogHelper.h"

namespace BAL {

BTFontPlatformData::BTFontPlatformData(const FontDescription& fontDescription, const AtomicString& familyName)
    : m_fontDescription(fontDescription)
    , d(0)
{
    DBGML(MODULE_FONTS, LEVEL_INFO, "\nBTFontPlatformData::BTFontPlatformData()\n");
    init();
    static_cast<BCFontPlatformDataPrivateDirectFB *> (d)->configureFontMapping(fontDescription, familyName);
}

BTFontPlatformData::~BTFontPlatformData()
{
    DBGML(MODULE_FONTS, LEVEL_INFO, "\nBTFontPlatformData::~BTFontPlatformData()\n");
    if (d)
        deleteBIFontPlatformDataPrivate(d);
    d = NULL;
}

bool BTFontPlatformData::init()
{
    DBGML(MODULE_FONTS, LEVEL_INFO, "\nBTFontPlatformData::init()\n");
    d = createBIFontPlatformDataPrivate();
    ASSERT(d);
    return d->init();
}

bool BTFontPlatformData::operator==(const BTFontPlatformData& other) const
{
    DBGML(MODULE_FONTS, LEVEL_INFO, "\nBTFontPlatformData::operator==\n");
    if (!d && !other.d)
            return true;
    if (!d || !other.d)
            return false;
    return (d->isEqual(other.d));
}

} //namespace BAL
