7#include "glyph_metrics.hpp"
8#include "font_glyph_ids.hpp"
10#include "unicode_mask.hpp"
11#include "font_weight.hpp"
12#include "font_variant.hpp"
13#include "../graphic_path.hpp"
14#include "../resource_view.hpp"
15#include "../exception.hpp"
16#include "../required.hpp"
35 bool monospace =
false;
38 bool condensed =
false;
39 font_weight weight = font_weight::Regular;
40 float optical_size = 12.0;
46 float DigitWidth = 0.0;
53 virtual ~font() =
default;
55 font &operator=(
font const &) =
delete;
63 [[nodiscard]]
virtual bool loaded() const noexcept = 0;
99 return {weight, italic};
102 [[nodiscard]]
friend std::string to_string(font
const &rhs)
noexcept
105 "{} - {}: {}{}{}{}{} {} num-code-points={}",
108 rhs.monospace ?
'M' :
'_',
109 rhs.serif ?
'S' :
'_',
110 rhs.italic ?
'I' :
'_',
111 rhs.condensed ?
'C' :
'_',
114 rhs.unicode_mask.size());
122template<
typename CharT>
123struct formatter<tt::font, CharT> : formatter<std::string_view, CharT> {
124 auto format(
tt::font const &t,
auto &fc)
126 return formatter<string_view, CharT>::format(
to_string(t), fc);
A path is a vector graphics object.
Definition graphic_path.hpp:28
Definition tagged_id.hpp:18
std::vector< tt::font * > fallback_chain
List of fonts to use as a fallback for this font.
Definition font.hpp:50
std::string family_name
The description is filled with information parsed from the font.
Definition font.hpp:32
virtual bool load_glyph_metrics(tt::glyph_id glyph_id, glyph_metrics &metrics, tt::glyph_id lookahead_glyph_id=tt::glyph_id{}) const noexcept=0
virtual tt::glyph_id find_glyph(char32_t c) const noexcept=0
Get the glyph for a code-point.
virtual std::optional< tt::glyph_id > load_glyph(tt::glyph_id glyph_id, graphic_path &path) const noexcept=0
virtual bool loaded() const noexcept=0
Return if the font is loaded.
Definition font_glyph_ids.hpp:80
A font variant is one of 16 different fonts that can be part of a family.
Definition font_variant.hpp:16
Definition glyph_metrics.hpp:17
Definition grapheme.hpp:21
A mask of unicode code-points.
Definition unicode_mask.hpp:101