The ASCII fast path assumes that the current word has only one attributes span, when it can intersect multiple attribute spans.
This commit adds a check to ensure that all the attribute spans intersecting the word range are compatible before taking the fast path. Fixes #445
This commit is contained in:
parent
7051682e70
commit
8cd21a315a
1 changed files with 8 additions and 2 deletions
10
src/shape.rs
10
src/shape.rs
|
|
@ -667,8 +667,14 @@ impl ShapeWord {
|
|||
let is_simple_ascii =
|
||||
word.is_ascii() && !word.chars().any(|c| c.is_ascii_control() && c != '\t');
|
||||
|
||||
if is_simple_ascii && !word.is_empty() {
|
||||
let _attrs = attrs_list.defaults();
|
||||
if is_simple_ascii && !word.is_empty() && {
|
||||
let attrs_start = attrs_list.get_span(word_range.start);
|
||||
attrs_list.spans_iter().all(|(other_range, other_attrs)| {
|
||||
word_range.end <= other_range.start
|
||||
|| other_range.end <= word_range.start
|
||||
|| attrs_start.compatible(&other_attrs.as_attrs())
|
||||
})
|
||||
} {
|
||||
shaping.run(
|
||||
&mut glyphs,
|
||||
font_system,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue