diff options
Diffstat (limited to 'src/crepe/facade/Font.cpp')
-rw-r--r-- | src/crepe/facade/Font.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/crepe/facade/Font.cpp b/src/crepe/facade/Font.cpp index 1ee3de1..333e500 100644 --- a/src/crepe/facade/Font.cpp +++ b/src/crepe/facade/Font.cpp @@ -10,10 +10,11 @@ Font::Font(const Asset & src, Mediator & mediator) font(nullptr, TTF_CloseFont) { Config & config = Config::get_instance(); const std::string FONT_PATH = src.get_path(); - TTF_Font * font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size); - if (font == NULL) + TTF_Font * loaded_font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size); + if (loaded_font == NULL) { throw runtime_error(format("Font: {} (path: {})", TTF_GetError(), FONT_PATH)); - this->font = {font, [](TTF_Font * font) { TTF_CloseFont(font); }}; + } + this->font = {loaded_font, [](TTF_Font * font) { TTF_CloseFont(font); }}; } TTF_Font * Font::get_font() const { return this->font.get(); } |