19 [[nodiscard]]
constexpr static size_t size()
noexcept
21 return font_weight_metadata.size() * font_style_metadata.size();
24 constexpr font_variant(
font_weight weight, font_style style) noexcept :
30 constexpr font_variant(
font_weight weight) noexcept : font_variant(weight, font_style::normal) {}
33 [[nodiscard]]
constexpr operator size_t()
const noexcept
35 return to_underlying(style()) + to_underlying(weight()) * font_style_metadata.size();
38 [[nodiscard]]
size_t hash()
const noexcept
48 [[nodiscard]]
constexpr font_style style()
const noexcept
50 return static_cast<font_style
>(_value & 1);
53 constexpr font_variant& set_weight(
font_weight rhs)
noexcept
56 _value |= to_underlying(rhs) << 1;
60 constexpr font_variant& set_style(font_style rhs)
noexcept
63 _value |= to_underlying(rhs);
77 co_yield font_variant{w, s};
84 return std::format(
"{}", rhs.weight(), rhs.style() == font_style::italic ?
"/italic" :
"");
89 return lhs << to_string(rhs);
friend generator< font_variant > alternatives(font_variant const &start) noexcept
Get an alternative font variant.
Definition font_variant.hpp:73