28 lines
581 B
C++
28 lines
581 B
C++
#ifndef FONT_H
|
|
#define FONT_H
|
|
|
|
#include <unordered_map>
|
|
#include <memory>
|
|
#include "Glyph.h"
|
|
|
|
class Font
|
|
{
|
|
public:
|
|
bool load(const char * fname, int size);
|
|
std::shared_ptr<Glyph> get_glyph(FT_ULong character);
|
|
int get_advance() { return m_advance; }
|
|
int get_line_height() { return m_line_height; }
|
|
int get_baseline_offset() { return m_baseline_offset; }
|
|
|
|
protected:
|
|
bool preload_glyphs();
|
|
|
|
FT_Face m_face;
|
|
std::unordered_map<FT_ULong, std::shared_ptr<Glyph>> m_glyphs;
|
|
int m_advance;
|
|
int m_line_height;
|
|
int m_baseline_offset;
|
|
};
|
|
|
|
#endif
|