From 7b1ceeedf4222861a623af156714f3c2e2a60cd2 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 31 Mar 2022 03:06:36 -0400 Subject: enable fontconfig stuff on msys2 too --- src/platform.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/platform.cpp') diff --git a/src/platform.cpp b/src/platform.cpp index dc64a26..8eff19d 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -7,10 +7,14 @@ using namespace std::literals::string_literals; -#if defined(_WIN32) && defined(_MSC_VER) +#if defined(_WIN32) #include #include - #include + #if defined(_MSC_VER) + #include + #else + #include + #endif #include #include #pragma comment(lib, "Shlwapi.lib") @@ -22,8 +26,8 @@ bool Platform::SetupFonts() { { // thanks @WorkingRobot for da help :^)) - std::ifstream template_stream(buf + "\\fonts\\fonts.template.conf"s); - std::ofstream conf_stream(buf + "\\fonts\\fonts.conf"s); + std::ifstream template_stream(buf + R"(\fonts\fonts.template.conf)"s); + std::ofstream conf_stream(buf + R"(\fonts\fonts.conf)"s); if (!template_stream.good()) { printf("can't open fonts/fonts.template.conf\n"); return false; @@ -36,7 +40,7 @@ bool Platform::SetupFonts() { std::string line; while (std::getline(template_stream, line)) { if (line == "") - conf_stream << "" << (buf + "\\fonts\\conf.d"s) << ""; + conf_stream << "" << (buf + R"(\fonts\conf.d)"s) << ""; else conf_stream << line; conf_stream << '\n'; @@ -45,11 +49,11 @@ bool Platform::SetupFonts() { auto fc = FcConfigCreate(); FcConfigSetCurrent(fc); - FcConfigParseAndLoad(fc, const_cast(reinterpret_cast((buf + "\\fonts\\fonts.conf"s).c_str())), true); + FcConfigParseAndLoad(fc, const_cast(reinterpret_cast((buf + R"(\fonts\fonts.conf)"s).c_str())), true); FcConfigAppFontAddDir(fc, const_cast(reinterpret_cast((buf + "\\fonts"s).c_str()))); char fonts_path[MAX_PATH]; - if (SHGetFolderPathA(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, fonts_path) == S_OK) { + if (SHGetFolderPathA(nullptr, CSIDL_FONTS, nullptr, SHGFP_TYPE_CURRENT, fonts_path) == S_OK) { FcConfigAppFontAddDir(fc, reinterpret_cast(fonts_path)); } -- cgit v1.2.3