20 #ifndef ANTKEEPER_TYPE_BITMAP_FONT_HPP
21 #define ANTKEEPER_TYPE_BITMAP_FONT_HPP
26 #include <unordered_map>
55 virtual bool contains(char32_t code)
const;
71 void remove(char32_t code);
87 bool pack(
bool resize =
true);
118 [[nodiscard]]
inline const std::shared_ptr<gl::texture_2d>&
get_texture() const noexcept
124 std::unordered_map<char32_t, bitmap_glyph> m_glyphs;
125 std::shared_ptr<gl::texture_2d> m_texture;
126 std::shared_ptr<gl::sampler> m_sampler;
Raster font in which glyphs are stored as arrays of pixels.
bitmap_font()
Creates an empty bitmap font.
virtual const glyph_metrics & get_glyph_metrics(char32_t code) const
Returns metrics describing a glyph.
void unpack(bool resize=true)
Unpacks all glyph bitmaps from the font bitmap.
virtual bool contains(char32_t code) const
Returns true if the font contains a glyph with the given character code.
bool pack(bool resize=true)
Packs all glyph bitmaps into the font bitmap.
void remove(char32_t code)
Removes a glyph from the font.
virtual ~bitmap_font()=default
Destroys a bitmap font.
const std::shared_ptr< gl::texture_2d > & get_texture() const noexcept
Returns a pointer to the glyph corresponding to a UTF-32 character code, or nullptr if no such glyph ...
bitmap_glyph & insert(char32_t code)
Inserts a glyph into the font.
void clear()
Removes all glyphs from the font.
const bitmap_glyph * get_glyph(char32_t code) const
Returns a pointer to the glyph corresponding to a UTF-32 character code, or nullptr if no such glyph ...
Abstract base class for fonts.
Single glyph in a bitmap font.
Metrics describing properties of a font.
Metrics describing properties of a glyph.