EHS/include/IO/FontAtlas.h
2023-12-17 03:29:08 -08:00

48 lines
898 B
C++

#pragma once
#include "../EHS.h"
#include "../Array.h"
#include "Glyph.h"
#include "../Anchor.h"
#include "Img/Img.h"
#include "Model/Mesh.h"
namespace lwe
{
class FontAtlas : public Img
{
private:
UInt_64 glyphScale;
Array<Glyph> glyphs;
public:
FontAtlas();
FontAtlas(const Str_8& filePath);
FontAtlas(FontAtlas&& fa) noexcept;
FontAtlas(const FontAtlas& fa);
FontAtlas& operator=(FontAtlas&& fa) noexcept;
FontAtlas& operator=(const FontAtlas& fa);
UInt_64 GetGlyphScale() const;
Glyph GetGlyph(const Char_32 code) const;
Vec2_f CalculateSize(const Str_8& text) const;
float CalculateWidth(const Str_8& text) const;
float CalculateHeight(const Str_8& text) const;
UInt_64 CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const;
Mesh Generate(const Anchor anchor, const Str_8& text) const;
FontAtlas* Clone() const override;
};
}