fix(epub): NFC-normalize EPUB text so NFD diacritics render correctly (#2277)
Co-authored-by: Uri Tauber <uritaube@gmail.com> Co-authored-by: Julia <julia@uxj.io>
This commit is contained in:
co-authored by
Uri Tauber
Julia
parent
7d639cf880
commit
16b0853654
@@ -12,6 +12,12 @@ size_t utf8RemoveLastChar(std::string& str);
|
||||
// Truncate string by removing N UTF-8 codepoints from the end.
|
||||
void utf8TruncateChars(std::string& str, size_t numChars);
|
||||
|
||||
// Canonical composition (NFC) for the Latin / Vietnamese range: precomposes a
|
||||
// base letter followed by combining diacritical mark(s) into a single codepoint.
|
||||
// Needed because the device fonts have no combining-mark positioning, so text
|
||||
// stored in NFD (e.g. some EPUB chapter titles) otherwise renders broken.
|
||||
std::string utf8ComposeNfc(const std::string& in);
|
||||
|
||||
// Truncate a raw char buffer to the last complete UTF-8 codepoint boundary.
|
||||
// Returns the new length (<= len). If the buffer ends mid-sequence, the
|
||||
// incomplete trailing bytes are excluded.
|
||||
|
||||
Reference in New Issue
Block a user