mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 15:17:37 +03:00
## Summary * Adds (optional) Hyphenation for English, French, German, Russian languages ## Additional Context * Included hyphenation dictionaries add approximately 280kb to the flash usage (German alone takes 200kb) * Trie encoded dictionaries are adopted from hypher project (https://github.com/typst/hypher) * Soft hyphens (and other explicit hyphens) take precedence over dict-based hyphenation. Overall, the hyphenation rules are quite aggressive, as I believe it makes more sense on our smaller screen. --------- Co-authored-by: Dave Allie <dave@daveallie.com>
27 lines
688 B
C++
27 lines
688 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
|
|
#include "LanguageHyphenator.h"
|
|
|
|
struct LanguageEntry {
|
|
const char* cliName;
|
|
const char* primaryTag;
|
|
const LanguageHyphenator* hyphenator;
|
|
};
|
|
|
|
struct LanguageEntryView {
|
|
const LanguageEntry* data;
|
|
size_t size;
|
|
|
|
const LanguageEntry* begin() const { return data; }
|
|
const LanguageEntry* end() const { return data + size; }
|
|
};
|
|
|
|
// Returns the Liang-backed hyphenator for a given primary language tag (e.g., "en", "fr").
|
|
const LanguageHyphenator* getLanguageHyphenatorForPrimaryTag(const std::string& primaryTag);
|
|
|
|
// Exposes the list of supported languages primarily for tooling/tests.
|
|
LanguageEntryView getLanguageEntries();
|