load a font

This commit is contained in:
Josh Holtrop 2014-06-09 22:38:10 -04:00
parent 6138fd233f
commit a1d57b3f66

View File

@ -9,6 +9,9 @@ using namespace std;
#define WIDTH 500
#define HEIGHT 500
static FT_Library ft;
static FT_Face face;
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
@ -59,12 +62,20 @@ int main(int argc, char *argv[])
return 2;
}
FT_Library ft;
if (FT_Init_FreeType(&ft) != 0)
{
cerr << "Could not FT_Init_FreeType()" << endl;
return 2;
}
if (FT_New_Face(ft, "/usr/share/fonts/truetype/freefont/FreeMono.ttf", 0, &face) != 0)
{
cerr << "Could not load FreeMono.ttf" << endl;
return 2;
}
FT_Set_Pixel_Sizes(face, 0, 20);
init();
display(window);
SDL_Event event;