20 #ifndef ANTKEEPER_TYPE_TYPEFACE_HPP
21 #define ANTKEEPER_TYPE_TYPEFACE_HPP
27 #include <unordered_set>
122 virtual bool get_bitmap(
float height, char32_t code, std::vector<std::byte>& bitmap, std::uint32_t& bitmap_width, std::uint32_t& bitmap_height)
const = 0;
136 [[nodiscard]]
inline const std::unordered_set<char32_t>&
get_charset() const noexcept
Abstract base class for a typeface, which corresponds to a single digital font file.
virtual bool get_metrics(float height, font_metrics &metrics) const =0
Gets metrics for a font of the specified size.
virtual bool get_kerning(float height, char32_t first, char32_t second, math::fvec2 &offset) const =0
Gets the kerning offset for a pair of glyphs.
void set_weight(int weight)
Sets the weight of the typeface.
virtual bool get_bitmap(float height, char32_t code, std::vector< std::byte > &bitmap, std::uint32_t &bitmap_width, std::uint32_t &bitmap_height) const =0
Gets a bitmap of a glyph in a font of the specified size.
virtual bool get_metrics(float height, char32_t code, glyph_metrics &metrics) const =0
Gets metrics for a glyph in a font of the specified size.
void set_style(typeface_style style)
Sets the style of the typeface.
typeface_style get_style() const noexcept
Returns the style of the typeface.
int get_weight() const noexcept
Returns the weight of the typeface.
virtual ~typeface()=default
Destroys a typeface.
std::unordered_set< char32_t > charset
virtual bool has_kerning() const =0
Returns true if the typeface contains kerning information, false otherwise.
typeface()
Creates an empty typeface.
const std::unordered_set< char32_t > & get_charset() const noexcept
Returns the set of characters supported by the typeface.
T offset(T longitude)
Calculates the UTC offset at a given longitude.
typeface_style
Emumerates typeface styles.
@ italic
Italic typeface style.
@ oblique
Oblique typeface style.
@ normal
Normal typeface style.
Metrics describing properties of a font.
Metrics describing properties of a glyph.