EHS/include/io/FontAtlas.h
2023-12-18 02:13:20 -08:00

46 lines
839 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 ehs
{
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(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(Anchor anchor, const Str_8& text) const;
};
}