7#include "font_variant.hpp"
8#include "text_decoration.hpp"
9#include "font_family_id.hpp"
10#include "text_phrasing.hpp"
11#include "semantic_text_style.hpp"
12#include "../color/color.hpp"
13#include "../i18n/iso_15924.hpp"
14#include "../i18n/iso_639.hpp"
17#include "../stable_set.hpp"
24namespace hi::inline
v1 {
28 text_phrasing_mask phrasing_mask;
41 text_phrasing_mask phrasing_mask,
49 phrasing_mask(phrasing_mask),
50 language_filter(language_filter),
51 script_filter(script_filter),
56 decoration(decoration)
60 [[nodiscard]]
size_t hash()
const noexcept
79 if (not to_bool(phrasing_mask & to_text_phrasing_mask(phrasing))) {
85 if (script_filter and script and script_filter != script) {
98 [[nodiscard]]
size_t operator()(hi::text_sub_style
const& rhs)
const noexcept
104namespace hi::inline
v1::detail {
110 using iterator = vector_type::const_iterator;
120 hi_assert(back().language_filter.empty());
124 [[nodiscard]]
bool empty()
const noexcept
126 return _sub_styles.
empty();
129 explicit operator bool()
const noexcept
134 [[nodiscard]]
size_t hash()
const noexcept
137 for (
hilet& sub_style : _sub_styles) {
143 [[nodiscard]]
reference back()
const noexcept
145 return _sub_styles.
back();
148 [[nodiscard]] iterator begin()
const noexcept
150 return _sub_styles.
begin();
153 [[nodiscard]] iterator end()
const noexcept
155 return _sub_styles.
end();
165 [[nodiscard]]
size_t operator()(hi::detail::text_style_impl
const& rhs)
const noexcept
171namespace hi::inline
v1 {
173inline auto text_styles = stable_set<text_style_impl>{};
178 using int_type = uint16_t;
182 constexpr text_style(semantic_text_style rhs) noexcept : _value(0xff00 + to_underlying(rhs)) {}
187 if (index < 0xff00) {
188 _value = narrow_cast<uint16_t>(index);
190 hi_log_error_once(
"text-style:error:too-many",
"Too many text-styles");
196 [[nodiscard]]
constexpr bool empty()
const noexcept
198 return _value == 0xffff;
201 constexpr explicit operator bool()
const noexcept
206 [[nodiscard]]
constexpr bool is_semantic()
const noexcept
209 return _value >= 0xff00;
212 constexpr explicit operator semantic_text_style()
const noexcept
214 return static_cast<semantic_text_style
>(narrow_cast<std::underlying_type_t<semantic_text_style>>(_value - 0xff00));
220 if (_value < 0xff00) {
230 if (_value < 0xff00) {
231 return detail::text_styles[_value].back();
239 for (
hilet& style : detail::text_styles[_value]) {
240 if (style.matches(phrasing,
language, script)) {
Utilities to assert and bound check.
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:87
#define hi_not_implemented(...)
This part of the code has not been implemented yet.
Definition assert.hpp:193
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:133
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
This file contains constants and conversion functions.
DOXYGEN BUG.
Definition algorithm.hpp:15
text_phrasing
Definition text_phrasing.hpp:15
text_decoration
Describes how a grapheme should be underlined when rendering the text.
Definition text_decoration.hpp:20
geometry/margins.hpp
Definition assert.hpp:18
This is a RGBA floating point color.
Definition color.hpp:39
ISO-15924 script code.
Definition iso_15924.hpp:19
ISO-639 language code.
Definition iso_639.hpp:25
Definition language.hpp:17
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
Definition text_style.hpp:27
Definition text_style.hpp:106
Definition text_style.hpp:176
Definition concepts.hpp:39