MOS
font.hpp
1 #pragma once
2 #include <map>
3 #include <memory>
4 #include <mos/gfx/character.hpp>
5 #include <mos/gfx/texture_2d.hpp>
6 
7 namespace mos::gfx {
8 
10 class Font final {
11 public:
12  using Char_map = std::map<unsigned int, Character>;
13  using Char_pair = std::pair<unsigned int, Character>;
16  Font(Char_map characters, const Shared_texture_2D &texture,
17  float height, float base);
18 
19  static auto load(const std::string &path) -> Font;
20 
22  auto height() const -> float;
23 
25  auto base() const -> float;
26 
28  Shared_texture_2D texture;
29 
31  Char_map characters;
32 
33 private:
34  float height_;
35  float base_;
36 };
37 } // namespace mos::gfx
Shared_texture_2D texture
Texture with characters.
Definition: font.hpp:28
auto height() const -> float
Height.
Definition: assets.hpp:17
Font(Char_map characters, const Shared_texture_2D &texture, float height, float base)
auto base() const -> float
Base line.
Bitmap font.
Definition: font.hpp:10
Char_map characters
Characters supported.
Definition: font.hpp:31