Implement hyphenation support in text layout by enhancing word splitting and line breaking logic
This commit is contained in:
@@ -1,20 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <EpdFontFamily.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
class GfxRenderer;
|
||||
|
||||
// Holds the split portions of a hyphenated word.
|
||||
struct HyphenationResult {
|
||||
std::string head;
|
||||
std::string tail;
|
||||
};
|
||||
#include <vector>
|
||||
|
||||
class Hyphenator {
|
||||
public:
|
||||
// Splits a word so it fits within availableWidth, appending a hyphen to the head when needed.
|
||||
static bool splitWord(const GfxRenderer& renderer, int fontId, const std::string& word, EpdFontStyle style,
|
||||
int availableWidth, HyphenationResult* result, bool force);
|
||||
// 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);
|
||||
};
|
||||
Reference in New Issue
Block a user