/* * 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" #include "Shelf.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& charset, const std::optional& pngOutput = std::nullopt) override; void GenerateAtlas(const Array& fontData, const std::set& charset, const std::optional& pngOutput = std::nullopt) override; private: void Generate(const std::variant>& source, const std::set& chset, const std::optional& pngOutput); std::pair, double> InitGlyphsForPacking(const std::set& chset, const FtFaceRecPtr& face); private: FontPixelSizeConfig m_pixelSizeConfig; }; }