EHS/include/ehs/io/FontAtlas.h

69 lines
1.2 KiB
C
Raw Normal View History

2024-02-05 22:25:30 -08:00
#pragma once
#include "ehs/EHS.h"
#include "ehs/Array.h"
#include "Glyph.h"
#include "ehs/Anchor.h"
#include "ehs/io/img/Img.h"
2024-02-20 23:06:58 -08:00
#include "ehs/io/mdl/Mesh.h"
2024-02-05 22:25:30 -08:00
namespace ehs
{
2024-07-24 01:36:20 -07:00
class EHS_LIB_IO FontAtlas : public BaseObj
2024-02-05 22:25:30 -08:00
{
private:
UInt_64 hashId;
Str_8 id;
UInt_64 glyphScale;
Array<Glyph> glyphs;
Vec2_u64 resolution;
UInt_64 size;
Byte* atlas;
public:
~FontAtlas() override;
FontAtlas();
FontAtlas(const Str_8& filePath);
FontAtlas(FontAtlas&& fa) noexcept;
FontAtlas(const FontAtlas& fa);
FontAtlas& operator=(FontAtlas&& fa) noexcept;
FontAtlas& operator=(const FontAtlas& fa);
operator Byte*() const;
void Release();
UInt_64 GetHashId() const;
Str_8 GetId() const;
UInt_64 GetGlyphScale() const;
const Array<Glyph>& GetGlyphs() const;
Glyph GetGlyph(Char_32 code) const;
Vec2_u64 GetResolution() const;
UInt_64 GetSize() const;
bool IsValid() 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;
};
}