Persist language-specific e-TeX hyphenation codes

This commit is contained in:
gloamxun committed 2026-11-28 12:14:12 +08:00
1 parent 11fd66713b
commit b472f66d04
10 files changed
+198 -45

No files matched your search

@@ -1656,7 +1656,12 @@ fn add_hyphens(
let mut edits = Vec::new();
let mut word_font = None;
while i <= nodes.len() {
let word_node=nodes.get(i).is_some_and(|n|matches!(n,TextNode::Glyph{original,..} if original.chars().all(|c| state.case_code(super::CaseCode::Lower,c) != 0)))||nodes.get(i).is_some_and(|n|matches!(n,TextNode::Kern{explicit:false,..}));
let lower = |c| super::hyphenation::lower_code(state, language.language, c);
let word_node = match nodes.get(i) {
Some(TextNode::Glyph { original, .. }) => original.chars().all(|c| lower(c) != 0),
Some(TextNode::Kern { explicit: false, .. }) => true,
_ => false,
};
let glyph_font = match nodes.get(i) {
Some(TextNode::Glyph { font, .. }) => Some(*font),
_ => None,
@@ -1703,7 +1708,7 @@ fn add_hyphens(
TextNode::Glyph { original, .. } => original
.chars()
.next()
.is_some_and(|c| state.case_code(super::CaseCode::Lower, c) != 0),
.is_some_and(|c| lower(c) != 0),
_ => true,
})
.is_some_and(|n| {
@@ -1717,7 +1722,7 @@ fn add_hyphens(
|| word
.chars()
.next()
.is_some_and(|c| state.case_code(super::CaseCode::Lower, c) == c as u32))
.is_some_and(|c| lower(c) == c as u32))
&& state.hyphen_character(font).is_some()
&& nodes[i..]
.iter()
@@ -1750,13 +1755,7 @@ fn add_hyphens(
)
})
{
let normalized: String = word
.chars()
.map(|c| {
char::from_u32(state.case_code(super::CaseCode::Lower, c))
.expect("nonzero case mapping")
})
.collect();
let normalized: Vec<_> = word.chars().map(lower).collect();
let points: Vec<_> = state
.hyphenation
.points(language.language, &normalized)