revert old changes

This commit is contained in:
ohyzha
2025-01-18 16:14:02 +02:00
parent a5a1fd99d5
commit 5a5bac8479
6 changed files with 63 additions and 47 deletions

View File

@@ -0,0 +1,21 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include "Host/SystemFontResolver.hpp"
#include <filesystem>
namespace OpenVulkano
{
std::string SystemFontResolver::GetSystemFontPath(const std::string& fontName)
{
return "";
}
std::map<std::string, std::string> SystemFontResolver::ReadSystemFonts()
{
return {};
}
}

View File

@@ -16,9 +16,6 @@
#include <sys/utsname.h>
#include <unistd.h>
#include <thread>
#include <filesystem>
#include <functional>
#include <map>
namespace OpenVulkano
{
@@ -397,38 +394,4 @@ namespace OpenVulkano
{
return InterfaceOrientation::Landscape; // TODO?
}
std::string SystemInfo::GetSystemFontPath(const std::string& fontName)
{
// fontName -> fontPath
static std::map<std::string, std::string> fontFilesMapping;
if (fontFilesMapping.empty())
{
const std::filesystem::path fontsDir = "/usr/share/fonts/truetype";
std::function<void(const std::filesystem::path)> GetFontFiles;
GetFontFiles = [&](const std::filesystem::path& dir)
{
for (const auto& file : std::filesystem::directory_iterator(dir))
{
if (file.is_directory())
{
GetFontFiles(dir / file);
}
else if (file.path().extension() == ".ttf")
{
// store font name without extension
fontFilesMapping[file.path().stem()] = file.path();
}
}
};
GetFontFiles(fontsDir);
}
if (fontFilesMapping.contains(fontName))
{
return fontFilesMapping.at(fontName);
}
return "";
}
}