#ifndef FONT_HPP
#define FONT_HPP
#include <ft2build.h>
#ifdef FT_FREETYPE_H
#include FT_FREETYPE_H
#endif
#include <wren/font.h>
namespace wren {
class Font {
public:
static Font *createFont() { return new Font(); }
static void deleteFont(Font *font) { delete font; }
void setFontFace(const char *filename);
void setFontSize(unsigned int size);
unsigned char *generateCharBuffer(unsigned long character, bool antiAliasing, int *width, int *rows, int *verticalOffset,
int *horizontalOffset, int *transparencyFactor, int *horizontalAdvance, int *pitch);
unsigned int verticalSpace() const;
int descender() const { return mFace->descender * (mFontSize / static_cast<float>(mFace->units_per_EM)); }
void getBoundingBox(const char *text, int *width, int *height);
unsigned int fontSize() const { return mFontSize; }
WrFontError error() const { return mError; }
private:
Font();
~Font();
FT_Library mLibrary;
FT_Face mFace;
bool mFaceIsInitialized;
WrFontError mError;
unsigned int mFontSize;
#ifdef _WIN32
unsigned char *mFileBuffer;
#endif
};
}
#endif