EHS/include/io/FontAtlas.h

46 lines
839 B
C
Raw Normal View History

2023-12-17 03:29:08 -08:00
#pragma once
2023-12-17 15:00:08 -08:00
#include "EHS.h"
#include "Array.h"
2023-12-17 03:29:08 -08:00
#include "Glyph.h"
2023-12-17 15:00:08 -08:00
#include "Anchor.h"
2023-12-17 15:56:13 -08:00
#include "img/Img.h"
#include "model/Mesh.h"
2023-12-17 03:29:08 -08:00
2023-12-17 15:56:13 -08:00
namespace ehs
2023-12-17 03:29:08 -08:00
{
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;
2023-12-18 02:13:20 -08:00
Glyph GetGlyph(Char_32 code) const;
2023-12-17 03:29:08 -08:00
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;
2023-12-18 02:13:20 -08:00
Mesh Generate(Anchor anchor, const Str_8& text) const;
2023-12-17 03:29:08 -08:00
};
}