Refactor hyphenation logic to return detailed break information, enhancing line breaking capabilities

This commit is contained in:
Arthur Tazhitdinov
2026-01-07 03:54:43 +05:00
parent f998180353
commit 2315513ca1
3 changed files with 34 additions and 20 deletions

View File

@@ -6,7 +6,11 @@
class Hyphenator {
public:
struct BreakInfo {
size_t byteOffset;
bool requiresInsertedHyphen;
};
// Returns byte offsets where the word may be hyphenated. When includeFallback is true, all positions obeying the
// minimum prefix/suffix constraints are returned even if no language-specific rule matches.
static std::vector<size_t> breakOffsets(const std::string& word, bool includeFallback);
static std::vector<BreakInfo> breakOffsets(const std::string& word, bool includeFallback);
};