The following code produces error 1:
FT_Library library;
int error = FT_Init_FreeType(&library);
if (error) handleError("Problem initing freetype");
FT_Face face;
const char* filename = "fonts/regular.tff";
error = FT_New_Face(library, filename, 0, &face);
if (error == FT_Err_Unknown_File_Format) {
handleError("Unknown font file format %s", filename);
return;
} else if (error) {
handleError("Error %d loading font %s", error, filename);
return;
}
However, one line change makes it work:
error = FT_New_Face(library, "fonts/regular.tff", 0, &face);
I'm being forced to hardcode the font file, but I want to be able change it at runtime. I can't figure out why a constant variable would have a different result than hardcoding.