Add background styling to span / rich text

This commit is contained in:
Cory Forsstrom 2024-07-23 13:36:40 -07:00 committed by Héctor Ramón Jiménez
parent 23a7e9f981
commit ddcf02f9d0
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
7 changed files with 141 additions and 16 deletions

View file

@ -1,7 +1,7 @@
//! Draw paragraphs.
use crate::alignment;
use crate::text::{Difference, Hit, Span, Text};
use crate::{Point, Size};
use crate::{Point, Rectangle, Size};
/// A text paragraph.
pub trait Paragraph: Sized + Default {
@ -42,6 +42,10 @@ pub trait Paragraph: Sized + Default {
/// that was hit.
fn hit_span(&self, point: Point) -> Option<usize>;
/// Returns all bounds for the provided [`Span`] index of the [`Paragraph`].
/// A [`Span`] can have multiple bounds for each line it's on.
fn span_bounds(&self, index: usize) -> Vec<Rectangle>;
/// Returns the distance to the given grapheme index in the [`Paragraph`].
fn grapheme_position(&self, line: usize, index: usize) -> Option<Point>;