Font builder
Some checks failed
CI / React UI Build (push) Successful in 10s
CI / Native Windows Build And Tests (push) Failing after 2m10s
CI / Windows Release Package (push) Has been skipped

This commit is contained in:
2026-05-20 15:49:29 +10:00
parent f589b1e1fe
commit 081364e764
13 changed files with 476 additions and 33 deletions

View File

@@ -1,5 +1,6 @@
#include "SupportedShaderCatalog.h"
#include <filesystem>
#include <iostream>
#include <string>
@@ -29,6 +30,21 @@ ShaderPackage MakeSinglePassPackage()
return shaderPackage;
}
std::filesystem::path RepoRoot()
{
std::filesystem::path path = std::filesystem::current_path();
while (!path.empty())
{
if (std::filesystem::exists(path / "shaders" / "text-overlay" / "shader.json"))
return path;
const std::filesystem::path parent = path.parent_path();
if (parent.empty() || parent == path)
break;
path = parent;
}
return std::filesystem::current_path();
}
void SupportsSinglePassStatelessPackage()
{
const ShaderPackage shaderPackage = MakeSinglePassPackage();
@@ -110,6 +126,24 @@ void RejectsTextParameters()
Expect(!result.supported, "text-parameter packages should be rejected for now");
Expect(result.reason.find("text") != std::string::npos, "text rejection should mention text parameters");
}
void BuildsDeclaredFontAtlasesDuringCatalogLoad()
{
RenderCadenceCompositor::SupportedShaderCatalog catalog;
std::string error;
Expect(catalog.Load(RepoRoot() / "shaders", 12, error), "shader catalog loads");
const auto& fontAtlases = catalog.FontAtlases();
const auto textOverlayIt = fontAtlases.find("text-overlay");
Expect(textOverlayIt != fontAtlases.end(), "text overlay font atlas is prepared during catalog load");
if (textOverlayIt != fontAtlases.end() && !textOverlayIt->second.empty())
{
Expect(std::filesystem::exists(textOverlayIt->second.front().imagePath), "catalog font atlas image exists");
Expect(std::filesystem::exists(textOverlayIt->second.front().jsonPath), "catalog font atlas json exists");
Expect(std::filesystem::file_size(textOverlayIt->second.front().imagePath) > 0, "catalog font atlas image is not empty");
Expect(std::filesystem::file_size(textOverlayIt->second.front().jsonPath) > 0, "catalog font atlas json is not empty");
}
}
}
int main()
@@ -120,6 +154,7 @@ int main()
RejectsTemporalPackage();
RejectsTextureAssets();
RejectsTextParameters();
BuildsDeclaredFontAtlasesDuringCatalogLoad();
if (gFailures != 0)
{