mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
Merge pull request #185 from mahiuchun/font_name
Make font loading more reliably.
This commit is contained in:
@@ -91,16 +91,16 @@ int main()
|
||||
}
|
||||
|
||||
// find path to font
|
||||
const char *font_name = FileSystem::getPath("resources/fonts/Antonio-Bold.ttf").c_str();
|
||||
if(!font_name)
|
||||
std::string font_name = FileSystem::getPath("resources/fonts/Antonio-Bold.ttf");
|
||||
if (font_name.empty())
|
||||
{
|
||||
std::cout << "ERROR::FREETYPE: Failed to load font_name: " << font_name << std::endl;
|
||||
std::cout << "ERROR::FREETYPE: Failed to load font_name" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// load font as face
|
||||
FT_Face face;
|
||||
if (FT_New_Face(ft, font_name, 0, &face)) {
|
||||
if (FT_New_Face(ft, font_name.c_str(), 0, &face)) {
|
||||
std::cout << "ERROR::FREETYPE: Failed to load font" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user