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

@@ -0,0 +1,52 @@
#pragma once
#include "ShaderTypes.h"
#include <filesystem>
#include <string>
#include <vector>
namespace RenderCadenceCompositor
{
struct FontAtlasBuildConfig
{
std::filesystem::path repoRoot;
std::filesystem::path cacheRoot;
double sizePixelsPerEm = 64.0;
double pixelRange = 4.0;
std::string atlasType = "mtsdf";
};
struct FontAtlasBuildOutput
{
std::string fontId;
std::filesystem::path imagePath;
std::filesystem::path jsonPath;
};
class FontAtlasBuilder
{
public:
explicit FontAtlasBuilder(FontAtlasBuildConfig config);
bool BuildPackageFontAtlases(
const ShaderPackage& shaderPackage,
std::vector<FontAtlasBuildOutput>& outputs,
std::string& error) const;
bool BuildFontAtlas(
const ShaderPackage& shaderPackage,
const ShaderFontAsset& fontAsset,
FontAtlasBuildOutput& output,
std::string& error) const;
static bool FindMsdfAtlasGenExecutable(const std::filesystem::path& repoRoot, std::filesystem::path& executablePath);
private:
std::filesystem::path PackageCacheDirectory(const ShaderPackage& shaderPackage) const;
static std::string SanitizePathToken(const std::string& value);
static bool RunProcess(const std::string& commandLine, const std::filesystem::path& workingDirectory, std::string& error);
FontAtlasBuildConfig mConfig;
};
}