
#include <Spectre/System/Log.h>
#include "FreeTypeLib.h"

namespace sp {

FreeTypeLib& FreeTypeLib::getInstance()
{
	static FreeTypeLib _inst;
	return _inst;
};

FreeTypeLib::FreeTypeLib()
{
	FT_Error error = FT_Init_FreeType(&handle);
	if (error) {
		Log::error("Could not initialize FreeType");
		return;
	}

	Log::info("FreeType font driver was initialized.");
	error = FT_Stroker_New(handle, &stroker);
}

FreeTypeLib::~FreeTypeLib()
{
	FT_Error error;

	FT_Stroker_Done(stroker);

	error = FT_Done_FreeType(handle);
	if (error) {
		Log::error("Could not close FreeType");
	}
}

} // namespace sp
