1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

shaping: fix repeated glyphs for Unicode NFD text

harfbuzz can return incomplete overlapping runs when it processes
text in unicode NFD.  Add another check for the case where we've
accumulated the bytes in the range 0-12 and then harfbuzz returns
another range of 6-12.  We coalesce the two together so that we can
pass the full unresolved sequence to the next fallback pass.

refs: https://github.com/wez/wezterm/issues/2032
This commit is contained in:
Wez Furlong 2022-05-25 06:51:31 -07:00
parent 2725559fc0
commit e298bb7a11
2 changed files with 9 additions and 1 deletions

View File

@ -67,6 +67,7 @@ As features stabilize some brief notes about them will accumulate here.
* Detaching an ssh multiplexer domain sometimes killed the associated panes! [#1993](https://github.com/wez/wezterm/issues/1993)
* `DecreaseFontSize` wasn't quite the inverse of `IncreaseFontSize`. Thanks to [@Funami580](https://github.com/Funami580)! [#1997](https://github.com/wez/wezterm/pull/1997)
* Wayland: unable to paste text that was copied before starting the initial wezterm window. Thanks to [@Funami580](https://github.com/Funami580)! [#1994](https://github.com/wez/wezterm/pull/1994) [#1385](https://github.com/wez/wezterm/issues/1385)
* Unicode NFD text could incorrectly render with repeated glyphs [#2032](https://github.com/wez/wezterm/issues/2032)
### 20220408-101518-b908e2dd

View File

@ -401,13 +401,21 @@ impl HarfbuzzShaper {
std::mem::swap(&mut info, prior);
prior.len += info.len;
continue;
} else if info.cluster + info.len == prior.cluster + prior.len {
// Overlaps and coincide with the end of prior; this one folds away.
// This can happen with NFD rather than NFC text.
// <https://github.com/wez/wezterm/issues/2032>
continue;
}
// log::info!("prior={:#?}, info={:#?}", prior, info);
}
}
}
info_clusters.push(vec![info]);
}
// log::error!("do_shape: font_idx={} {:?} {:#?}", font_idx, &s[range.clone()], info_clusters);
// log::info!("cluster_info: {:#?}", cluster_info);
// log::info!("info_clusters: {:#?}", info_clusters);
let mut direct_clusters = 0;
@ -425,7 +433,6 @@ impl HarfbuzzShaper {
log::error!("incomplete cluster for text={:?} {:?}", s, info_clusters);
}
*/
//println!("Incomplete: {:?}. infos: {:?}", cluster_info, infos);
let first_info = &infos[0];