lxgui
Loading...
Searching...
No Matches
gui_font.hpp
1#ifndef LXGUI_GUI_FONT_HPP
2#define LXGUI_GUI_FONT_HPP
3
4#include "lxgui/gui_bounds2.hpp"
5#include "lxgui/gui_code_point_range.hpp"
6#include "lxgui/gui_vector2.hpp"
7#include "lxgui/lxgui.hpp"
8#include "lxgui/utils.hpp"
9
10#include <array>
11#include <memory>
12
13namespace lxgui::gui {
14
15class material;
16
22class font {
23public:
25 font() = default;
26
28 virtual ~font() = default;
29
34 virtual std::size_t get_size() const = 0;
35
43 virtual bounds2f get_character_uvs(char32_t c) const = 0;
44
50 virtual bounds2f get_character_bounds(char32_t c) const = 0;
51
57 virtual float get_character_width(char32_t c) const = 0;
58
64 virtual float get_character_height(char32_t c) const = 0;
65
76 virtual float get_character_kerning(char32_t c1, char32_t c2) const = 0;
77
82 virtual std::weak_ptr<material> get_texture() const = 0;
83
88 virtual void update_texture(std::shared_ptr<material> mat) = 0;
89};
90
91} // namespace lxgui::gui
92
93#endif
A texture containing characters.
Definition gui_font.hpp:22
virtual ~font()=default
Destructor.
virtual bounds2f get_character_uvs(char32_t c) const =0
Returns the uv coordinates of a character on the texture.
virtual float get_character_kerning(char32_t c1, char32_t c2) const =0
Return the kerning amount between two characters.
virtual float get_character_height(char32_t c) const =0
Returns the height of a character in pixels.
font()=default
Constructor.
virtual std::size_t get_size() const =0
Get the size of the font in pixels.
virtual bounds2f get_character_bounds(char32_t c) const =0
Returns the rect coordinates of a character as it should be drawn relative to the baseline.
virtual void update_texture(std::shared_ptr< material > mat)=0
Update the material to use for rendering.
virtual std::weak_ptr< material > get_texture() const =0
Returns the underlying material to use for rendering.
virtual float get_character_width(char32_t c) const =0
Returns the width of a character in pixels.