7#include "text_decoration.hpp"
8#include "text_phrasing.hpp"
9#include "semantic_text_style.hpp"
10#include "../color/module.hpp"
11#include "../i18n/iso_15924.hpp"
12#include "../i18n/iso_639.hpp"
13#include "../utility/module.hpp"
14#include "../font/module.hpp"
16#include "../stable_set.hpp"
21namespace hi::inline
v1 {
25 text_phrasing_mask phrasing_mask;
38 text_phrasing_mask phrasing_mask,
46 phrasing_mask(phrasing_mask),
47 language_filter(language_filter),
48 script_filter(script_filter),
53 decoration(decoration)
57 [[nodiscard]]
size_t hash()
const noexcept
76 if (not to_bool(phrasing_mask & to_text_phrasing_mask(phrasing))) {
82 if (script_filter and script and script_filter != script) {
95 [[nodiscard]]
size_t operator()(hi::text_sub_style
const& rhs)
const noexcept
101namespace hi::inline
v1::detail {
107 using iterator = vector_type::const_iterator;
117 hi_assert(back().language_filter.empty());
121 [[nodiscard]]
bool empty()
const noexcept
123 return _sub_styles.
empty();
126 explicit operator bool()
const noexcept
131 [[nodiscard]]
size_t hash()
const noexcept
134 for (
hilet& sub_style : _sub_styles) {
140 [[nodiscard]]
reference back()
const noexcept
142 return _sub_styles.
back();
145 [[nodiscard]] iterator begin()
const noexcept
147 return _sub_styles.
begin();
150 [[nodiscard]] iterator end()
const noexcept
152 return _sub_styles.
end();
162 [[nodiscard]]
size_t operator()(hi::detail::text_style_impl
const& rhs)
const noexcept
168namespace hi::inline
v1 {
170inline auto text_styles = stable_set<text_style_impl>{};
175 using int_type = uint16_t;
179 constexpr text_style(semantic_text_style rhs) noexcept : _value(0xff00 + to_underlying(rhs)) {}
184 if (index < 0xff00) {
185 _value = narrow_cast<uint16_t>(index);
187 hi_log_error_once(
"text-style:error:too-many",
"Too many text-styles");
193 [[nodiscard]]
constexpr bool empty()
const noexcept
195 return _value == 0xffff;
198 constexpr explicit operator bool()
const noexcept
203 [[nodiscard]]
constexpr bool is_semantic()
const noexcept
206 return _value >= 0xff00;
209 constexpr explicit operator semantic_text_style()
const noexcept
211 return static_cast<semantic_text_style
>(narrow_cast<std::underlying_type_t<semantic_text_style>>(_value - 0xff00));
217 if (_value < 0xff00) {
227 if (_value < 0xff00) {
228 return detail::text_styles[_value].back();
236 for (
hilet& style : detail::text_styles[_value]) {
237 if (style.matches(phrasing,
language, script)) {
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:184
#define hi_not_implemented(...)
This part of the code has not been implemented yet.
Definition assert.hpp:320
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:238
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:13
text_phrasing
Definition text_phrasing.hpp:13
text_decoration
Describes how a grapheme should be underlined when rendering the text.
Definition text_decoration.hpp:20
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:19
ISO-639 language code.
Definition iso_639.hpp:24
Definition language.hpp:17
Definition text_style.hpp:24
Definition text_style.hpp:103
Definition text_style.hpp:173
Definition concepts.hpp:39