7#include "text_style_set.hpp"
8#include "text_style.hpp"
9#include "../font/font.hpp"
10#include "../unicode/unicode.hpp"
11#include "../geometry/geometry.hpp"
12#include "../units/units.hpp"
13#include "../macros.hpp"
15hi_export_module(hikogui.text.text_shaper_char);
17hi_export
namespace hi::inline
v1 {
19class text_shaper_char {
130 [[nodiscard]] text_shaper_char(hi::grapheme
const&
grapheme, text_style_set
const&
style, unit::pixel_density
pixel_density) noexcept :
183 hi_axiom(not
glyphs.font.empty());
187 [[nodiscard]]
friend bool operator==(
text_shaper_char const& lhs,
char32_t const& rhs)
noexcept
189 return lhs.grapheme == rhs;
192 [[nodiscard]]
friend bool operator==(text_shaper_char
const& lhs,
char const& rhs)
noexcept
194 return lhs.grapheme == rhs;
200 void set_glyph(hi::font_glyph_ids&& new_glyphs)
noexcept
203 hi_axiom(not glyphs.font.empty());
204 font_size =
round(style.size() * pixel_density, glyphs.font_metrics().x_height);
205 metrics = font_size.in(unit::pixels_per_em) * glyphs.front_glyph_metrics();
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
font_glyph_ids find_glyph(font_id font, grapheme grapheme) noexcept
Find a glyph using the given code-point.
Definition font_book.hpp:362
Definition font_font.hpp:32
Definition font_glyph_ids.hpp:17
An identifier for a font-family that was registered with HikoGUI.
Definition font_id.hpp:23
A high-level geometric point Part of the high-level vec, point, mat and color types.
Definition point2.hpp:28
Definition text_shaper_char.hpp:19
size_t line_nr
The line number where this character is located, counting from top to bottom line.
Definition text_shaper_char.hpp:53
unicode_bidi_class direction
The text direction for this glyph.
Definition text_shaper_char.hpp:97
hi::grapheme grapheme
The grapheme.
Definition text_shaper_char.hpp:23
void initialize_glyph() noexcept
Initialize the glyph based on the grapheme.
Definition text_shaper_char.hpp:160
bool is_trailing_white_space
Set to true if this glyph is a white space at the end of a line.
Definition text_shaper_char.hpp:120
au::Quantity< unit::PixelsPerEm, float > font_size
The font size in pixels, rounded so that the x-height is rounded to the nearest pixel.
Definition text_shaper_char.hpp:109
bool glyph_is_initial
The glyph is the initial glyph.
Definition text_shaper_char.hpp:128
hi::font_glyph_ids glyphs
The glyph representing one or more graphemes.
Definition text_shaper_char.hpp:43
point2 position
Position of the character.
Definition text_shaper_char.hpp:65
hi::glyph_metrics metrics
The glyph metrics of the current starter glyph.
Definition text_shaper_char.hpp:49
font_metrics_px font_metrics() const noexcept
Get the scaled font metrics for this character.
Definition text_shaper_char.hpp:181
iso_15924 script
The script of this character.
Definition text_shaper_char.hpp:105
unicode_general_category general_category
The general category of this grapheme.
Definition text_shaper_char.hpp:91
size_t column_nr
The column number where the character is located on the line, counting from left to right in display ...
Definition text_shaper_char.hpp:57
float width
The width used for this grapheme when folding lines.
Definition text_shaper_char.hpp:116
unit::pixel_density pixel_density
The scale to resize the font's size to match the physical display.
Definition text_shaper_char.hpp:31
aarectangle rectangle
The rectangle for this character.
Definition text_shaper_char.hpp:87
hi::text_style style
The style of how to display the grapheme.
Definition text_shaper_char.hpp:27
void replace_glyph(char32_t code_point) noexcept
Called by the bidi-algorithm to mirror glyphs.
Definition text_shaper_char.hpp:173
void initialize_glyph(hi::font_id font) noexcept
Initialize the glyph based on the grapheme.
Definition text_shaper_char.hpp:145