diff options
Diffstat (limited to 'src/crepe/facade')
-rw-r--r-- | src/crepe/facade/Font.cpp | 3 | ||||
-rw-r--r-- | src/crepe/facade/FontFacade.cpp | 10 | ||||
-rw-r--r-- | src/crepe/facade/FontFacade.h | 10 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 2 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.h | 6 |
5 files changed, 15 insertions, 16 deletions
diff --git a/src/crepe/facade/Font.cpp b/src/crepe/facade/Font.cpp index 558641f..f202c05 100644 --- a/src/crepe/facade/Font.cpp +++ b/src/crepe/facade/Font.cpp @@ -8,8 +8,7 @@ using namespace std; using namespace crepe; -Font::Font(const Asset & src, Mediator & mediator) - : Resource(src, mediator){ +Font::Font(const Asset & src, Mediator & mediator) : Resource(src, mediator) { Config & config = Config::get_instance(); const std::string FONT_PATH = src.get_path(); TTF_Font * loaded_font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size); diff --git a/src/crepe/facade/FontFacade.cpp b/src/crepe/facade/FontFacade.cpp index 08ff31c..7edfeb8 100644 --- a/src/crepe/facade/FontFacade.cpp +++ b/src/crepe/facade/FontFacade.cpp @@ -6,16 +6,14 @@ using namespace crepe; using namespace std; -FontFacade::FontFacade(){ +FontFacade::FontFacade() { if (!FcInit()) { throw runtime_error("Failed to initialize Fontconfig."); } } -FontFacade::~FontFacade(){ - FcFini(); -} -Asset FontFacade::get_font_asset(const string& font_family) { - +FontFacade::~FontFacade() { FcFini(); } +Asset FontFacade::get_font_asset(const string & font_family) { + // Create a pattern to search for the font family FcPattern * pattern = FcNameParse(reinterpret_cast<const FcChar8 *>(font_family.c_str())); if (pattern == NULL) { diff --git a/src/crepe/facade/FontFacade.h b/src/crepe/facade/FontFacade.h index 2e08f3f..9761070 100644 --- a/src/crepe/facade/FontFacade.h +++ b/src/crepe/facade/FontFacade.h @@ -15,10 +15,10 @@ class FontFacade { public: FontFacade(); ~FontFacade(); - FontFacade(const FontFacade & other) = delete; - FontFacade & operator=(const FontFacade & other) = delete; - FontFacade(FontFacade && other) noexcept = delete; - FontFacade & operator=(FontFacade && other) noexcept = delete; + FontFacade(const FontFacade & other) = delete; + FontFacade & operator=(const FontFacade & other) = delete; + FontFacade(FontFacade && other) noexcept = delete; + FontFacade & operator=(FontFacade && other) noexcept = delete; /** * * \brief Facade function to convert a font_family into an asset. @@ -28,7 +28,7 @@ public: * \param font_family Name of the font family name. * \return Asset with filepath to the corresponding font. */ - Asset get_font_asset(const std::string& font_family); + Asset get_font_asset(const std::string & font_family); }; } // namespace crepe diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 8ffaad9..c88687e 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -440,6 +440,6 @@ void SDLContext::set_color_texture(const Texture & texture, const Color & color) SDL_SetTextureAlphaMod(texture.get_img(), color.a); } -Asset SDLContext::get_font_from_name(const std::string& font_family){ +Asset SDLContext::get_font_from_name(const std::string & font_family) { return this->font_facade.get_font_asset(font_family); } diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index e348ff6..6f6eddb 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -241,9 +241,11 @@ private: * - this is defined in this class because get_events() needs this information aswell */ CameraAuxiliaryData cam_aux_data; -private: + +private: //! instance of the font_facade FontFacade font_facade{}; + public: /** * \brief Function to Get asset from font_family @@ -254,7 +256,7 @@ public: * * \return asset with the font style absolute path */ - Asset get_font_from_name(const std::string& font_family); + Asset get_font_from_name(const std::string & font_family); }; } // namespace crepe |