Converted attr range to use RangeMap BTree (#41)

* Converted attr range to use RangeMap BTree

* Change get_span() to use First index instead of range.

* update doc comment
This commit is contained in:
Andrew Wheeler(Genusis) 2022-11-14 13:05:34 -05:00 committed by GitHub
parent b253800383
commit 271ca5cf7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 98 deletions

View file

@ -97,7 +97,7 @@ fn shape_fallback(
// Set color
//TODO: these attributes should not be related to shaping
for glyph in glyphs.iter_mut() {
let attrs = attrs_list.get_span(glyph.start..glyph.end);
let attrs = attrs_list.get_span(glyph.start);
glyph.color_opt = attrs.color_opt;
}
@ -132,7 +132,7 @@ fn shape_run<'a>(
&line[start_run..end_run],
);
let attrs = attrs_list.get_span(start_run..end_run);
let attrs = attrs_list.get_span(start_run);
let font_matches = font_system.get_font_matches(attrs);
@ -304,10 +304,9 @@ impl ShapeWord {
let mut start_run = start_word;
let mut attrs = attrs_list.defaults();
for (egc_i, egc) in word.grapheme_indices(true) {
for (egc_i, _egc) in word.grapheme_indices(true) {
let start_egc = start_word + egc_i;
let end_egc = start_egc + egc.len();
let attrs_egc = attrs_list.get_span(start_egc..end_egc);
let attrs_egc = attrs_list.get_span(start_egc);
if ! attrs.compatible(&attrs_egc) {
//TODO: more efficient
glyphs.append(&mut shape_run(