7#include "text_decoration.hpp"
8#include "semantic_text_style.hpp"
9#include "../color/module.hpp"
10#include "../i18n/module.hpp"
11#include "../unicode/module.hpp"
12#include "../utility/module.hpp"
13#include "../font/module.hpp"
14#include "../telemetry/module.hpp"
15#include "../container/module.hpp"
20namespace hi::inline
v1 {
24 phrasing_mask phrasing_mask;
37 hi::phrasing_mask phrasing_mask,
45 phrasing_mask(phrasing_mask),
46 language_filter(language_filter),
47 script_filter(script_filter),
52 decoration(decoration)
56 [[nodiscard]]
size_t hash()
const noexcept
75 if (not to_bool(phrasing_mask & to_phrasing_mask(
phrasing))) {
78 if (language_filter and language and language_filter != language) {
81 if (script_filter and script and script_filter != script) {
94 [[nodiscard]]
size_t operator()(hi::text_sub_style
const& rhs)
const noexcept
100namespace hi::inline
v1::detail {
106 using iterator = vector_type::const_iterator;
116 hi_assert(back().language_filter.empty());
120 [[nodiscard]]
bool empty()
const noexcept
122 return _sub_styles.
empty();
125 explicit operator bool()
const noexcept
130 [[nodiscard]]
size_t hash()
const noexcept
133 for (
hilet& sub_style : _sub_styles) {
139 [[nodiscard]]
reference back()
const noexcept
141 return _sub_styles.
back();
144 [[nodiscard]] iterator begin()
const noexcept
146 return _sub_styles.
begin();
149 [[nodiscard]] iterator end()
const noexcept
151 return _sub_styles.
end();
161 [[nodiscard]]
size_t operator()(hi::detail::text_style_impl
const& rhs)
const noexcept
167namespace hi::inline
v1 {
169inline auto text_styles = stable_set<text_style_impl>{};
174 using int_type = uint16_t;
181 [[nodiscard]]
constexpr friend bool operator==(
text_style const&,
text_style const&)
noexcept =
default;
183 constexpr text_style(semantic_text_style rhs) noexcept : _value(0xff00 + std::to_underlying(rhs)) {}
188 if (index < 0xff00) {
189 _value = narrow_cast<uint16_t>(index);
191 hi_log_error_once(
"text-style:error:too-many",
"Too many text-styles");
197 [[nodiscard]]
constexpr bool empty()
const noexcept
199 return _value == 0xffff;
202 constexpr explicit operator bool()
const noexcept
207 [[nodiscard]]
constexpr bool is_semantic()
const noexcept
210 return _value >= 0xff00;
213 constexpr explicit operator semantic_text_style()
const noexcept
215 return static_cast<semantic_text_style
>(narrow_cast<std::underlying_type_t<semantic_text_style>>(_value - 0xff00));
221 if (_value < 0xff00) {
231 if (_value < 0xff00) {
232 return detail::text_styles[_value].back();
240 for (
hilet& style : detail::text_styles[_value]) {
241 if (style.matches(
phrasing, language, script)) {
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:199
#define hi_not_implemented(...)
This part of the code has not been implemented yet.
Definition assert.hpp:335
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:253
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
phrasing
Phrasing.
Definition phrasing.hpp:27
DOXYGEN BUG.
Definition algorithm.hpp:13
text_decoration
Describes how a grapheme should be underlined when rendering the text.
Definition text_decoration.hpp:20
constexpr bool matches(phrasing_mask const &lhs, phrasing const &rhs) noexcept
Check if the text-phrasing is included in the text-phrasing-mask.
Definition phrasing.hpp:224
geometry/margins.hpp
Definition cache.hpp:11
This is a RGBA floating point color.
Definition color.hpp:42
font_book keeps track of multiple fonts.
Definition font_book.hpp:31
A font variant is one of 16 different fonts that can be part of a family.
Definition font_variant.hpp:16
ISO-15924 script code.
Definition iso_15924.hpp:17
ISO-639 language code.
Definition iso_639.hpp:23
Definition text_style.hpp:23
Definition text_style.hpp:102
Definition text_style.hpp:172
Definition concepts.hpp:39