From 2772bb158f10fc051d35006041303f2e5418e817 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Tue, 17 Dec 2024 15:15:12 +0100 Subject: make format --- src/crepe/facade/FontFacade.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'src/crepe/facade') diff --git a/src/crepe/facade/FontFacade.cpp b/src/crepe/facade/FontFacade.cpp index 5382f1a..5db06d2 100644 --- a/src/crepe/facade/FontFacade.cpp +++ b/src/crepe/facade/FontFacade.cpp @@ -1,7 +1,7 @@ #include -#include -#include #include +#include +#include #include #include "FontFacade.h" @@ -17,39 +17,37 @@ FontFacade::FontFacade() { FontFacade::~FontFacade() { FcFini(); } -Asset FontFacade::get_font_asset(const string& font_family) { - // Create a pattern to search for the font family - FcPattern* raw_pattern = FcNameParse(reinterpret_cast(font_family.c_str())); +Asset FontFacade::get_font_asset(const string & font_family) { + + FcPattern * raw_pattern + = FcNameParse(reinterpret_cast(font_family.c_str())); if (!raw_pattern) { throw runtime_error("Failed to create font pattern."); } - std::unique_ptr> pattern( - raw_pattern, - [](FcPattern* p) { FcPatternDestroy(p); } - ); + std::unique_ptr> pattern( + raw_pattern, [](FcPattern * p) { FcPatternDestroy(p); }); - FcConfig* config = FcConfigGetCurrent(); + FcConfig * config = FcConfigGetCurrent(); if (!config) { throw runtime_error("Failed to get current Fontconfig configuration."); } FcResult result; - FcPattern* raw_matched_pattern = FcFontMatch(config, pattern.get(), &result); + FcPattern * raw_matched_pattern = FcFontMatch(config, pattern.get(), &result); if (!raw_matched_pattern) { throw runtime_error("No matching font found."); } - std::unique_ptr> matched_pattern( - raw_matched_pattern, - [](FcPattern* p) { FcPatternDestroy(p); } - ); + std::unique_ptr> matched_pattern( + raw_matched_pattern, [](FcPattern * p) { FcPatternDestroy(p); }); - FcChar8* file_path = nullptr; - if (FcPatternGetString(matched_pattern.get(), FC_FILE, 0, &file_path) != FcResultMatch || !file_path) { + FcChar8 * file_path = nullptr; + if (FcPatternGetString(matched_pattern.get(), FC_FILE, 0, &file_path) != FcResultMatch + || !file_path) { throw runtime_error("Failed to get font file path."); } - string font_file_path = reinterpret_cast(file_path); + string font_file_path = reinterpret_cast(file_path); return Asset(font_file_path); } -- cgit v1.2.3