Make attribute spans use ranges and update docs
This commit is contained in:
parent
16f0eb9efe
commit
e4c8d4ba6b
8 changed files with 147 additions and 123 deletions
|
|
@ -31,10 +31,8 @@ fn main() {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
let attrs = Attrs::new();
|
||||
let mut buffer = TextBuffer::new(
|
||||
&font_system,
|
||||
attrs,
|
||||
TextMetrics::new(32, 44).scale(display_scale)
|
||||
);
|
||||
|
||||
|
|
@ -43,6 +41,7 @@ fn main() {
|
|||
window.height() as i32
|
||||
);
|
||||
|
||||
let attrs = Attrs::new();
|
||||
let serif_attrs = attrs.family(Family::Serif);
|
||||
let mono_attrs = attrs.monospaced(true).family(Family::Monospace);
|
||||
let comic_attrs = attrs.family(Family::Name("Comic Neue"));
|
||||
|
|
@ -117,7 +116,7 @@ fn main() {
|
|||
let start = line_text.len();
|
||||
line_text.push_str(text);
|
||||
let end = line_text.len();
|
||||
attrs_list.add_span(start, end, attrs);
|
||||
attrs_list.add_span(start..end, attrs);
|
||||
}
|
||||
buffer.lines.push(TextBufferLine::new(line_text, attrs_list));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue