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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|