Files
OpenVulkano/openVulkanoCpp/Scene/BitmapFontAtlasGenerator.hpp
2025-01-03 12:17:28 +02:00

34 lines
1.2 KiB
C++

/*
* 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/.
*/
#pragma once
#include "FontAtlasGeneratorBase.hpp"
namespace OpenVulkano::Scene
{
struct FontPixelSizeConfig
{
float size = 24.f;
float dpi = 72.f;
bool isPixelSize = true;
};
class BitmapFontAtlasGenerator : public FontAtlasGeneratorBase
{
public:
BitmapFontAtlasGenerator(FontPixelSizeConfig config = FontPixelSizeConfig()) : FontAtlasGeneratorBase(1), m_pixelSizeConfig(config) {}
void GenerateAtlas(const std::string& fontFile, const std::set<uint32_t>& charset,
const std::optional<std::string>& pngOutput = std::nullopt) override;
void GenerateAtlas(const Array<char>& fontData, const std::set<uint32_t>& charset,
const std::optional<std::string>& pngOutput = std::nullopt) override;
private:
void Generate(const std::variant<std::string, Array<char>>& source, const std::set<uint32_t>& chset, const std::optional<std::string>& pngOutput);
private:
FontPixelSizeConfig m_pixelSizeConfig;
};
}