working version of text rendering
This commit is contained in:
41
openVulkanoCpp/Scene/FontAtlasGenerator.hpp
Normal file
41
openVulkanoCpp/Scene/FontAtlasGenerator.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 <string>
|
||||
#include <map>
|
||||
#include "Scene/Texture.hpp"
|
||||
#include "msdfgen.h"
|
||||
#include "msdfgen-ext.h"
|
||||
#include "msdf-atlas-gen/msdf-atlas-gen.h"
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
using namespace msdfgen;
|
||||
using namespace msdf_atlas;
|
||||
using namespace OpenVulkano::Scene;
|
||||
|
||||
struct GlyphInfo
|
||||
{
|
||||
GlyphGeometry geometry;
|
||||
GlyphBox glyphBox;
|
||||
Texture texture;
|
||||
};
|
||||
|
||||
class FontAtlasGenerator
|
||||
{
|
||||
public:
|
||||
void GenerateAtlas(const std::string& fontFile, const std::string& outputFile, const Charset& = Charset::ASCII);
|
||||
std::map<unicode_t, GlyphInfo>& GetAtlasInfo() { return m_symbols; }
|
||||
private:
|
||||
std::pair<FreetypeHandle*, FontHandle*> GetHandlers(const std::string& fontFile);
|
||||
private:
|
||||
ImmediateAtlasGenerator<float, 1, sdfGenerator, BitmapAtlasStorage<msdfgen::byte, 1>> m_generator;
|
||||
std::map<unicode_t, GlyphInfo> m_symbols;
|
||||
std::string m_loadedFont;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user