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 constexpr font_weight weight()
const noexcept
39 hi_axiom(value < max());
40 return static_cast<font_weight
>(value % half());
43 [[nodiscard]]
constexpr bool italic()
const noexcept
45 hi_axiom(value < max());
46 return value >= half();
49 constexpr font_variant &set_weight(font_weight rhs)
noexcept
51 value =
static_cast<uint8_t
>(
static_cast<int>(rhs) + (italic() ? half() : 0));
52 hi_axiom(value < max());
58 value =
static_cast<uint8_t
>(
static_cast<int>(weight()) + (rhs ? half() : 0));
59 hi_axiom(value < max());
63 constexpr operator int()
const noexcept
65 hi_axiom(value < max());
74 hi_axiom(i >= 0 && i < max());
75 hilet w = font_weight_alterative(weight(), i % half());
76 hilet it = italic() == (i < half());
82 return std::format(
"{}", rhs.weight(), rhs.italic() ?
"/italic" :
"");
87 return lhs << to_string(rhs);