mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-19 07:37:41 +03:00
- Added EnglishHyphenator and RussianHyphenator classes to handle language-specific hyphenation rules. - Introduced HyphenationCommon for shared utilities and character classification functions. - Updated ParsedText to utilize hyphenation when laying out text. - Enhanced the hyphenation logic to consider word splitting based on available width and character properties. - Refactored existing code to improve readability and maintainability, including the use of iterators and lambda functions for line processing. - Added necessary includes and organized header files for better structure.
32 lines
666 B
C++
32 lines
666 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
struct CodepointInfo {
|
|
uint32_t value;
|
|
size_t byteOffset;
|
|
};
|
|
|
|
enum class Script { Latin, Cyrillic, Mixed };
|
|
|
|
constexpr size_t MIN_PREFIX_CP = 3;
|
|
constexpr size_t MIN_SUFFIX_CP = 2;
|
|
|
|
uint32_t toLowerLatin(uint32_t cp);
|
|
uint32_t toLowerCyrillic(uint32_t cp);
|
|
|
|
bool isLatinLetter(uint32_t cp);
|
|
bool isLatinVowel(uint32_t cp);
|
|
bool isLatinConsonant(uint32_t cp);
|
|
|
|
bool isCyrillicLetter(uint32_t cp);
|
|
bool isCyrillicVowel(uint32_t cp);
|
|
bool isCyrillicConsonant(uint32_t cp);
|
|
|
|
bool isAlphabetic(uint32_t cp);
|
|
bool isVowel(uint32_t cp);
|
|
|
|
Script detectScript(const std::vector<CodepointInfo>& cps);
|