Use shaped glyph edges for XeTeX protrusion and line breaking

This commit is contained in:
gloamxun committed 2026-11-25 19:09:56 +08:00
1 parent 5df90f113c
commit 6826efbeb1
12 files changed
+231 -39

No files matched your search

@@ -385,6 +385,7 @@ pub(super) fn pack(
let TextNode::MarginKern { width, right, font, slot } = *node else {
continue;
};
let Ok(slot) = u8::try_from(slot) else { continue };
for (ratio, limit) in [(1000, &mut capacity.stretch), (-1000, &mut capacity.shrink)] {
if let Some((expanded, _)) = fonts.margin(state, font, slot, right, ratio, files)? {
*limit += i64::from(expanded) - i64::from(width);
@@ -408,7 +409,9 @@ pub(super) fn pack(
pdf_device::divide_scaled(shortfall.clamp(-available, available), available, 3).0 as i32;
for i in 0..material.len() {
if let TextNode::MarginKern { ref mut width, right, ref mut font, slot } = material[i] {
if let Some((expanded, selected)) = fonts.margin(state, *font, slot, right, ratio, files)? {
if let Ok(slot) = u8::try_from(slot)
&& let Some((expanded, selected)) = fonts.margin(state, *font, slot, right, ratio, files)?
{
*width = expanded;
*font = selected;
}