New cpp folder structure

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-07-17 22:35:52 +03:00
committed by Konstantin Pastbin
parent c9cbb64f12
commit 76ffc99abd
2390 changed files with 345 additions and 339 deletions

View File

@@ -0,0 +1,35 @@
#pragma once
#include <string>
#include <vector>
#include <hb.h>
namespace harfbuzz_shaping
{
struct TextSegment
{
// TODO(AB): Use 1 byte or 2 bytes for memory-efficient caching.
int32_t m_start; // Offset to the segment start in the string.
int32_t m_length;
hb_script_t m_script;
hb_direction_t m_direction;
TextSegment(int32_t start, int32_t length, hb_script_t script, hb_direction_t direction)
: m_start(start), m_length(length), m_script(script), m_direction(direction) {}
};
struct TextSegments
{
std::u16string m_text;
std::vector<TextSegment> m_segments;
// TODO(AB): Reverse indexes to order segments instead of moving them.
//std::vector<size_t> m_segmentsOrder;
};
// Finds segments with common properties suitable for harfbuzz in a single line of text without newlines.
// Any line breaking/trimming should be done by the caller.
TextSegments GetTextSegments(std::string_view utf8);
std::string DebugPrint(TextSegment const & segment);
} // namespace harfbuzz_shaping