implement system fonts search for Linux

This commit is contained in:
ohyzha
2025-01-17 14:01:24 +02:00
parent 169d6c4129
commit dbc52eff42
4 changed files with 70 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
/*
* 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 <catch2/catch_all.hpp>
#include "Base/Logger.hpp"
#include "Host/SystemInfo.hpp"
#include "Scene/Text/FontAtlasFactory.hpp"
#include <filesystem>
using namespace OpenVulkano;
TEST_CASE("Search system fonts")
{
Logger::SetupLogger("", "tests.log");
// assume these fonts are present since they are default
std::filesystem::path path = SystemInfo::GetSystemFontPath("Ubuntu-R");
REQUIRE(path == "/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf");
path = SystemInfo::GetSystemFontPath("UbuntuMono-BI");
REQUIRE(!path.empty());
path = SystemInfo::GetSystemFontPath("NON-EXISTING Font");
REQUIRE(path.empty());
}

View File

@@ -10,7 +10,6 @@
#include <filesystem>
#include "Scene/Text/FontAtlasFactory.hpp"
#include "Host/ResourceLoader.hpp"
using namespace OpenVulkano;