40 lines
790 B
C++
40 lines
790 B
C++
#include "FontManager.h"
|
|
#include <iostream>
|
|
|
|
bool FontManager::load()
|
|
{
|
|
if (FT_Init_FreeType(&m_ft) != 0)
|
|
{
|
|
std::cerr << "Error initializing FreeType" << std::endl;
|
|
return false;
|
|
}
|
|
|
|
/* Load failsafe font */
|
|
m_mono_font = load_font("FreeMono", 20);
|
|
|
|
if (m_mono_font == NULL)
|
|
{
|
|
std::cerr << "Error loading FreeMono font" << std::endl;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
FontRef FontManager::load_font(const char * fname, size_t size)
|
|
{
|
|
/* TODO */
|
|
return NULL;
|
|
#if 0
|
|
PathRef font_path = Runtime::locate(Runtime::FONT, fname);
|
|
if (font_path == NULL)
|
|
return NULL;
|
|
|
|
FontRef font = new Font();
|
|
if (!font->load(m_ft, font_path->to_s().c_str(), size))
|
|
return NULL;
|
|
|
|
return font;
|
|
#endif
|
|
}
|