23 constexpr text_style()
noexcept =
default;
24 text_style(text_style
const&)
noexcept =
default;
25 text_style(text_style&&)
noexcept =
default;
26 text_style& operator=(text_style
const&)
noexcept =
default;
27 text_style& operator=(text_style&&)
noexcept =
default;
28 [[nodiscard]]
friend bool operator==(text_style
const&, text_style
const&)
noexcept =
default;
30 [[nodiscard]]
constexpr bool empty()
const noexcept
36 tmp |= _line_spacing_valid;
37 tmp |= _paragraph_spacing_valid;
41 [[nodiscard]]
constexpr bool complete()
const noexcept
47 tmp &= _line_spacing_valid;
48 tmp &= _paragraph_spacing_valid;
52 [[nodiscard]] lean_vector<font_id>
const& font_chain()
const
54 hi_axiom(_font_valid);
67 if (important or not _font_important) {
68 _font_important |=
static_cast<uint32_t
>(important);
73 _font_chain.insert(_font_chain.begin(), font_chain.begin(), font_chain.end());
78 [[nodiscard]]
constexpr hi::color color()
const
80 hi_axiom(_color_valid);
84 constexpr void set_color(
hi::color color,
bool important =
false)
86 if (important or not _color_important) {
87 _color_important |=
static_cast<uint32_t
>(important);
93 [[nodiscard]]
constexpr unit::font_size_s size()
const
95 hi_axiom(_size_valid);
99 constexpr void set_size(unit::font_size_s size,
bool important =
false)
101 if (important or not _size_important) {
102 _size_important |=
static_cast<uint32_t
>(important);
108 [[nodiscard]]
constexpr float line_spacing()
const
110 hi_axiom(_line_spacing_valid);
111 return _line_spacing;
114 constexpr void set_line_spacing(
float line_spacing,
bool important =
false)
116 if (important or not _line_spacing_important) {
117 _line_spacing_important |=
static_cast<uint32_t
>(important);
118 _line_spacing_valid = 1;
119 _line_spacing = line_spacing;
123 [[nodiscard]]
constexpr float paragraph_spacing()
const
125 hi_axiom(_paragraph_spacing_valid);
126 return _paragraph_spacing;
129 constexpr void set_paragraph_spacing(
float paragraph_spacing,
bool important =
false)
131 if (important or not _paragraph_spacing_important) {
132 _paragraph_spacing_important |=
static_cast<uint32_t
>(important);
133 _paragraph_spacing_valid = 1;
134 _paragraph_spacing = paragraph_spacing;
138 void clear() noexcept
140 *
this = text_style{};
145 void apply(text_style
const& other)
noexcept
147 if (other._font_valid) {
151 if (other._color_valid) {
152 set_color(other._color, other._color_important);
155 if (other._size_valid) {
156 set_size(other._size, other._size_important);
159 if (other._line_spacing_valid) {
160 set_line_spacing(other._line_spacing, other._line_spacing_important);
163 if (other._paragraph_spacing_valid) {
164 set_paragraph_spacing(other._paragraph_spacing, other._paragraph_spacing_important);
169 lean_vector<font_id> _font_chain = {};
171 unit::font_size_s _size = {};
172 float _line_spacing = 1.0f;
173 float _paragraph_spacing = 1.5f;
175 uint32_t _color_valid : 1 = 0;
176 uint32_t _color_important : 1 = 0;
177 uint32_t _font_valid : 1 = 0;
178 uint32_t _font_important : 1 = 0;
179 uint32_t _size_valid : 1 = 0;
180 uint32_t _size_important : 1 = 0;
181 uint32_t _line_spacing_valid : 1 = 0;
182 uint32_t _line_spacing_important : 1 = 0;
183 uint32_t _paragraph_spacing_valid : 1 = 0;
184 uint32_t _paragraph_spacing_important : 1 = 0;
void set_font_chain(lean_vector< font_id > font_chain, bool important=false)
Set the font-chain for this text style.
Definition text_style.hpp:65
void apply(text_style const &other) noexcept
Apply the given text-style on top of this style.
Definition text_style.hpp:145