7#include "font_glyph_ids.hpp"
8#include "attributed_grapheme.hpp"
9#include "glyph_metrics.hpp"
10#include "../graphic_path.hpp"
11#include "../geometry/translate.hpp"
34 unicode_general_category general_category;
62 return index >= first && index < last;
65 [[nodiscard]]
bool isLetter() const noexcept
67 return is_L(general_category);
70 [[nodiscard]]
bool isDigit() const noexcept
72 return is_N(general_category);
75 [[nodiscard]]
bool isIdentifier() const noexcept {
return isLetter() || isDigit(); }
77 [[nodiscard]]
bool isWhiteSpace() const noexcept
79 return general_category == unicode_general_category::Zs || general_category == unicode_general_category::Zl;
82 [[nodiscard]]
bool isParagraphSeparator() const noexcept
84 return general_category == unicode_general_category::Zp;
86 [[nodiscard]]
bool isVisible() const noexcept
88 return is_visible(general_category);
99 if (isParagraphSeparator()) {
101 }
else if (isIdentifier()) {
103 }
else if (isVisible()) {
124 ttlet relativePositionPergrapheme = relativePositionInGlyph * narrow_cast<float>(
graphemeCount);
125 return narrow_cast<ssize_t>(
std::round(relativePositionPergrapheme));
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:18
constexpr float & x() noexcept
Access the x element from the point.
Definition point.hpp:85
constexpr float & x() noexcept
Access the x element from the vector.
Definition vector.hpp:83
A path is a vector graphics object.
Definition graphic_path.hpp:28
Definition attributed_glyph.hpp:17
ssize_t relativeIndexAtCoordinate(point2 coordinate) const noexcept
Find the logical index closest to the coordinate.
Definition attributed_glyph.hpp:122
attributed_glyph(attributed_grapheme const &attr_grapheme, attributed_glyph const *next_attr_glyph=nullptr) noexcept
Constructed an attributed glyph from an attributed grapheme.
int selectionWordClusterID() const noexcept
return a cluster id for word selection.
Definition attributed_glyph.hpp:98
point2 position
Position of the glyph.
Definition attributed_glyph.hpp:29
ssize_t logicalIndex
The logical index of the grapheme before bidi-algorithm.
Definition attributed_glyph.hpp:22
int8_t graphemeCount
Number of graphemes merged (ligature) into this attributed-glyph.
Definition attributed_glyph.hpp:32
text_style style
Copied from the original attributed-grapheme.
Definition attributed_glyph.hpp:37
aarectangle boundingBox(float border) const noexcept
Get the bounding box for this glyph.
Definition attributed_glyph.hpp:114
glyph_metrics metrics
Metrics taken from the font file, pre-scaled to the font-size.
Definition attributed_glyph.hpp:25
bool containsLogicalIndex(ssize_t index) const noexcept
Check if this glyph contains the grapheme at index.
Definition attributed_glyph.hpp:59
Definition attributed_grapheme.hpp:14
Definition font_glyph_ids.hpp:78
Definition glyph_metrics.hpp:17
aarectangle boundingBox
Definition glyph_metrics.hpp:20
vector2 advance
Definition glyph_metrics.hpp:58
Definition text_style.hpp:16