/******************************************************************************
*	File		-	InternalFont.h
*	Author		-	Joey Pollack
*	Date		-	2020/01/08 (y/m/d)
*	Mod Date	-	2021/09/07 (y/m/d)
*	Description	-	Generates a font file (from OpenSans-Regular.ttf)
*
******************************************************************************/

#include "internalFont.h"
#include "openFontData.h"
#include "robotoFontData.h"
#include <utils/logger.h>
#include <fstream>

namespace lunarium
{
	bool GenerateFontFileAt(Font font, const char * filename)
	{
		std::ofstream ofs(filename, std::ios_base::binary);

		if (!ofs.is_open())
		{
			Logger::Log(LogCategory::GRAPHICS, LogLevel::WARNING, "Could not generate the default font file at: %s", filename);
			return false;
		}


		switch (font)
		{
			case Font::F_OPEN:
				ofs.write((const char*)OpenFontData, OpenDataSize);
			break;

			
			case Font::F_ROBOTO:
				ofs.write((const char*)RobotoFontData, RobotoDataSize);
			break;
		}

		ofs.close();
		ofs.clear();

		return true;
	}
}

