EHS
Loading...
Searching...
No Matches
FontAtlas.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Array.h"
5
6#include "Glyph.h"
7#include "ehs/Anchor.h"
8#include "ehs/io/img/Img.h"
9#include "ehs/io/mdl/Mesh.h"
10
11namespace ehs
12{
13 class EHS_LIB_IO FontAtlas : public BaseObj
14 {
15 private:
16 UInt_64 hashId;
17 Str_8 id;
18 UInt_64 glyphScale;
19 Array<Glyph> glyphs;
20 Vec2_u64 resolution;
21 UInt_64 size;
22 Byte* atlas;
23
24 public:
25 ~FontAtlas() override;
26
27 FontAtlas();
28
29 FontAtlas(const Str_8& filePath);
30
31 FontAtlas(FontAtlas&& fa) noexcept;
32
33 FontAtlas(const FontAtlas& fa);
34
35 FontAtlas& operator=(FontAtlas&& fa) noexcept;
36
37 FontAtlas& operator=(const FontAtlas& fa);
38
39 operator Byte*() const;
40
41 void Release();
42
43 UInt_64 GetHashId() const;
44
45 Str_8 GetId() const;
46
47 UInt_64 GetGlyphScale() const;
48
49 const Array<Glyph>& GetGlyphs() const;
50
51 Glyph GetGlyph(Char_32 code) const;
52
53 Vec2_u64 GetResolution() const;
54
55 UInt_64 GetSize() const;
56
57 bool IsValid() const;
58
59 Vec2_f CalculateSize(const Str_8& text) const;
60
61 float CalculateWidth(const Str_8& text) const;
62
63 float CalculateHeight(const Str_8& text) const;
64
65 UInt_64 CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const;
66
67 Mesh Generate(Anchor anchor, const Str_8& text) const;
68 };
69}
Definition Array.h:16
BaseObj()
Definition BaseObj.cpp:10
bool IsValid() const
Definition FontAtlas.cpp:169
FontAtlas & operator=(FontAtlas &&fa) noexcept
Definition FontAtlas.cpp:67
Glyph GetGlyph(Char_32 code) const
Definition FontAtlas.cpp:150
UInt_64 GetHashId() const
Definition FontAtlas.cpp:130
float CalculateWidth(const Str_8 &text) const
Definition FontAtlas.cpp:191
Mesh Generate(Anchor anchor, const Str_8 &text) const
Definition FontAtlas.cpp:238
UInt_64 CalculateIndexAtPoint(const Str_8 &text, const Vec2_f &point) const
Definition FontAtlas.cpp:220
float CalculateHeight(const Str_8 &text) const
Definition FontAtlas.cpp:205
const Array< Glyph > & GetGlyphs() const
Definition FontAtlas.cpp:145
void Release()
Definition FontAtlas.cpp:118
FontAtlas()
Definition FontAtlas.cpp:12
Vec2_f CalculateSize(const Str_8 &text) const
Definition FontAtlas.cpp:174
UInt_64 GetGlyphScale() const
Definition FontAtlas.cpp:140
Vec2_u64 GetResolution() const
Definition FontAtlas.cpp:159
UInt_64 GetSize() const
Definition FontAtlas.cpp:164
Str_8 GetId() const
Definition FontAtlas.cpp:135
Definition Glyph.h:11
Definition Mesh.h:11
Definition Anchor.h:6
Vec2< float > Vec2_f
Definition Vec2.h:384
char32_t Char_32
Definition Types.h:42
Vec2< UInt_64 > Vec2_u64
Definition Vec2.h:372
Anchor
Definition Anchor.h:8
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1902
unsigned char Byte
Definition Types.h:39