summaryrefslogtreecommitdiffstats
path: root/core/src/text
diff options
context:
space:
mode:
authorLibravatar Cory Forsstrom <cforsstrom18@gmail.com>2024-07-23 13:36:40 -0700
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-28 13:06:57 +0200
commitddcf02f9d0377afe6a35dbbb09a29b4bd52efe2e (patch)
tree146f552a26ca1a41d53a006c570b1ff46b674554 /core/src/text
parent23a7e9f981728e8a95039db8eb8e9f3d8c6ba3d7 (diff)
downloadiced-ddcf02f9d0377afe6a35dbbb09a29b4bd52efe2e.tar.gz
iced-ddcf02f9d0377afe6a35dbbb09a29b4bd52efe2e.tar.bz2
iced-ddcf02f9d0377afe6a35dbbb09a29b4bd52efe2e.zip
Add background styling to span / rich text
Diffstat (limited to 'core/src/text')
-rw-r--r--core/src/text/paragraph.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/text/paragraph.rs b/core/src/text/paragraph.rs
index 26650793..04a97f35 100644
--- a/core/src/text/paragraph.rs
+++ b/core/src/text/paragraph.rs
@@ -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>;