20 constexpr static int max()
24 constexpr static int half()
29 constexpr font_variant(font_weight weight,
bool italic) noexcept :
30 value(
static_cast<uint8_t
>(
static_cast<int>(weight) + (italic ? half() : 0)))
37 [[nodiscard]]
size_t hash()
const noexcept
42 constexpr font_weight weight()
const noexcept
44 hi_axiom(value < max());
45 return static_cast<font_weight
>(value % half());
48 [[nodiscard]]
constexpr bool italic()
const noexcept
50 hi_axiom(value < max());
51 return value >= half();
54 constexpr font_variant &set_weight(font_weight rhs)
noexcept
56 value =
static_cast<uint8_t
>(
static_cast<int>(rhs) + (italic() ? half() : 0));
57 hi_axiom(value < max());
63 value =
static_cast<uint8_t
>(
static_cast<int>(weight()) + (rhs ? half() : 0));
64 hi_axiom(value < max());
68 constexpr operator int()
const noexcept
70 hi_axiom(value < max());
79 hi_axiom(i >= 0 && i < max());
80 hilet w = font_weight_alterative(weight(), i % half());
81 hilet it = italic() == (i < half());
87 return std::format(
"{}", rhs.weight(), rhs.italic() ?
"/italic" :
"");
92 return lhs << to_string(rhs);