/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
#ifndef FONT_H
#define FONT_H

#include "freetype/ft2build.h"
#include FT_FREETYPE_H
#include "Texture.h"

class Font
{
public:
	bool loadFont(string sFile, int iPXSize);

	bool LoadSystemFont(string sName, int iPXSize);

	void printString(string sText, int x, int y, int iPXSize = -1);

	void printFormattedString(int x, int y, int iPXSize, char* sText, ...);

	void deleteFont();

	void setShaderProgram(unsigned int shaderId);

	Font();
private:
	void createChar(int iIndex);

	Texture mCharTextures[256];
	int mAdvX[256], mAdvY[256];
	int mBearingX[256], mBearingY[256];
	int mCharWidth[256], mCharHeight[256];
	int mLoadedPixelSize, mNewLine;

	bool bLoaded;

	unsigned int mVAO;
    vector<unsigned char> mDataBuffer;
    unsigned int mDataBufferSize;
    unsigned int mBuffer;


	FT_Library mFTLib;
	FT_Face mFTFace;
	unsigned int mShaderId;
};
#endif