EHS
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
Definition: BaseObj.h:9
Definition: FontAtlas.h:14
Definition: Glyph.h:11
Definition: Mesh.h:11
Definition: Anchor.h:6
char32_t Char_32
Definition: Types.h:42
Anchor
Definition: Anchor.h:8
unsigned char Byte
Definition: Types.h:39